mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 16:30:51 +00:00
[Stubs] Fix Regression Scoped autoload introduced in 0.11.38 (#484)
* [Stubs] Fix Regression Scoped autoload introduced in 0.11.38 * phpstan * comment
This commit is contained in:
parent
17db511043
commit
99e5c8add0
|
@ -44,11 +44,8 @@ final class PHPStanStubLoader
|
|||
}
|
||||
|
||||
foreach (self::STUBS as $stub) {
|
||||
// this is to handle phpstan's stubs got from phpstan-extracted instead of the .phar.
|
||||
$path = sprintf('%s/phpstan/phpstan-extracted/stubs/runtime/%s', $vendorPath, $stub);
|
||||
$isExists = file_exists($path);
|
||||
|
||||
if (! $isExists) {
|
||||
$path = $this->getStubPath($vendorPath, $stub);
|
||||
if ($path === null) {
|
||||
continue 2;
|
||||
}
|
||||
|
||||
|
@ -61,4 +58,23 @@ final class PHPStanStubLoader
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function getStubPath(string $vendorPath, string $stub): ?string
|
||||
{
|
||||
// @todo: need to be switched when phpstan-extracted used after scoped php 7.0 works
|
||||
$path = sprintf('phar://%s/phpstan/phpstan/phpstan.phar/stubs/runtime/%s', $vendorPath, $stub);
|
||||
$isExists = file_exists($path);
|
||||
|
||||
if (! $isExists) {
|
||||
// this is to handle phpstan's stubs got from phpstan-extracted instead of the .phar when exists after scoped php 7.0 applied
|
||||
$path = sprintf('%s/phpstan/phpstan-extracted/stubs/runtime/%s', $vendorPath, $stub);
|
||||
$isExists = file_exists($path);
|
||||
}
|
||||
|
||||
if ($isExists) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user