diff --git a/packages/BetterReflection/src/Reflector/MethodReflector.php b/packages/BetterReflection/src/Reflector/MethodReflector.php index 4b941b3eb69..1968784c6ec 100644 --- a/packages/BetterReflection/src/Reflector/MethodReflector.php +++ b/packages/BetterReflection/src/Reflector/MethodReflector.php @@ -7,7 +7,6 @@ use phpDocumentor\Reflection\Types\Object_; use phpDocumentor\Reflection\Types\Self_; use phpDocumentor\Reflection\Types\Static_; use Roave\BetterReflection\Reflection\ReflectionMethod; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; use Throwable; final class MethodReflector @@ -24,12 +23,7 @@ final class MethodReflector public function reflectClassMethod(string $class, string $method): ?ReflectionMethod { - try { - $classReflection = $this->smartClassReflector->reflect($class); - } catch (IdentifierNotFound $identifierNotFoundException) { - return null; - } - + $classReflection = $this->smartClassReflector->reflect($class); if ($classReflection === null) { return null; } diff --git a/packages/BetterReflection/src/Reflector/PropertyReflector.php b/packages/BetterReflection/src/Reflector/PropertyReflector.php index d5014a2a9ad..71f088c7c4f 100644 --- a/packages/BetterReflection/src/Reflector/PropertyReflector.php +++ b/packages/BetterReflection/src/Reflector/PropertyReflector.php @@ -5,7 +5,6 @@ namespace Rector\BetterReflection\Reflector; use phpDocumentor\Reflection\Types\Array_; use phpDocumentor\Reflection\Types\Object_; use Roave\BetterReflection\Reflection\ReflectionProperty; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; final class PropertyReflector { @@ -26,12 +25,7 @@ final class PropertyReflector public function reflectClassProperty(string $class, string $method): ?ReflectionProperty { - try { - $classReflection = $this->smartClassReflector->reflect($class); - } catch (IdentifierNotFound $identifierNotFoundException) { - return null; - } - + $classReflection = $this->smartClassReflector->reflect($class); if ($classReflection === null) { return null; } diff --git a/packages/BetterReflection/src/Reflector/SmartClassReflector.php b/packages/BetterReflection/src/Reflector/SmartClassReflector.php index d8b633b70f1..df6a0f2b853 100644 --- a/packages/BetterReflection/src/Reflector/SmartClassReflector.php +++ b/packages/BetterReflection/src/Reflector/SmartClassReflector.php @@ -108,12 +108,7 @@ final class SmartClassReflector */ public function resolveClassInterfaces(ReflectionClass $reflectionClass): array { - try { - return array_keys($reflectionClass->getInterfaces()); - } catch (IdentifierNotFound $identifierNotFoundException) { - // @todo check if type is needed by any Rector - return []; - } + return array_keys($reflectionClass->getInterfaces()); } /** @@ -121,12 +116,7 @@ final class SmartClassReflector */ public function resolveClassParents(ReflectionClass $reflectionClass): array { - try { - return $reflectionClass->getParentClassNames(); - } catch (IdentifierNotFound $identifierNotFoundException) { - // @todo check if type is needed by any Rector - return []; - } + return $reflectionClass->getParentClassNames(); } /** diff --git a/packages/BetterReflection/src/SourceLocator/StubSourceLocator.php b/packages/BetterReflection/src/SourceLocator/StubSourceLocator.php index 9019e4ecc2d..854c870f8bb 100644 --- a/packages/BetterReflection/src/SourceLocator/StubSourceLocator.php +++ b/packages/BetterReflection/src/SourceLocator/StubSourceLocator.php @@ -6,7 +6,6 @@ use Rector\BetterReflection\Stubber\SourceStubber; use Roave\BetterReflection\Identifier\Identifier; use Roave\BetterReflection\Identifier\IdentifierType; use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; use Roave\BetterReflection\Reflector\Reflector; use Roave\BetterReflection\SourceLocator\Ast\Locator; use Roave\BetterReflection\SourceLocator\Located\LocatedSource; @@ -47,11 +46,7 @@ final class StubSourceLocator implements SourceLocator $locatedSource = new LocatedSource($stubFileInfo->getContents(), $stubFileInfo->getRealPath()); - try { - return $this->astLocator->findReflection($reflector, $locatedSource, $identifier); - } catch (IdentifierNotFound $identifierNotFoundException) { - return null; - } + return $this->astLocator->findReflection($reflector, $locatedSource, $identifier); } /**