mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-20 18:12:24 +00:00
[PHPStan 1.0] upgrade deprecated getNativeMethods() method (#1069)
This commit is contained in:
parent
ade120e97a
commit
fbeecb22d4
|
@ -13,6 +13,7 @@ use PhpParser\Node\Stmt\ClassMethod;
|
|||
use PhpParser\Node\Stmt\Function_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\MethodReflection;
|
||||
use PHPStan\Reflection\ParametersAcceptorSelector;
|
||||
use PHPStan\Reflection\Php\PhpPropertyReflection;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
|
@ -75,7 +76,9 @@ final class TypeProvidingExprFromClassResolver
|
|||
ClassReflection $classReflection,
|
||||
ObjectType $objectType
|
||||
): ?MethodCall {
|
||||
foreach ($classReflection->getNativeMethods() as $methodReflection) {
|
||||
$methodReflections = $this->getClassMethodReflections($classReflection);
|
||||
|
||||
foreach ($methodReflections as $methodReflection) {
|
||||
$functionVariant = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());
|
||||
$returnType = $functionVariant->getReturnType();
|
||||
|
||||
|
@ -142,4 +145,19 @@ final class TypeProvidingExprFromClassResolver
|
|||
|
||||
return $readableType->equals($objectType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MethodReflection[]
|
||||
*/
|
||||
private function getClassMethodReflections(ClassReflection $classReflection): array
|
||||
{
|
||||
$nativeClassReflection = $classReflection->getNativeReflection();
|
||||
$methodReflections = [];
|
||||
|
||||
foreach ($nativeClassReflection->getMethods() as $reflectionMethod) {
|
||||
$methodReflections[] = $classReflection->getNativeMethod($reflectionMethod->getName());
|
||||
}
|
||||
|
||||
return $methodReflections;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user