forked from rectorphp/rector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rectorphp#847 from rectorphp/php73-regex-regression
[PHP 7.3] Add RegexDashEscapeRector
- Loading branch information
Showing
44 changed files
with
947 additions
and
408 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
38 changes: 38 additions & 0 deletions
38
packages/NodeTypeResolver/src/Application/ConstantNodeCollector.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,38 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Rector\NodeTypeResolver\Application; | ||
|
||
use PhpParser\Node\Stmt\ClassConst; | ||
use Rector\NodeTypeResolver\Node\Attribute; | ||
use Rector\PhpParser\Node\Resolver\NameResolver; | ||
|
||
final class ConstantNodeCollector | ||
{ | ||
/** | ||
* @var ClassConst[][] | ||
*/ | ||
private $constantsByType = []; | ||
|
||
/** | ||
* @var NameResolver | ||
*/ | ||
private $nameResolver; | ||
|
||
public function __construct(NameResolver $nameResolver) | ||
{ | ||
$this->nameResolver = $nameResolver; | ||
} | ||
|
||
public function addConstant(ClassConst $classConst): void | ||
{ | ||
$className = (string) $classConst->getAttribute(Attribute::CLASS_NAME); | ||
$constantName = $this->nameResolver->resolve($classConst); | ||
|
||
$this->constantsByType[$className][$constantName] = $classConst; | ||
} | ||
|
||
public function findConstant(string $constantName, string $className): ?ClassConst | ||
{ | ||
return $this->constantsByType[$className][$constantName] ?? 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
44 changes: 0 additions & 44 deletions
44
packages/NodeTypeResolver/src/NodeVisitor/ClassLikeNodeCollectorNodeVisitor.php
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
packages/NodeTypeResolver/src/NodeVisitor/FunctionLikeNodeCollectorNodeVisitor.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.