diff --git a/build/target-repository/bootstrap.php b/build/target-repository/bootstrap.php index 564f5ffae4b..7b63f6d2fe1 100644 --- a/build/target-repository/bootstrap.php +++ b/build/target-repository/bootstrap.php @@ -47,6 +47,12 @@ // some weird collision with PHPStan custom rule tests if (! is_int($composerAutoloader)) { + // PHPStan calls the registered autoloaders for symbols that may already be declared; + // loading one again would fail with "Cannot redeclare" + if (class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) { + return; + } + $composerAutoloader->loadClass($class); } }