File tree 3 files changed +17
-0
lines changed
main/java/fr/adrienbrault/idea/symfony2plugin/dic/container/util
test/java/fr/adrienbrault/idea/symfony2plugin/tests/dic/container/util
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -731,6 +731,11 @@ public static Collection<PsiElement> getTargetsForConstant(@NotNull Project proj
731
731
contents = contents .replaceAll (":+" , ":" );
732
732
String [] split = contents .split (":" );
733
733
734
+ if (split .length < 2 ) {
735
+ // Empty const name e.g. "\\App\\Foo::"
736
+ return Collections .emptyList ();
737
+ }
738
+
734
739
Collection <PsiElement > psiElements = new ArrayList <>();
735
740
for (PhpClass phpClass : PhpElementsUtil .getClassesInterface (project , split [0 ])) {
736
741
Field fieldByName = phpClass .findFieldByName (split [1 ], true );
Original file line number Diff line number Diff line change @@ -357,6 +357,10 @@ public void testVisitNamedArguments() {
357
357
assertFalse (arguments .contains ("private" ));
358
358
}
359
359
360
+ public void testGetTargetsForConstantForEmptyClassConstName () {
361
+ assertEmpty (ServiceContainerUtil .getTargetsForConstant (getProject (), "\\ App\\ Service\\ FooService::" ));
362
+ }
363
+
360
364
private static class MyStringServiceInterfaceCondition implements Condition <ServiceInterface > {
361
365
362
366
@ NotNull
Original file line number Diff line number Diff line change @@ -26,4 +26,12 @@ private function fooPrivate($private)
26
26
{
27
27
}
28
28
}
29
+ }
30
+
31
+ namespace App \Service
32
+ {
33
+ class FooService
34
+ {
35
+ public const FOO = "foo " ;
36
+ }
29
37
}
You can’t perform that action at this time.
0 commit comments