mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit d7710f8758ef1a893424e3ab395c3f74c435d91c
d7710f8758
[DeadCode] Remove AstResolver usage on RecastingRemovalRector (#5109)
This commit is contained in:
parent
3c946b60af
commit
e7e6907996
|
@ -15,7 +15,6 @@ use PhpParser\Node\Expr\Cast\String_;
|
|||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Reflection\Php\PhpPropertyReflection;
|
||||
use PHPStan\Type\ArrayType;
|
||||
use PHPStan\Type\BooleanType;
|
||||
|
@ -28,7 +27,6 @@ use PHPStan\Type\Type;
|
|||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\NodeAnalyzer\ExprAnalyzer;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -53,21 +51,15 @@ final class RecastingRemovalRector extends AbstractRector
|
|||
* @var \Rector\Core\NodeAnalyzer\ExprAnalyzer
|
||||
*/
|
||||
private $exprAnalyzer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
/**
|
||||
* @var array<class-string<Node>, class-string<Type>>
|
||||
*/
|
||||
private const CAST_CLASS_TO_NODE_TYPE = [String_::class => StringType::class, Bool_::class => BooleanType::class, Array_::class => ArrayType::class, Int_::class => IntegerType::class, Object_::class => ObjectType::class, Double::class => FloatType::class];
|
||||
public function __construct(PropertyFetchAnalyzer $propertyFetchAnalyzer, ReflectionResolver $reflectionResolver, ExprAnalyzer $exprAnalyzer, AstResolver $astResolver)
|
||||
public function __construct(PropertyFetchAnalyzer $propertyFetchAnalyzer, ReflectionResolver $reflectionResolver, ExprAnalyzer $exprAnalyzer)
|
||||
{
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->exprAnalyzer = $exprAnalyzer;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
|
@ -124,11 +116,8 @@ CODE_SAMPLE
|
|||
if (!$expr instanceof MethodCall && !$expr instanceof StaticCall) {
|
||||
return \false;
|
||||
}
|
||||
$classMethod = $this->astResolver->resolveClassMethodFromCall($expr);
|
||||
if (!$classMethod instanceof ClassMethod) {
|
||||
return \false;
|
||||
}
|
||||
return !$classMethod->returnType instanceof Node;
|
||||
$type = $this->nodeTypeResolver->getNativeType($expr);
|
||||
return $type instanceof MixedType && !$type->isExplicitMixed();
|
||||
}
|
||||
private function shouldSkip(Expr $expr) : bool
|
||||
{
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '6a89b43080ca6f349322af160b15bf0814d40cb6';
|
||||
public const PACKAGE_VERSION = 'd7710f8758ef1a893424e3ab395c3f74c435d91c';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-10-03 06:25:09';
|
||||
public const RELEASE_DATE = '2023-10-03 09:39:49';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue