diff --git a/tests/languages/php/string-interpolation_feature.test b/tests/languages/php/string-interpolation_feature.test_with_alias similarity index 83% rename from tests/languages/php/string-interpolation_feature.test rename to tests/languages/php/string-interpolation_feature.test_with_alias index 122452f41a..cb98329795 100644 --- a/tests/languages/php/string-interpolation_feature.test +++ b/tests/languages/php/string-interpolation_feature.test_with_alias @@ -1,140 +1,140 @@ -"This $variable is interpolated" -"$foo[2], $bar[-4], $foo[$bar]" -"$foo->bar" -"More {$interpolation}" -"{$arr['key']}, {$arr['foo'][3]}" -"{${$name}}, but not {\${\$name}}" -"the return value of getName(): {${getName()}}" -"the return value of \$object->getName(): {${$object->getName()}}" -"{$foo->$bar}, {$foo->{$baz[1]}}" -<<support {${$string->interpolation()}} -FOO; -<<<"FOO_BAR" - {${$name}}, but not {\${\$name}} -FOO_BAR; - ----------------------------------------------------- - -[ - ["double-quoted-string", [ - "\"This ", - ["interpolation", [["variable", "$variable"]]], - " is interpolated\"" - ]], - ["double-quoted-string", [ - "\"", - ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["number", "2"], ["punctuation", "]"]]], - ", ", - ["interpolation", [["variable", "$bar"], ["punctuation", "["], ["operator", "-"], ["number", "4"], ["punctuation", "]"]]], - ", ", - ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["variable", "$bar"], ["punctuation", "]"]]], - "\"" - ]], - ["double-quoted-string", [ - "\"", - ["interpolation", [["variable", "$foo"], ["operator", "->"], ["property", "bar"]]], - "\"" - ]], - ["double-quoted-string", [ - "\"More ", - ["interpolation", [["punctuation", "{"], ["variable", "$interpolation"], ["punctuation", "}"]]], - "\"" - ]], - ["double-quoted-string", [ - "\"", - ["interpolation", [ - ["punctuation", "{"], - ["variable", "$arr"], ["punctuation", "["], ["single-quoted-string", "'key'"], ["punctuation", "]"], - ["punctuation", "}"] - ]], - ", ", - ["interpolation", [ - ["punctuation", "{"], - ["variable", "$arr"], - ["punctuation", "["], ["single-quoted-string", "'foo'"], ["punctuation", "]"], - ["punctuation", "["], ["number", "3"], ["punctuation", "]"], - ["punctuation", "}"] - ]], - "\"" - ]], - ["double-quoted-string", [ - "\"", - ["interpolation", [ - ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], - ["variable", "$name"], - ["punctuation", "}"], ["punctuation", "}"] - ]], - ", but not {\\${\\$name}}\"" - ]], - ["double-quoted-string", [ - "\"the return value of getName(): ", - ["interpolation", [ - ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], - ["function", "getName"], ["punctuation", "("], ["punctuation", ")"], - ["punctuation", "}"], ["punctuation", "}"] - ]], - "\"" - ]], - ["double-quoted-string", [ - "\"the return value of \\$object->getName(): ", - ["interpolation", [ - ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], - ["variable", "$object"], ["operator", "->"], ["function", "getName"], ["punctuation", "("], ["punctuation", ")"], - ["punctuation", "}"], ["punctuation", "}"] - ]], - "\"" - ]], - ["double-quoted-string", [ - "\"", - ["interpolation", [ - ["punctuation", "{"], - ["variable", "$foo"], ["operator", "->"], ["variable", "$bar"], - ["punctuation", "}"] - ]], - ", ", - ["interpolation", [ - ["punctuation", "{"], - ["variable", "$foo"], ["operator", "->"], ["punctuation", "{"], - ["variable", "$baz"], ["punctuation", "["], ["number", "1"], ["punctuation", "]"], - ["punctuation", "}"], - ["punctuation", "}"] - ]], - "\"" - ]], - ["heredoc-string", [ - ["delimiter", [ - ["punctuation", "<<<"], "FOO" - ]], - "\r\nHeredoc strings ", - ["interpolation", [ - ["variable", "$also"], ["operator", "->"], ["property", "support"] - ]], - ["interpolation", [ - ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], - ["variable", "$string"], ["operator", "->"], ["function", "interpolation"], ["punctuation", "("], ["punctuation", ")"], - ["punctuation", "}"], ["punctuation", "}"] - ]], - ["delimiter", [ - "FOO", ["punctuation", ";"] - ]] - ]], - ["heredoc-string", [ - ["delimiter", [ - ["punctuation", "<<<\""], "FOO_BAR", ["punctuation", "\""] - ]], - ["interpolation", [ - ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], - ["variable", "$name"], - ["punctuation", "}"], ["punctuation", "}"] - ]], - ", but not {\\${\\$name}}\r\n", - ["delimiter", [ - "FOO_BAR", ["punctuation", ";"] - ]] - ]] -] - ----------------------------------------------------- - +"This $variable is interpolated" +"$foo[2], $bar[-4], $foo[$bar]" +"$foo->bar" +"More {$interpolation}" +"{$arr['key']}, {$arr['foo'][3]}" +"{${$name}}, but not {\${\$name}}" +"the return value of getName(): {${getName()}}" +"the return value of \$object->getName(): {${$object->getName()}}" +"{$foo->$bar}, {$foo->{$baz[1]}}" +<<support {${$string->interpolation()}} +FOO; +<<<"FOO_BAR" + {${$name}}, but not {\${\$name}} +FOO_BAR; + +---------------------------------------------------- + +[ + ["string double-quoted-string", [ + "\"This ", + ["interpolation", [["variable", "$variable"]]], + " is interpolated\"" + ]], + ["string double-quoted-string", [ + "\"", + ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["number", "2"], ["punctuation", "]"]]], + ", ", + ["interpolation", [["variable", "$bar"], ["punctuation", "["], ["operator", "-"], ["number", "4"], ["punctuation", "]"]]], + ", ", + ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["variable", "$bar"], ["punctuation", "]"]]], + "\"" + ]], + ["string double-quoted-string", [ + "\"", + ["interpolation", [["variable", "$foo"], ["operator", "->"], ["property", "bar"]]], + "\"" + ]], + ["string double-quoted-string", [ + "\"More ", + ["interpolation", [["punctuation", "{"], ["variable", "$interpolation"], ["punctuation", "}"]]], + "\"" + ]], + ["string double-quoted-string", [ + "\"", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$arr"], ["punctuation", "["], ["string single-quoted-string", "'key'"], ["punctuation", "]"], + ["punctuation", "}"] + ]], + ", ", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$arr"], + ["punctuation", "["], ["string single-quoted-string", "'foo'"], ["punctuation", "]"], + ["punctuation", "["], ["number", "3"], ["punctuation", "]"], + ["punctuation", "}"] + ]], + "\"" + ]], + ["string double-quoted-string", [ + "\"", + ["interpolation", [ + ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], + ["variable", "$name"], + ["punctuation", "}"], ["punctuation", "}"] + ]], + ", but not {\\${\\$name}}\"" + ]], + ["string double-quoted-string", [ + "\"the return value of getName(): ", + ["interpolation", [ + ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], + ["function", "getName"], ["punctuation", "("], ["punctuation", ")"], + ["punctuation", "}"], ["punctuation", "}"] + ]], + "\"" + ]], + ["string double-quoted-string", [ + "\"the return value of \\$object->getName(): ", + ["interpolation", [ + ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], + ["variable", "$object"], ["operator", "->"], ["function", "getName"], ["punctuation", "("], ["punctuation", ")"], + ["punctuation", "}"], ["punctuation", "}"] + ]], + "\"" + ]], + ["string double-quoted-string", [ + "\"", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$foo"], ["operator", "->"], ["variable", "$bar"], + ["punctuation", "}"] + ]], + ", ", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$foo"], ["operator", "->"], ["punctuation", "{"], + ["variable", "$baz"], ["punctuation", "["], ["number", "1"], ["punctuation", "]"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + "\"" + ]], + ["string heredoc-string", [ + ["delimiter symbol", [ + ["punctuation", "<<<"], "FOO" + ]], + "\r\nHeredoc strings ", + ["interpolation", [ + ["variable", "$also"], ["operator", "->"], ["property", "support"] + ]], + ["interpolation", [ + ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], + ["variable", "$string"], ["operator", "->"], ["function", "interpolation"], ["punctuation", "("], ["punctuation", ")"], + ["punctuation", "}"], ["punctuation", "}"] + ]], + ["delimiter symbol", [ + "FOO", ["punctuation", ";"] + ]] + ]], + ["string heredoc-string", [ + ["delimiter symbol", [ + ["punctuation", "<<<\""], "FOO_BAR", ["punctuation", "\""] + ]], + ["interpolation", [ + ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"], + ["variable", "$name"], + ["punctuation", "}"], ["punctuation", "}"] + ]], + ", but not {\\${\\$name}}\r\n", + ["delimiter symbol", [ + "FOO_BAR", ["punctuation", ";"] + ]] + ]] +] + +---------------------------------------------------- + Checks for interpolation inside strings. \ No newline at end of file