-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core] Apply CREATED_BY_RULE attribute as array collection of applied…
… Rector rule (#1600) * [Core] Apply CREATED_BY_RULE attribute as array collection of applied Rector rule * phpstan * early return * [ci-review] Rector Rectify * update comment * comment Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
311ffc6
commit 4399f28
Showing
7 changed files
with
66 additions
and
37 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
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Core\NodeDecorator; | ||
|
||
use PhpParser\Node; | ||
use Rector\NodeTypeResolver\Node\AttributeKey; | ||
|
||
final class CreatedByRuleDecorator | ||
{ | ||
public function decorate(Node $node, string $rectorClass): void | ||
{ | ||
$mergeCreatedByRule = array_merge($node->getAttribute(AttributeKey::CREATED_BY_RULE) ?? [], [$rectorClass]); | ||
$mergeCreatedByRule = array_unique($mergeCreatedByRule); | ||
|
||
$node->setAttribute(AttributeKey::CREATED_BY_RULE, $mergeCreatedByRule); | ||
} | ||
} |
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