Skip to content

Commit

Permalink
minor #50102 [ErrorHandler] Avoid compile crash while trying to find …
Browse files Browse the repository at this point in the history
…candidate when a class is not found (lyrixx)

This PR was submitted for the 5.4 branch but it was merged into the 6.4 branch instead.

Discussion
----------

[ErrorHandler] Avoid compile crash while trying to find candidate when a class is not found

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

---

## Before

![image](https://user-images.githubusercontent.com/408368/233658400-7e6fa6e9-3798-4cbb-a5ee-3a81e714d37d.png)

## After

![image](https://user-images.githubusercontent.com/408368/233658515-8f4c1b81-86cf-4d87-a25f-d63b025e37fb.png)

Commits
-------

fd1f4af [ErrorHandler] Avoid compile crash while trying to find candidate when a class is not found
  • Loading branch information
fabpot committed Jul 13, 2023
2 parents 31bad80 + fd1f4af commit 1cfb601
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -152,6 +152,14 @@ private function convertFileToClass(string $path, string $file, string $prefix):
}
}

// Symfony may ship some polyfills, like "Normalizer". But if the Intl
// extension is already installed, the next require_once will fail with
// a compile error because the class is already defined. And this one
// does not throw a Throwable. So it's better to skip it here.
if (str_contains($file, 'Resources/stubs')) {
return null;
}

try {
require_once $file;
} catch (\Throwable) {
Expand Down

0 comments on commit 1cfb601

Please sign in to comment.