Skip to content

Commit 4be2642

Browse files
lyrixxfabpot
authored andcommitted
[ErrorHandler] Avoid compile crash while trying to find candidate when a class is not found
1 parent ab707c5 commit 4be2642

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ErrorEnhancer/ClassNotFoundErrorEnhancer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ private function convertFileToClass(string $path, string $file, string $prefix):
152152
}
153153
}
154154

155+
// Symfony may ship some polyfills, like "Normalizer". But if the Intl
156+
// extension is already installed, the next require_once will fail with
157+
// a compile error because the class is already defined. And this one
158+
// does not throw a Throwable. So it's better to skip it here.
159+
if (str_contains($file, 'Resources/stubs')) {
160+
return null;
161+
}
162+
155163
try {
156164
require_once $file;
157165
} catch (\Throwable) {

0 commit comments

Comments
 (0)