@@ -54,7 +54,7 @@ public function processNode(Node $node, Scope $scope): array
5454
5555 $ errors = [];
5656 $ usedMagicDirFallback = false ;
57- $ paths = $ this ->resolveFilePaths ($ node , $ scope , $ usedMagicDirFallback );
57+ $ paths = $ this ->resolveFilePaths ($ node-> expr , $ scope , $ usedMagicDirFallback );
5858
5959 foreach ($ paths as $ path ) {
6060 $ path = $ path ->getValue ();
@@ -147,10 +147,9 @@ private function getErrorMessage(Include_ $node, string $filePath): IdentifierRu
147147 /**
148148 * @return list<ConstantStringType>
149149 */
150- private function resolveFilePaths (Include_ $ node , Scope $ scope , bool &$ magicDirFallback ): array
150+ private function resolveFilePaths (Expr $ expr , Scope $ scope , bool &$ magicDirFallback ): array
151151 {
152152 $ magicDirFallback = false ;
153- $ expr = $ node ->expr ;
154153
155154 if (!$ expr instanceof Expr \BinaryOp \Concat) {
156155 return $ scope ->getType ($ expr )->getConstantStrings ();
@@ -166,7 +165,14 @@ private function resolveFilePaths(Include_ $node, Scope $scope, bool &$magicDirF
166165 return $ paths ;
167166 }
168167
169- return $ scope ->getType ($ expr )->getConstantStrings ();
168+ $ paths = [];
169+ $ rightPaths = $ this ->resolveFilePaths ($ expr ->right , $ scope , $ magicDirFallback );
170+ foreach ($ this ->resolveFilePaths ($ expr ->left , $ scope , $ magicDirFallback ) as $ left ) {
171+ foreach ($ rightPaths as $ rightPath ) {
172+ $ paths [] = new ConstantStringType ($ left ->getValue () . $ rightPath ->getValue ());
173+ }
174+ }
175+ return $ paths ;
170176 }
171177
172178 private function isInFileExists (Include_ $ node , Scope $ scope ): bool
0 commit comments