32
32
* @author Daniel Espendiller <[email protected] >
33
33
*/
34
34
public class PhpMethodVariableResolveUtil {
35
- private static Set <String > RENDER_METHODS = new HashSet <String >() {{
36
- add ("render" );
37
- add ("renderView" );
38
- add ("renderResponse" );
39
- }};
40
-
41
35
/**
42
36
* search for twig template variable on common use cases
43
37
*
@@ -272,7 +266,7 @@ private static class TemplateRenderPsiRecursiveElementWalkingVisitor extends Psi
272
266
}
273
267
274
268
@ Override
275
- public void visitElement (PsiElement element ) {
269
+ public void visitElement (@ NotNull PsiElement element ) {
276
270
if (element instanceof MethodReference ) {
277
271
visitMethodReference ((MethodReference ) element );
278
272
} else if (element instanceof PhpDocTag ) {
@@ -283,11 +277,13 @@ public void visitElement(PsiElement element) {
283
277
284
278
private void visitMethodReference (@ NotNull MethodReference methodReference ) {
285
279
String methodName = methodReference .getName ();
280
+ if (methodName == null ) {
281
+ return ;
282
+ }
286
283
287
284
// init methods once per file
288
285
if (methods == null ) {
289
286
methods = new HashSet <>();
290
- methods .addAll (RENDER_METHODS );
291
287
292
288
PluginConfigurationExtension [] extensions = Symfony2ProjectComponent .PLUGIN_CONFIGURATION_EXTENSION .getExtensions ();
293
289
if (extensions .length > 0 ) {
@@ -300,7 +296,7 @@ private void visitMethodReference(@NotNull MethodReference methodReference) {
300
296
}
301
297
}
302
298
303
- if (!methods .contains (methodName )) {
299
+ if (!methods .contains (methodName ) && ! methodName . toLowerCase (). contains ( "template" ) && ! methodName . toLowerCase (). contains ( "render" ) ) {
304
300
return ;
305
301
}
306
302
0 commit comments