mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-08 17:10:54 +01:00
bdc1df40d9
1cc465b4d5
[CodingStyle] Skip RemoveUnusedAliasRector when same class in use statement exists, but not used (#732)
31 lines
922 B
PHP
31 lines
922 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Naming\RenameGuard;
|
|
|
|
use Rector\Naming\Contract\Guard\ConflictingNameGuardInterface;
|
|
use Rector\Naming\Contract\RenameValueObjectInterface;
|
|
final class PropertyRenameGuard
|
|
{
|
|
/**
|
|
* @var \Rector\Naming\Contract\Guard\ConflictingNameGuardInterface[]
|
|
*/
|
|
private $conflictingNameGuards;
|
|
/**
|
|
* @param ConflictingNameGuardInterface[] $conflictingNameGuards
|
|
*/
|
|
public function __construct(array $conflictingNameGuards)
|
|
{
|
|
$this->conflictingNameGuards = $conflictingNameGuards;
|
|
}
|
|
public function shouldSkip(\Rector\Naming\Contract\RenameValueObjectInterface $renameValueObject) : bool
|
|
{
|
|
foreach ($this->conflictingNameGuards as $conflictingNameGuard) {
|
|
if ($conflictingNameGuard->isConflicting($renameValueObject)) {
|
|
return \true;
|
|
}
|
|
}
|
|
return \false;
|
|
}
|
|
}
|