-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f123356
commit 447abec
Showing
96 changed files
with
4,013 additions
and
77 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
11 changes: 11 additions & 0 deletions
11
config/sets/php-static-analysis-attributes-to-annotations.php
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,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use PhpStaticAnalysis\RectorRule\AttributesToAnnotationsRector; | ||
use Rector\Config\RectorConfig; | ||
|
||
return RectorConfig::configure() | ||
->withRules([ | ||
AttributesToAnnotationsRector::class | ||
]); |
29 changes: 29 additions & 0 deletions
29
patches/rector-rector-src-application-fileprocessor-php.patch
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,29 @@ | ||
--- /dev/null | ||
+++ ../src/Application/FileProcessor.php | ||
@@ -3,6 +3,7 @@ | ||
declare (strict_types=1); | ||
namespace Rector\Application; | ||
|
||
+use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; | ||
use RectorPrefix202412\Nette\Utils\FileSystem; | ||
use PHPStan\AnalysedCodeException; | ||
use PHPStan\Parser\ParserErrorsException; | ||
@@ -66,7 +67,9 @@ | ||
* @readonly | ||
*/ | ||
private NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator; | ||
- public function __construct(BetterStandardPrinter $betterStandardPrinter, RectorNodeTraverser $rectorNodeTraverser, SymfonyStyle $symfonyStyle, FileDiffFactory $fileDiffFactory, ChangedFilesDetector $changedFilesDetector, ErrorFactory $errorFactory, FilePathHelper $filePathHelper, PostFileProcessor $postFileProcessor, RectorParser $rectorParser, NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator) | ||
+ public function __construct(BetterStandardPrinter $betterStandardPrinter, RectorNodeTraverser $rectorNodeTraverser, SymfonyStyle $symfonyStyle, FileDiffFactory $fileDiffFactory, ChangedFilesDetector $changedFilesDetector, ErrorFactory $errorFactory, FilePathHelper $filePathHelper, PostFileProcessor $postFileProcessor, RectorParser $rectorParser, NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator, | ||
+ private PhpDocInfoFactory $phpDocInfoFactory | ||
+ ) | ||
{ | ||
$this->betterStandardPrinter = $betterStandardPrinter; | ||
$this->rectorNodeTraverser = $rectorNodeTraverser; | ||
@@ -90,6 +93,7 @@ | ||
$fileHasChanged = \false; | ||
$filePath = $file->getFilePath(); | ||
do { | ||
+ $this->phpDocInfoFactory->clearCache(); | ||
$file->changeHasChanged(\false); | ||
// 1. change nodes with Rector Rules | ||
$newStmts = $this->rectorNodeTraverser->traverse($file->getNewStmts()); |
13 changes: 13 additions & 0 deletions
13
patches/rector-rector-src-betterphpdocparser-phpdocinfo-phpdocinfofactory-php.patch
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,13 @@ | ||
--- /dev/null | ||
+++ ../src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php | ||
@@ -55,6 +55,10 @@ | ||
$this->annotationNaming = $annotationNaming; | ||
$this->phpDocNodeByTypeFinder = $phpDocNodeByTypeFinder; | ||
} | ||
+ public function clearCache(): void | ||
+ { | ||
+ $this->phpDocInfosByObjectId = []; | ||
+ } | ||
public function createFromNodeOrEmpty(Node $node) : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo | ||
{ | ||
// already added |
11 changes: 0 additions & 11 deletions
11
patches/rector-rector-src-nodetyperesolver-node-attributekey-php.patch
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
patches/rector-rector-src-phpparser-nodetraverser-rectornodetraverser-php.patch
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,35 @@ | ||
--- /dev/null | ||
+++ ../src/PhpParser/NodeTraverser/RectorNodeTraverser.php | ||
@@ -7,6 +7,8 @@ | ||
use PhpParser\Node\Stmt; | ||
use PhpParser\NodeTraverser; | ||
use PhpParser\NodeVisitor; | ||
+use PhpStaticAnalysis\RectorRule\AnnotationsToAttributesRector; | ||
+use PhpStaticAnalysis\RectorRule\AttributesToAnnotationsRector; | ||
use Rector\Configuration\ConfigurationRuleFilter; | ||
use Rector\Contract\Rector\RectorInterface; | ||
use Rector\VersionBonding\PhpVersionedFilter; | ||
@@ -97,6 +99,23 @@ | ||
$this->visitors = $this->phpVersionedFilter->filter($this->rectors); | ||
// filter by configuration | ||
$this->visitors = $this->configurationRuleFilter->filter($this->visitors); | ||
+ | ||
+ $first = []; | ||
+ $middle = []; | ||
+ $last = []; | ||
+ | ||
+ foreach ($this->visitors as $visitor) { | ||
+ if ($visitor instanceof AttributesToAnnotationsRector) { | ||
+ $first[] = $visitor; | ||
+ } elseif ($visitor instanceof AnnotationsToAttributesRector) { | ||
+ $last[] = $visitor; | ||
+ } else { | ||
+ $middle[] = $visitor; | ||
+ } | ||
+ } | ||
+ | ||
+ $this->visitors = array_merge($first, $middle, $last); | ||
+ | ||
$this->areNodeVisitorsPrepared = \true; | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
patches/rector-rector-src-phpparser-printer-betterstandardprinter-php.patch
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.