mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-29 19:37:55 +01:00
Updated Rector to commit 8b1a181c243346b1c47c50f3e4513b117ebebc9d
8b1a181c24
[DeadCode] Skip implements interface __construct() on RemoveUnusedPromotedPropertyRector (#5669)
This commit is contained in:
parent
e8cdd78f11
commit
d148fa379c
@ -9,11 +9,13 @@ use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\TraitUse;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use Rector\DeadCode\NodeAnalyzer\PropertyWriteonlyAnalyzer;
|
||||
use Rector\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\PhpParser\NodeFinder\PropertyFetchFinder;
|
||||
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
|
||||
use Rector\Rector\AbstractScopeAwareRector;
|
||||
use Rector\Reflection\ReflectionResolver;
|
||||
use Rector\ValueObject\MethodName;
|
||||
use Rector\ValueObject\PhpVersionFeature;
|
||||
use Rector\ValueObject\Visibility;
|
||||
@ -45,12 +47,18 @@ final class RemoveUnusedPromotedPropertyRector extends AbstractScopeAwareRector
|
||||
* @var \Rector\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
public function __construct(PropertyFetchFinder $propertyFetchFinder, VisibilityManipulator $visibilityManipulator, PropertyWriteonlyAnalyzer $propertyWriteonlyAnalyzer, BetterNodeFinder $betterNodeFinder)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
public function __construct(PropertyFetchFinder $propertyFetchFinder, VisibilityManipulator $visibilityManipulator, PropertyWriteonlyAnalyzer $propertyWriteonlyAnalyzer, BetterNodeFinder $betterNodeFinder, ReflectionResolver $reflectionResolver)
|
||||
{
|
||||
$this->propertyFetchFinder = $propertyFetchFinder;
|
||||
$this->visibilityManipulator = $visibilityManipulator;
|
||||
$this->propertyWriteonlyAnalyzer = $propertyWriteonlyAnalyzer;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -151,6 +159,15 @@ CODE_SAMPLE
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
$classReflection = $this->reflectionResolver->resolveClassReflection($class);
|
||||
if ($classReflection instanceof ClassReflection) {
|
||||
$interfaces = $classReflection->getInterfaces();
|
||||
foreach ($interfaces as $interface) {
|
||||
if ($interface->hasNativeMethod(MethodName::CONSTRUCT)) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '04e62d38cd1f1a0e01d8efc19b19b384cd8726e6';
|
||||
public const PACKAGE_VERSION = '8b1a181c243346b1c47c50f3e4513b117ebebc9d';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-02-28 01:05:33';
|
||||
public const RELEASE_DATE = '2024-02-28 18:18:08';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user