@@ -40,90 +40,98 @@ public function testDoubleQuotedString($testMarker, $expectedContent)
40
40
/**
41
41
* Data provider.
42
42
*
43
+ * Type reference:
44
+ * 1. Directly embedded variables.
45
+ * 2. Braces outside the variable.
46
+ * 3. Braces after the dollar sign.
47
+ * 4. Variable variables and expressions.
48
+ *
49
+ * @link https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
50
+ *
43
51
* @see testDoubleQuotedString()
44
52
*
45
- * @return array
53
+ * @return array<string, array<string, string>>
46
54
*/
47
55
public static function dataDoubleQuotedString ()
48
56
{
49
57
return [
50
- [
58
+ ' Type 1: simple variable ' => [
51
59
'testMarker ' => '/* testSimple1 */ ' ,
52
60
'expectedContent ' => '"$foo" ' ,
53
61
],
54
- [
62
+ ' Type 2: simple variable ' => [
55
63
'testMarker ' => '/* testSimple2 */ ' ,
56
64
'expectedContent ' => '"{$foo}" ' ,
57
65
],
58
- [
66
+ ' Type 3: simple variable ' => [
59
67
'testMarker ' => '/* testSimple3 */ ' ,
60
68
'expectedContent ' => '"${foo}" ' ,
61
69
],
62
- [
70
+ ' Type 1: array offset ' => [
63
71
'testMarker ' => '/* testDIM1 */ ' ,
64
72
'expectedContent ' => '"$foo[bar]" ' ,
65
73
],
66
- [
74
+ ' Type 2: array offset ' => [
67
75
'testMarker ' => '/* testDIM2 */ ' ,
68
76
'expectedContent ' => '"{$foo[ \'bar \']}" ' ,
69
77
],
70
- [
78
+ ' Type 3: array offset ' => [
71
79
'testMarker ' => '/* testDIM3 */ ' ,
72
80
'expectedContent ' => '"${foo[ \'bar \']}" ' ,
73
81
],
74
- [
82
+ ' Type 1: object property ' => [
75
83
'testMarker ' => '/* testProperty1 */ ' ,
76
84
'expectedContent ' => '"$foo->bar" ' ,
77
85
],
78
- [
86
+ ' Type 2: object property ' => [
79
87
'testMarker ' => '/* testProperty2 */ ' ,
80
88
'expectedContent ' => '"{$foo->bar}" ' ,
81
89
],
82
- [
90
+ ' Type 2: object method call ' => [
83
91
'testMarker ' => '/* testMethod1 */ ' ,
84
92
'expectedContent ' => '"{$foo->bar()}" ' ,
85
93
],
86
- [
94
+ ' Type 2: closure function call ' => [
87
95
'testMarker ' => '/* testClosure1 */ ' ,
88
96
'expectedContent ' => '"{$foo()}" ' ,
89
97
],
90
- [
98
+ ' Type 2: chaining various syntaxes ' => [
91
99
'testMarker ' => '/* testChain1 */ ' ,
92
100
'expectedContent ' => '"{$foo[ \'bar \']->baz()()}" ' ,
93
101
],
94
- [
102
+ ' Type 4: variable variables ' => [
95
103
'testMarker ' => '/* testVariableVar1 */ ' ,
96
104
'expectedContent ' => '"${$bar}" ' ,
97
105
],
98
- [
106
+ ' Type 4: variable constants ' => [
99
107
'testMarker ' => '/* testVariableVar2 */ ' ,
100
108
'expectedContent ' => '"${(foo)}" ' ,
101
109
],
102
- [
110
+ ' Type 4: object property ' => [
103
111
'testMarker ' => '/* testVariableVar3 */ ' ,
104
112
'expectedContent ' => '"${foo->bar}" ' ,
105
113
],
106
- [
114
+ ' Type 4: variable variable nested in array offset ' => [
107
115
'testMarker ' => '/* testNested1 */ ' ,
108
116
'expectedContent ' => '"${foo["${bar}"]}" ' ,
109
117
],
110
- [
118
+ ' Type 4: variable array offset nested in array offset ' => [
111
119
'testMarker ' => '/* testNested2 */ ' ,
112
120
'expectedContent ' => '"${foo["${bar[ \'baz \']}"]}" ' ,
113
121
],
114
- [
122
+ ' Type 4: variable object property ' => [
115
123
'testMarker ' => '/* testNested3 */ ' ,
116
124
'expectedContent ' => '"${foo->{$baz}}" ' ,
117
125
],
118
- [
126
+ ' Type 4: variable object property - complex with single quotes ' => [
119
127
'testMarker ' => '/* testNested4 */ ' ,
120
128
'expectedContent ' => '"${foo->{${ \'a \'}}}" ' ,
121
129
],
122
- [
130
+ ' Type 4: variable object property - complex with single and double quotes ' => [
123
131
'testMarker ' => '/* testNested5 */ ' ,
124
132
'expectedContent ' => '"${foo->{"${ \'a \'}"}}" ' ,
125
133
],
126
- [
134
+ ' Type 4: live coding/parse error ' => [
127
135
'testMarker ' => '/* testParseError */ ' ,
128
136
'expectedContent ' => '"${foo["${bar
129
137
' ,
0 commit comments