-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Renaming] Add RenamedNameCollector to ensure remove uses on auto imp…
…ort on ClassRenamingPostRector with verify there is Node name that renamed (#5232)
- Loading branch information
1 parent
290f2a0
commit cb1b0c7
Showing
8 changed files
with
97 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...Rector/FixtureAutoImportNamesWithoutRemoveUnusedImport/skip_is_granted_annotation.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\FixtureAutoImportNamesWithoutRemoveUnusedImport; | ||
|
||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; | ||
|
||
/** | ||
* IsGranted annotation is not changed, as the real use case is to change to attribute first | ||
* | ||
* @see https://github.com/rectorphp/rector-src/blob/290f2a03d53d0b8da35beb973d724f95a77983cb/tests/Issues/AnnotationToAttributeRenameAutoImport/config/configured_rule.php#L13-L22 | ||
* @see https://github.com/rectorphp/rector-symfony/issues/535 | ||
* | ||
* @IsGranted | ||
*/ | ||
class SkipIsGrantedAnnotation | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Renaming\Collector; | ||
|
||
final class RenamedNameCollector | ||
{ | ||
/** | ||
* @var string[] | ||
*/ | ||
private array $names = []; | ||
|
||
public function add(string $name): void | ||
{ | ||
$this->names[] = $name; | ||
} | ||
|
||
public function has(string $name): bool | ||
{ | ||
return in_array($name, $this->names, true); | ||
} | ||
|
||
public function reset(): void | ||
{ | ||
$this->names = []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters