File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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
731731 contents = contents .replaceAll (":+" , ":" );
732732 String [] split = contents .split (":" );
733733
734+ if (split .length < 2 ) {
735+ // Empty const name e.g. "\\App\\Foo::"
736+ return Collections .emptyList ();
737+ }
738+
734739 Collection <PsiElement > psiElements = new ArrayList <>();
735740 for (PhpClass phpClass : PhpElementsUtil .getClassesInterface (project , split [0 ])) {
736741 Field fieldByName = phpClass .findFieldByName (split [1 ], true );
Original file line number Diff line number Diff line change @@ -357,6 +357,10 @@ public void testVisitNamedArguments() {
357357 assertFalse (arguments .contains ("private" ));
358358 }
359359
360+ public void testGetTargetsForConstantForEmptyClassConstName () {
361+ assertEmpty (ServiceContainerUtil .getTargetsForConstant (getProject (), "\\ App\\ Service\\ FooService::" ));
362+ }
363+
360364 private static class MyStringServiceInterfaceCondition implements Condition <ServiceInterface > {
361365
362366 @ NotNull
Original file line number Diff line number Diff line change @@ -26,4 +26,12 @@ private function fooPrivate($private)
2626 {
2727 }
2828 }
29+ }
30+
31+ namespace App \Service
32+ {
33+ class FooService
34+ {
35+ public const FOO = "foo " ;
36+ }
2937}
You can’t perform that action at this time.
0 commit comments