Skip to content

Commit 0afabf4

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Fix wrong path to autoloader, and exclude vendor classes
2 parents 7e8f772 + 50aecc2 commit 0afabf4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Resources/bin/patch-type-declarations

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ if (false === getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) {
4242
echo 'No SYMFONY_PATCH_TYPE_DECLARATIONS env var set, patching type declarations in all methods (run the command with "-h" for more information).'.PHP_EOL;
4343
}
4444

45-
if (is_file($autoload = __DIR__.'/../../../autoload.php')) {
45+
if (is_file($autoload = __DIR__.'/../../../../autoload.php')) {
4646
// noop
47-
} elseif (is_file($autoload = __DIR__.'/../../../../../autoload.php')) {
47+
} elseif (is_file($autoload = __DIR__.'/../../../../../../../autoload.php')) {
4848
// noop
4949
} else {
5050
echo PHP_EOL.' /!\ Cannot find the Composer autoloader, did you forget to run "composer install"?'.PHP_EOL;
@@ -71,7 +71,11 @@ set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$dep
7171

7272
$exclude = getenv('SYMFONY_PATCH_TYPE_EXCLUDE') ?: null;
7373
foreach ($loader->getClassMap() as $class => $file) {
74-
if ($exclude && preg_match($exclude, realpath($file))) {
74+
if (false !== strpos($file = realpath($file), '/vendor/')) {
75+
continue;
76+
}
77+
78+
if ($exclude && preg_match($exclude, $file)) {
7579
continue;
7680
}
7781

0 commit comments

Comments
 (0)