Updated Rector to commit a8cc19a3c0387f082fd432e04afce363a90ba5b0

a8cc19a3c0 [NodeTypeResolver] Handle crash PHPStan\File\CouldNotReadFileException: Could not read file on IntermediateSourceLocator (#5438)
This commit is contained in:
Tomas Votruba 2024-01-06 11:06:34 +00:00
parent 3c0a61462c
commit 22304be44f
2 changed files with 13 additions and 4 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '9a794f4ac4a100c1bffbf6af5a0c15f9628f3b90';
public const PACKAGE_VERSION = 'a8cc19a3c0387f082fd432e04afce363a90ba5b0';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-01-06 12:59:16';
public const RELEASE_DATE = '2024-01-06 18:04:23';
/**
* @var int
*/

View File

@ -8,6 +8,7 @@ use PHPStan\BetterReflection\Identifier\IdentifierType;
use PHPStan\BetterReflection\Reflection\Reflection;
use PHPStan\BetterReflection\Reflector\Reflector;
use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator;
use PHPStan\File\CouldNotReadFileException;
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
final class IntermediateSourceLocator implements SourceLocator
{
@ -23,7 +24,11 @@ final class IntermediateSourceLocator implements SourceLocator
public function locateIdentifier(Reflector $reflector, Identifier $identifier) : ?Reflection
{
$sourceLocator = $this->dynamicSourceLocatorProvider->provide();
$reflection = $sourceLocator->locateIdentifier($reflector, $identifier);
try {
$reflection = $sourceLocator->locateIdentifier($reflector, $identifier);
} catch (CouldNotReadFileException $exception) {
return null;
}
if ($reflection instanceof Reflection) {
return $reflection;
}
@ -36,7 +41,11 @@ final class IntermediateSourceLocator implements SourceLocator
public function locateIdentifiersByType(Reflector $reflector, IdentifierType $identifierType) : array
{
$sourceLocator = $this->dynamicSourceLocatorProvider->provide();
$reflections = $sourceLocator->locateIdentifiersByType($reflector, $identifierType);
try {
$reflections = $sourceLocator->locateIdentifiersByType($reflector, $identifierType);
} catch (CouldNotReadFileException $exception) {
return [];
}
if ($reflections !== []) {
return $reflections;
}