@@ -28,10 +28,7 @@ class StimulusAttributes implements \Stringable, \IteratorAggregate
28
28
private array $ actions = [];
29
29
private array $ targets = [];
30
30
31
- /**
32
- * TODO: Remove the second argument and all related code in the next major version.
33
- */
34
- public function __construct (private Environment $ env , private bool $ useOptimizedRendering = false )
31
+ public function __construct (private Environment $ env )
35
32
{
36
33
}
37
34
@@ -113,12 +110,7 @@ public function __toString(): string
113
110
$ attributes = [];
114
111
115
112
if ($ this ->controllers ) {
116
- // TODO: Remove the condition and "else" block in the next major version
117
- if ($ this ->useOptimizedRendering ) {
118
- $ attributes [] = 'data-controller=" ' .$ this ->escape (implode (' ' , $ this ->controllers ), 'html ' ).'" ' ;
119
- } else {
120
- $ attributes [] = 'data-controller=" ' .implode (' ' , array_map (fn (string $ controller ) => $ this ->escape ($ controller , 'html_attr ' ), $ this ->controllers )).'" ' ;
121
- }
113
+ $ attributes [] = 'data-controller=" ' .implode (' ' , array_map (fn (string $ controller ) => $ this ->escape ($ controller , 'html_attr ' ), $ this ->controllers )).'" ' ;
122
114
}
123
115
124
116
if ($ this ->actions ) {
@@ -128,17 +120,9 @@ public function __toString(): string
128
120
$ actionName = $ actionData ['actionName ' ];
129
121
$ eventName = $ actionData ['eventName ' ];
130
122
131
- // TODO: Remove the condition and "else" block in the next major version
132
- if ($ this ->useOptimizedRendering ) {
133
- $ action = $ this ->escape ($ controllerName .'# ' .$ actionName , 'html ' );
134
- if (null !== $ eventName ) {
135
- $ action = $ this ->escape ($ eventName , 'html ' ).'-> ' .$ action ;
136
- }
137
- } else {
138
- $ action = $ this ->escape ($ controllerName , 'html_attr ' ).'# ' .$ this ->escape ($ actionName , 'html_attr ' );
139
- if (null !== $ eventName ) {
140
- $ action = $ this ->escape ($ eventName , 'html_attr ' ).'-> ' .$ action ;
141
- }
123
+ $ action = $ this ->escape ($ controllerName , 'html_attr ' ).'# ' .$ this ->escape ($ actionName , 'html_attr ' );
124
+ if (null !== $ eventName ) {
125
+ $ action = $ this ->escape ($ eventName , 'html_attr ' ).'-> ' .$ action ;
142
126
}
143
127
144
128
return $ action ;
@@ -148,21 +132,14 @@ public function __toString(): string
148
132
}
149
133
150
134
if ($ this ->targets ) {
151
- // TODO: Remove the condition and "else" block in the next major version
152
- if ($ this ->useOptimizedRendering ) {
153
- $ attributes [] = implode (' ' , array_map (function (string $ key , string $ value ): string {
154
- return $ key .'=" ' .$ this ->escape ($ value , 'html ' ).'" ' ;
155
- }, array_keys ($ this ->targets ), $ this ->targets ));
156
- } else {
157
- $ attributes [] = implode (' ' , array_map (function (string $ key , string $ value ): string {
158
- return $ key .'=" ' .implode (' ' , array_map (fn (string $ target ) => $ this ->escape ($ target , 'html_attr ' ), explode (' ' , $ value ))).'" ' ;
159
- }, array_keys ($ this ->targets ), $ this ->targets ));
160
- }
135
+ $ attributes [] = implode (' ' , array_map (function (string $ key , string $ value ): string {
136
+ return $ key .'=" ' .implode (' ' , array_map (fn (string $ target ) => $ this ->escape ($ target , 'html_attr ' ), explode (' ' , $ value ))).'" ' ;
137
+ }, array_keys ($ this ->targets ), $ this ->targets ));
161
138
}
162
139
163
140
if ($ this ->attributes ) {
164
141
$ attributes [] = implode (' ' , array_map (function (string $ attribute , string $ value ): string {
165
- return $ attribute .'=" ' .$ this ->escape ($ value , $ this -> useOptimizedRendering ? ' html ' : 'html_attr ' ).'" ' ;
142
+ return $ attribute .'=" ' .$ this ->escape ($ value , 'html_attr ' ).'" ' ;
166
143
}, array_keys ($ this ->attributes ), $ this ->attributes ));
167
144
}
168
145
0 commit comments