@@ -69,6 +69,11 @@ public PsiElement[] getGotoDeclarationTargets(PsiElement psiElement, int i, Edit
6969 targets .addAll (constantGoto (psiElement , psiText ));
7070 }
7171
72+ // mind the whitespace
73+ if (hasNewConst (psiElement )) {
74+ targets .addAll (newConstantGoto (psiElement , psiText ));
75+ }
76+
7277 if (psiText .contains ("\\ " )) {
7378 targets .addAll (classGoToDeclaration (psiElement , psiText )) ;
7479 }
@@ -162,6 +167,22 @@ public PsiElement[] getGotoDeclarationTargets(PsiElement psiElement, int i, Edit
162167 return targets .toArray (new PsiElement [targets .size ()]);
163168 }
164169
170+ private boolean hasNewConst (@ NotNull PsiElement psiElement ) {
171+ PsiElement prevSibling = psiElement .getPrevSibling ();
172+ while (prevSibling != null ) {
173+ IElementType elementType = prevSibling .getNode ().getElementType ();
174+ if (elementType == YAMLTokenTypes .TEXT || elementType == YAMLTokenTypes .SCALAR_DSTRING || elementType == YAMLTokenTypes .SCALAR_STRING || elementType == YAMLTokenTypes .TAG ) {
175+ String psiText = PsiElementUtils .getText (prevSibling );
176+
177+ return psiText .equals ("!php/const" );
178+ }
179+
180+ prevSibling = prevSibling .getPrevSibling ();
181+ }
182+
183+ return false ;
184+ }
185+
165186 @ NotNull
166187 private Collection <PsiElement > classGoToDeclaration (@ NotNull PsiElement psiElement , @ NotNull String className ) {
167188
@@ -234,6 +255,14 @@ private Collection<PsiElement> constantGoto(@NotNull PsiElement psiElement, @Not
234255 return ServiceContainerUtil .getTargetsForConstant (psiElement .getProject (), constantName );
235256 }
236257
258+ @ NotNull
259+ private Collection <PsiElement > newConstantGoto (@ NotNull PsiElement psiElement , @ NotNull String constantName ) {
260+ if (StringUtils .isBlank (constantName )) {
261+ return Collections .emptyList ();
262+ }
263+
264+ return ServiceContainerUtil .getTargetsForConstant (psiElement .getProject (), constantName );
265+ }
237266
238267 @ NotNull
239268 private Collection <PsiElement > visitConfigKey (@ NotNull PsiElement psiElement ) {
0 commit comments