-
-
Notifications
You must be signed in to change notification settings - Fork 440
[e2e] $rectorConfig->skip() should not skip inside different path over config #4882
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| { | ||
| "require": { | ||
| "php": "^8.1" | ||
| }, | ||
| "minimum-stability": "dev", | ||
| "prefer-stable": true | ||
| } |
This file contains hidden or 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,21 @@ | ||
| 1 file with changes | ||
| =================== | ||
|
|
||
| 1) src/models/DeadConstructor.php:3 | ||
|
|
||
| ---------- begin diff ---------- | ||
| @@ @@ | ||
|
|
||
| final class DeadConstructor | ||
| { | ||
| - public function __construct() | ||
| - { | ||
| - } | ||
| } | ||
| ----------- end diff ----------- | ||
|
|
||
| Applied rules: | ||
| * RemoveEmptyClassMethodRector | ||
|
|
||
|
|
||
| [OK] 1 file would have changed (dry-run) by Rector |
This file contains hidden or 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,20 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| use Rector\Config\RectorConfig; | ||
| use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector; | ||
|
|
||
| return static function (RectorConfig $rectorConfig): void { | ||
| $rectorConfig->paths([ | ||
| __DIR__ . '/src', | ||
| ]); | ||
|
|
||
| $rectorConfig->skip([ | ||
| RemoveEmptyClassMethodRector::class => [ | ||
| __DIR__ . '/src/controllers', | ||
| ], | ||
| ]); | ||
|
|
||
| $rectorConfig->rule(RemoveEmptyClassMethodRector::class); | ||
| }; |
10 changes: 10 additions & 0 deletions
10
e2e/different-path-over-skip-config/src/controllers/DeadConstructor.php
This file contains hidden or 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 @@ | ||
| <?php | ||
|
|
||
| namespace controllers; | ||
|
|
||
| final class DeadConstructor | ||
| { | ||
| public function __construct() | ||
| { | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
e2e/different-path-over-skip-config/src/models/DeadConstructor.php
This file contains hidden or 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 @@ | ||
| <?php | ||
|
|
||
| namespace model; | ||
|
|
||
| final class DeadConstructor | ||
| { | ||
| public function __construct() | ||
| { | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -729,9 +729,12 @@ static function ( | |
| } | ||
|
|
||
| $skippedClassResolver = new SkippedClassResolver(); | ||
| $skippedClasses = array_keys($skippedClassResolver->resolve()); | ||
| foreach ($skippedClasses as $skippedClass) { | ||
| ContainerMemento::forgetService($container, $skippedClass); | ||
| $skippedElements = $skippedClassResolver->resolve(); | ||
| foreach ($skippedElements as $skippedClass => $path) { | ||
| // completely forget the Rector rule only when no path specified | ||
| if ($path === null) { | ||
| ContainerMemento::forgetService($container, $skippedClass); | ||
| } | ||
| } | ||
|
|
||
| $hasForgotten = true; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this flag still correct then?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems used on line 727 to run once on phpunit |
||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
could you give me an idea why we need to drop classes from the container when rules are skipped?
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 @TomasVotruba blog post may be the reason https://tomasvotruba.com/blog/removing-service-from-laravel-container-is-not-that-easy