-
-
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.
[FileProcessor] Run untill the file is fixed completelly (#432)
* try file doule run * improve test fixtures by removed old class names * remove ValueObjectWrapArgRector, not very useful * [CodeQualityStrict] Remove VarInlineAnnotationToAssertRector, way too strict and unreliable * [CodeQualityStrict] Remove ParamTypeToAssertTypeRector, way too strict and better union types * improve DowngradeStripTagsCallWithArrayRector on downgrade * correct NormalizeNamespaceByPSR4ComposerAutoloadRector * decouple UndefinedVariableResolver * work in rogres on assign array * [PHP 7.1] Improve AssignArrayToStringRector to work with assign node directly
- Loading branch information
1 parent
4f2d2d1
commit 294bea2
Showing
99 changed files
with
865 additions
and
1,843 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
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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\NodeNestingScope; | ||
|
||
use PhpParser\Node; | ||
use Rector\NodeTypeResolver\Node\AttributeKey; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class ParentFinder | ||
{ | ||
/** | ||
* @template T of \PhpParser\Node | ||
* @param array<class-string<T>> $types | ||
* @return T|null | ||
*/ | ||
public function findByTypes(Node $node, array $types): ?Node | ||
{ | ||
Assert::allIsAOf($types, Node::class); | ||
|
||
$parent = $node->getAttribute(AttributeKey::PARENT_NODE); | ||
if (! $parent instanceof Node) { | ||
return null; | ||
} | ||
|
||
do { | ||
foreach ($types as $type) { | ||
if (is_a($parent, $type, true)) { | ||
return $parent; | ||
} | ||
} | ||
|
||
if ($parent === null) { | ||
return null; | ||
} | ||
} while ($parent = $parent->getAttribute(AttributeKey::PARENT_NODE)); | ||
|
||
return null; | ||
} | ||
} |
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
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
27 changes: 0 additions & 27 deletions
27
...s-tests/Arguments/Rector/MethodCall/ValueObjectWrapArgRector/Fixture/include_many.php.inc
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...sts/Arguments/Rector/MethodCall/ValueObjectWrapArgRector/Fixture/skip_already_new.php.inc
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
rules-tests/Arguments/Rector/MethodCall/ValueObjectWrapArgRector/Fixture/some_class.php.inc
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.