File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/main/java/de/espend/idea/php/phpunit/utils Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1111import com .intellij .openapi .vfs .VirtualFile ;
1212import com .intellij .psi .PsiDocumentManager ;
1313import com .intellij .psi .PsiElement ;
14+ import com .intellij .psi .PsiFile ;
1415import com .intellij .psi .codeStyle .CodeStyleManager ;
1516import com .intellij .psi .util .PsiTreeUtil ;
1617import com .jetbrains .php .lang .documentation .phpdoc .lexer .PhpDocTokenTypes ;
@@ -83,9 +84,18 @@ public static boolean isTestClassWithoutIndexAccess(@NotNull PhpClass phpClass)
8384 }
8485
8586 // find somehow inside a project test folder
86- VirtualFile containingFile1 = phpClass .getContainingFile ().getVirtualFile ();
87+ PsiFile containingFile = phpClass .getContainingFile ();
88+ if (containingFile == null ) {
89+ return false ;
90+ }
91+
92+ VirtualFile virtualFile = containingFile .getVirtualFile ();
93+ if (virtualFile == null ) {
94+ return false ;
95+ }
96+
8797 for (VirtualFile contentRoot : ProjectRootManager .getInstance (phpClass .getProject ()).getContentRoots ()) {
88- String relativePath = VfsUtil .getRelativePath (containingFile1 , contentRoot , '/' );
98+ String relativePath = VfsUtil .getRelativePath (virtualFile , contentRoot , '/' );
8999
90100 if (relativePath == null ) {
91101 continue ;
You can’t perform that action at this time.
0 commit comments