[Core] Decorate all below nodes only on usage of DONT_TRAVERSE_CHILDREN or DONT_TRAVERSE_CURRENT_AND_CHILDREN#4191
Closed
samsonasik wants to merge 18 commits intomainfrom
Closed
[Core] Decorate all below nodes only on usage of DONT_TRAVERSE_CHILDREN or DONT_TRAVERSE_CURRENT_AND_CHILDREN#4191samsonasik wants to merge 18 commits intomainfrom
samsonasik wants to merge 18 commits intomainfrom
Conversation
…EN or DONT_TRAVERSE_CURRENT_AND_CHILDREN
3fb5961 to
aea06c8
Compare
Member
Author
|
All checks have passed 🎉 @TomasVotruba it is ready for review. |
Member
Author
|
It seems will buggy on target node already changed by other rule, I willa dd failing test case. |
Member
Author
Member
Author
|
Add new add skipped_by_rector_rule attribute seems the solution. |
Member
Author
|
It seems not working if node just reprinted: It got: 1) Rector\Core\Tests\Issues\StringClassNameConstantDefaultValue\StringClassNameConstantDefaultValueTest::test with data set #0
Failed on fixture file "in_array_constant_with_undefined_variable.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
final class InArrayConstantWithUndefinedVariable
{
const SKIP_TYPES = [
- 'Rector\Config\RectorConfig'
+ \Rector\Config\RectorConfig::class
]; |
Member
Author
Member
Author
|
It seems traversing can't scan a node that doesn't have origNode attribute via reprint: $node->setAttribute(AttributeKey::ORIGINAL_NODE, null);so it doesn't have the information, that's why it still apply the changes if below node is reprinted. |
Member
Author
|
closing for now as too many conflict and requires rework |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Instead of using
STOP_TRAVERSALor custom attribute, theDONT_TRAVERSE_CHILDRENorDONT_TRAVERSE_CURRENT_AND_CHILDRENwith decorate all nodes below it.This only filter only types that:
Ref rectorphp/rector#7983 (comment)
If it accepted, I will apply on other rules.