File tree 1 file changed +12
-11
lines changed
src/Symfony/Bridge/Twig/Command
1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -159,14 +159,20 @@ private function getMetadata($type, $entity)
159
159
throw new \UnexpectedValueException ('Unsupported callback type ' );
160
160
}
161
161
162
+ $ args = $ refl ->getParameters ();
163
+
162
164
// filter out context/environment args
163
- $ args = array_filter ($ refl ->getParameters (), function ($ param ) use ($ entity ) {
164
- if ($ entity ->needsContext () && $ param ->getName () === 'context ' ) {
165
- return false ;
166
- }
165
+ if ($ entity ->needsEnvironment ()) {
166
+ array_shift ($ args );
167
+ }
168
+ if ($ entity ->needsContext ()) {
169
+ array_shift ($ args );
170
+ }
167
171
168
- return !$ param ->getClass () || $ param ->getClass ()->getName () !== 'Twig_Environment ' ;
169
- });
172
+ if ($ type === 'filters ' ) {
173
+ // remove the value the filter is applied on
174
+ array_shift ($ args );
175
+ }
170
176
171
177
// format args
172
178
$ args = array_map (function ($ param ) {
@@ -177,11 +183,6 @@ private function getMetadata($type, $entity)
177
183
return $ param ->getName ();
178
184
}, $ args );
179
185
180
- if ($ type === 'filters ' ) {
181
- // remove the value the filter is applied on
182
- array_shift ($ args );
183
- }
184
-
185
186
return $ args ;
186
187
}
187
188
}
You can’t perform that action at this time.
0 commit comments