mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-25 04:03:55 +01:00
[BetterReflection] drop missing identifier fallback where not needed - towards autoloadble
This commit is contained in:
parent
8b7b422eb8
commit
4c43702608
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user