1- "This $variable is interpolated"
2- "$foo[2], $bar[-4], $foo[$bar]"
3- "$foo->bar"
4- "More {$interpolation}"
5- "{$arr['key']}, {$arr['foo'][3]}"
6- "{${$name}}, but not {\${\$name}}"
7- "the return value of getName(): {${getName()}}"
8- "the return value of \$object->getName(): {${$object->getName()}}"
9- "{$foo->$bar}, {$foo->{$baz[1]}}"
10- <<<FOO
11- Heredoc strings $also->support {${$string->interpolation()}}
12- FOO;
13- <<<"FOO_BAR"
14- {${$name}}, but not {\${\$name}}
15- FOO_BAR;
16-
17- ----------------------------------------------------
18-
19- [
20- ["double-quoted-string", [
21- "\"This ",
22- ["interpolation", [["variable", "$variable"]]],
23- " is interpolated\""
24- ]],
25- ["double-quoted-string", [
26- "\"",
27- ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["number", "2"], ["punctuation", "]"]]],
28- ", ",
29- ["interpolation", [["variable", "$bar"], ["punctuation", "["], ["operator", "-"], ["number", "4"], ["punctuation", "]"]]],
30- ", ",
31- ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["variable", "$bar"], ["punctuation", "]"]]],
32- "\""
33- ]],
34- ["double-quoted-string", [
35- "\"",
36- ["interpolation", [["variable", "$foo"], ["operator", "->"], ["property", "bar"]]],
37- "\""
38- ]],
39- ["double-quoted-string", [
40- "\"More ",
41- ["interpolation", [["punctuation", "{"], ["variable", "$interpolation"], ["punctuation", "}"]]],
42- "\""
43- ]],
44- ["double-quoted-string", [
45- "\"",
46- ["interpolation", [
47- ["punctuation", "{"],
48- ["variable", "$arr"], ["punctuation", "["], ["single-quoted-string", "'key'"], ["punctuation", "]"],
49- ["punctuation", "}"]
50- ]],
51- ", ",
52- ["interpolation", [
53- ["punctuation", "{"],
54- ["variable", "$arr"],
55- ["punctuation", "["], ["single-quoted-string", "'foo'"], ["punctuation", "]"],
56- ["punctuation", "["], ["number", "3"], ["punctuation", "]"],
57- ["punctuation", "}"]
58- ]],
59- "\""
60- ]],
61- ["double-quoted-string", [
62- "\"",
63- ["interpolation", [
64- ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
65- ["variable", "$name"],
66- ["punctuation", "}"], ["punctuation", "}"]
67- ]],
68- ", but not {\\${\\$name}}\""
69- ]],
70- ["double-quoted-string", [
71- "\"the return value of getName(): ",
72- ["interpolation", [
73- ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
74- ["function", "getName"], ["punctuation", "("], ["punctuation", ")"],
75- ["punctuation", "}"], ["punctuation", "}"]
76- ]],
77- "\""
78- ]],
79- ["double-quoted-string", [
80- "\"the return value of \\$object->getName(): ",
81- ["interpolation", [
82- ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
83- ["variable", "$object"], ["operator", "->"], ["function", "getName"], ["punctuation", "("], ["punctuation", ")"],
84- ["punctuation", "}"], ["punctuation", "}"]
85- ]],
86- "\""
87- ]],
88- ["double-quoted-string", [
89- "\"",
90- ["interpolation", [
91- ["punctuation", "{"],
92- ["variable", "$foo"], ["operator", "->"], ["variable", "$bar"],
93- ["punctuation", "}"]
94- ]],
95- ", ",
96- ["interpolation", [
97- ["punctuation", "{"],
98- ["variable", "$foo"], ["operator", "->"], ["punctuation", "{"],
99- ["variable", "$baz"], ["punctuation", "["], ["number", "1"], ["punctuation", "]"],
100- ["punctuation", "}"],
101- ["punctuation", "}"]
102- ]],
103- "\""
104- ]],
105- ["heredoc-string", [
106- ["delimiter", [
107- ["punctuation", "<<<"], "FOO"
108- ]],
109- "\r\nHeredoc strings ",
110- ["interpolation", [
111- ["variable", "$also"], ["operator", "->"], ["property", "support"]
112- ]],
113- ["interpolation", [
114- ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
115- ["variable", "$string"], ["operator", "->"], ["function", "interpolation"], ["punctuation", "("], ["punctuation", ")"],
116- ["punctuation", "}"], ["punctuation", "}"]
117- ]],
118- ["delimiter", [
119- "FOO", ["punctuation", ";"]
120- ]]
121- ]],
122- ["heredoc-string", [
123- ["delimiter", [
124- ["punctuation", "<<<\""], "FOO_BAR", ["punctuation", "\""]
125- ]],
126- ["interpolation", [
127- ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
128- ["variable", "$name"],
129- ["punctuation", "}"], ["punctuation", "}"]
130- ]],
131- ", but not {\\${\\$name}}\r\n",
132- ["delimiter", [
133- "FOO_BAR", ["punctuation", ";"]
134- ]]
135- ]]
136- ]
137-
138- ----------------------------------------------------
139-
1+ "This $variable is interpolated"
2+ "$foo[2], $bar[-4], $foo[$bar]"
3+ "$foo->bar"
4+ "More {$interpolation}"
5+ "{$arr['key']}, {$arr['foo'][3]}"
6+ "{${$name}}, but not {\${\$name}}"
7+ "the return value of getName(): {${getName()}}"
8+ "the return value of \$object->getName(): {${$object->getName()}}"
9+ "{$foo->$bar}, {$foo->{$baz[1]}}"
10+ <<<FOO
11+ Heredoc strings $also->support {${$string->interpolation()}}
12+ FOO;
13+ <<<"FOO_BAR"
14+ {${$name}}, but not {\${\$name}}
15+ FOO_BAR;
16+
17+ ----------------------------------------------------
18+
19+ [
20+ ["string double-quoted-string", [
21+ "\"This ",
22+ ["interpolation", [["variable", "$variable"]]],
23+ " is interpolated\""
24+ ]],
25+ ["string double-quoted-string", [
26+ "\"",
27+ ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["number", "2"], ["punctuation", "]"]]],
28+ ", ",
29+ ["interpolation", [["variable", "$bar"], ["punctuation", "["], ["operator", "-"], ["number", "4"], ["punctuation", "]"]]],
30+ ", ",
31+ ["interpolation", [["variable", "$foo"], ["punctuation", "["], ["variable", "$bar"], ["punctuation", "]"]]],
32+ "\""
33+ ]],
34+ ["string double-quoted-string", [
35+ "\"",
36+ ["interpolation", [["variable", "$foo"], ["operator", "->"], ["property", "bar"]]],
37+ "\""
38+ ]],
39+ ["string double-quoted-string", [
40+ "\"More ",
41+ ["interpolation", [["punctuation", "{"], ["variable", "$interpolation"], ["punctuation", "}"]]],
42+ "\""
43+ ]],
44+ ["string double-quoted-string", [
45+ "\"",
46+ ["interpolation", [
47+ ["punctuation", "{"],
48+ ["variable", "$arr"], ["punctuation", "["], ["string single-quoted-string", "'key'"], ["punctuation", "]"],
49+ ["punctuation", "}"]
50+ ]],
51+ ", ",
52+ ["interpolation", [
53+ ["punctuation", "{"],
54+ ["variable", "$arr"],
55+ ["punctuation", "["], ["string single-quoted-string", "'foo'"], ["punctuation", "]"],
56+ ["punctuation", "["], ["number", "3"], ["punctuation", "]"],
57+ ["punctuation", "}"]
58+ ]],
59+ "\""
60+ ]],
61+ ["string double-quoted-string", [
62+ "\"",
63+ ["interpolation", [
64+ ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
65+ ["variable", "$name"],
66+ ["punctuation", "}"], ["punctuation", "}"]
67+ ]],
68+ ", but not {\\${\\$name}}\""
69+ ]],
70+ ["string double-quoted-string", [
71+ "\"the return value of getName(): ",
72+ ["interpolation", [
73+ ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
74+ ["function", "getName"], ["punctuation", "("], ["punctuation", ")"],
75+ ["punctuation", "}"], ["punctuation", "}"]
76+ ]],
77+ "\""
78+ ]],
79+ ["string double-quoted-string", [
80+ "\"the return value of \\$object->getName(): ",
81+ ["interpolation", [
82+ ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
83+ ["variable", "$object"], ["operator", "->"], ["function", "getName"], ["punctuation", "("], ["punctuation", ")"],
84+ ["punctuation", "}"], ["punctuation", "}"]
85+ ]],
86+ "\""
87+ ]],
88+ ["string double-quoted-string", [
89+ "\"",
90+ ["interpolation", [
91+ ["punctuation", "{"],
92+ ["variable", "$foo"], ["operator", "->"], ["variable", "$bar"],
93+ ["punctuation", "}"]
94+ ]],
95+ ", ",
96+ ["interpolation", [
97+ ["punctuation", "{"],
98+ ["variable", "$foo"], ["operator", "->"], ["punctuation", "{"],
99+ ["variable", "$baz"], ["punctuation", "["], ["number", "1"], ["punctuation", "]"],
100+ ["punctuation", "}"],
101+ ["punctuation", "}"]
102+ ]],
103+ "\""
104+ ]],
105+ ["string heredoc-string", [
106+ ["delimiter symbol ", [
107+ ["punctuation", "<<<"], "FOO"
108+ ]],
109+ "\r\nHeredoc strings ",
110+ ["interpolation", [
111+ ["variable", "$also"], ["operator", "->"], ["property", "support"]
112+ ]],
113+ ["interpolation", [
114+ ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
115+ ["variable", "$string"], ["operator", "->"], ["function", "interpolation"], ["punctuation", "("], ["punctuation", ")"],
116+ ["punctuation", "}"], ["punctuation", "}"]
117+ ]],
118+ ["delimiter symbol ", [
119+ "FOO", ["punctuation", ";"]
120+ ]]
121+ ]],
122+ ["string heredoc-string", [
123+ ["delimiter symbol ", [
124+ ["punctuation", "<<<\""], "FOO_BAR", ["punctuation", "\""]
125+ ]],
126+ ["interpolation", [
127+ ["punctuation", "{"], ["variable", "$"], ["punctuation", "{"],
128+ ["variable", "$name"],
129+ ["punctuation", "}"], ["punctuation", "}"]
130+ ]],
131+ ", but not {\\${\\$name}}\r\n",
132+ ["delimiter symbol ", [
133+ "FOO_BAR", ["punctuation", ";"]
134+ ]]
135+ ]]
136+ ]
137+
138+ ----------------------------------------------------
139+
140140Checks for interpolation inside strings.
0 commit comments