-
-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Traverse phpdoc with use of PhpDocNodeVisitor (#6045)
* make use of new simple-php-doc-parser * add ParamPhpDocNodeVisitor * remove uneeded contracts * skip bool instanceof * [ci-review] Rector Rectify * [ci-review] Rector Rectify Co-authored-by: kaizen-ci <info@kaizen-ci.org>
- Loading branch information
1 parent
0067855
commit 31566dc
Showing
66 changed files
with
1,147 additions
and
946 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
31 changes: 0 additions & 31 deletions
31
packages/BetterPhpDocParser/Attributes/Attribute/Attribute.php
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
packages/BetterPhpDocParser/Attributes/AttributeMirrorer.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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\BetterPhpDocParser\Attributes; | ||
|
||
use PHPStan\PhpDocParser\Ast\Node; | ||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey; | ||
|
||
final class AttributeMirrorer | ||
{ | ||
/** | ||
* @var string[] | ||
*/ | ||
private const ATTRIBUTES_TO_MIRROR = [ | ||
PhpDocAttributeKey::PARENT, | ||
PhpDocAttributeKey::START_AND_END, | ||
PhpDocAttributeKey::ORIG_NODE, | ||
]; | ||
|
||
public function mirror(Node $oldNode, Node $newNode): void | ||
{ | ||
foreach (self::ATTRIBUTES_TO_MIRROR as $attributeToMirror) { | ||
if (! $oldNode->hasAttribute($attributeToMirror)) { | ||
continue; | ||
} | ||
|
||
$attributeValue = $oldNode->getAttribute($attributeToMirror); | ||
$newNode->setAttribute($attributeToMirror, $attributeValue); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/BetterPhpDocParser/Contract/BasePhpDocNodeVisitorInterface.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); | ||
|
||
namespace Rector\BetterPhpDocParser\Contract; | ||
|
||
use Symplify\SimplePhpDocParser\Contract\PhpDocNodeVisitorInterface; | ||
|
||
interface BasePhpDocNodeVisitorInterface extends PhpDocNodeVisitorInterface | ||
{ | ||
} |
12 changes: 0 additions & 12 deletions
12
packages/BetterPhpDocParser/Contract/PhpDocNode/ClassNameAwareTagInterface.php
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
packages/BetterPhpDocParser/Contract/PhpDocNode/ShortNameAwareTagInterface.php
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/BetterPhpDocParser/Contract/PhpDocNode/SilentKeyNodeInterface.php
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/BetterPhpDocParser/Contract/PhpDocNode/TagAwareNodeInterface.php
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
packages/BetterPhpDocParser/DataProvider/CurrentTokenIteratorProvider.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,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\BetterPhpDocParser\DataProvider; | ||
|
||
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator; | ||
|
||
final class CurrentTokenIteratorProvider | ||
{ | ||
/** | ||
* @var BetterTokenIterator | ||
*/ | ||
private $betterTokenIterator; | ||
|
||
public function setBetterTokenIterator(BetterTokenIterator $betterTokenIterator): void | ||
{ | ||
$this->betterTokenIterator = $betterTokenIterator; | ||
} | ||
|
||
public function provide(): BetterTokenIterator | ||
{ | ||
return $this->betterTokenIterator; | ||
} | ||
} |
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
Oops, something went wrong.