diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 26c5802..d61e9ac 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -4,6 +4,7 @@ on: pull_request: push: branches: + - 'main' tags: jobs: diff --git a/src/Locator/ReflectionProvider.php b/src/Locator/ReflectionProvider.php index 97ad6c3..f059bcc 100644 --- a/src/Locator/ReflectionProvider.php +++ b/src/Locator/ReflectionProvider.php @@ -6,7 +6,7 @@ use Composer\Autoload\ClassLoader; use ReflectionClass; -use ReflectionException; +use Throwable; use function array_keys; use function array_reduce; @@ -77,7 +77,7 @@ public function getReflection(string $path): ?ReflectionClass try { $reflection = new ReflectionClass($className); - } catch (ReflectionException) { + } catch (Throwable) { return null; } diff --git a/test/Locator/Asset/ThrowsException.php b/test/Locator/Asset/ThrowsException.php new file mode 100644 index 0000000..8211cc8 --- /dev/null +++ b/test/Locator/Asset/ThrowsException.php @@ -0,0 +1,5 @@ +loader, FormInterface::class); + + $actual = $provider->getReflection($path); + self::assertNull($actual); + } + public function testGetReflectionNotClassReturnsNull(): void { $path = __DIR__ . '/Asset/NoClass.php';