-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Parallel] Fix missing process RemovedAndAddedFilesProcessor->run() on parallel process on WorkerRunner #3218
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5c037ec
e2e: Turn absolute paths into relative ones
jtojnar f0a0bb2
e2e: Add test for https://github.com/rectorphp/rector/issues/7231
jtojnar c8b0611
[Parallel] Fix missing process RemovedAndAddedFilesProcessor->run() o…
samsonasik 53caa84
use expected output on CI
samsonasik 5084f1d
Final touch: move after do while loop
samsonasik 2431a59
move to worker runner
samsonasik bc75b83
remove run at PhpFileProcessor
samsonasik 19f5442
[ci-review] Rector Rectify
actions-user b0d9731
use FileProcessorInterface to apply all FileProcessor classes
samsonasik File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor |
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,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Maintenance; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\Node\Stmt\Function_; | ||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector; | ||
use Rector\Core\Rector\AbstractRector; | ||
use Rector\FileSystemRector\ValueObject\AddedFileWithContent; | ||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; | ||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; | ||
|
||
final class TestRector extends AbstractRector | ||
{ | ||
private RemovedAndAddedFilesCollector $removedAndAddedFilesCollector; | ||
|
||
public function __construct( | ||
RemovedAndAddedFilesCollector $removedAndAddedFilesCollector, | ||
) { | ||
$this->removedAndAddedFilesCollector = $removedAndAddedFilesCollector; | ||
} | ||
|
||
public function getRuleDefinition(): RuleDefinition | ||
{ | ||
return new RuleDefinition( | ||
'Test adding file.', | ||
[ | ||
new CodeSample( | ||
<<<'CODE_SAMPLE' | ||
function test() {} | ||
CODE_SAMPLE, | ||
<<<'CODE_SAMPLE' | ||
function test() {} | ||
/* file named “test” is added */ | ||
CODE_SAMPLE | ||
), | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* @return array<class-string<Node>> | ||
*/ | ||
public function getNodeTypes(): array | ||
{ | ||
return [Function_::class]; | ||
} | ||
|
||
/** | ||
* @param Function_ $node | ||
*/ | ||
public function refactor(Node $node): ?Node | ||
{ | ||
// Create a fixture. | ||
$this->removedAndAddedFilesCollector->addAddedFile( | ||
new AddedFileWithContent( | ||
__DIR__ . '/test', | ||
'test' | ||
) | ||
); | ||
|
||
return $new; | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"require": { | ||
"php": "^8.1" | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Maintenance\\": "." | ||
} | ||
} | ||
} |
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,7 @@ | ||
! [NOTE] File | ||
! "./removed-and-added-files-c | ||
! ollector/test" will be added | ||
|
||
|
||
|
||
[OK] Rector is done! | ||
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,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Maintenance\TestRector; | ||
|
||
require_once __DIR__ . '/TestRector.php'; | ||
|
||
return static function (Rector\Config\RectorConfig $rectorConfig): void { | ||
$rectorConfig->rule(TestRector::class); | ||
$rectorConfig->paths([ | ||
__DIR__ . '/src', | ||
]); | ||
}; |
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,4 @@ | ||
<?php | ||
|
||
function test() { | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
[OK] Rector is done!
printed message should actually not exists with run with parallel along with:as it is running with
--dry-run
, but probably need in separate PRs for improvement 👍 :)