8000 [ErrorHandler] Avoid compile crash while trying to find candidate whe… · andersmateusz/symfony@fd1f4af · GitHub
[go: up one dir, main page]

Skip to content

Commit fd1f4af

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

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Symfony/Component/ErrorHandler/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)
0