Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions packages/core/src/Kernel/LoadDiscoveryClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Tempest\Core\Kernel;

use AssertionError;
use Tempest\Container\Container;
use Tempest\Core\DiscoveryCache;
use Tempest\Core\DiscoveryCacheStrategy;
Expand Down Expand Up @@ -185,13 +186,19 @@ private function scan(DiscoveryLocation $location, array $discoveries, string $p
// Discovery errors (syntax errors, missing imports, etc.)
// are ignored when they happen in vendor files,
// but they are allowed to be thrown in project code
if ($location->isVendor()) {
try {
try {
if ($location->isVendor()) {
try {
$input = new ClassReflector($className);
} catch (Throwable) {
// @mago-expect lint:no-empty-catch-clause
}
} elseif (class_exists($className)) {
$input = new ClassReflector($className);
} catch (Throwable) { // @mago-expect lint:no-empty-catch-clause
}
} elseif (class_exists($className)) {
$input = new ClassReflector($className);
} catch (AssertionError) {
// Workaround for Pest test files autoloading.
// @mago-expect lint:no-empty-catch-clause
}

if ($input instanceof ClassReflector) {
Expand Down