mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-03 18:00:50 +00:00
[Core] Refactor RectifiedAnalyzer: no longer need check PhpDocInfo->hasChanged() (#1545)
* [Core] Refactor RectifiedAnalyzer: no longer need check PhpDocInfo->hasChanged() * comment update
This commit is contained in:
parent
6861ae9a4f
commit
3f80cd0543
|
@ -7,7 +7,6 @@ namespace Rector\Core\ProcessAnalyzer;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
use Rector\Core\ValueObject\RectifiedNode;
|
||||
|
@ -17,10 +16,9 @@ use Rector\Core\ValueObject\RectifiedNode;
|
|||
*
|
||||
* Same Rector Rule <-> Same Node <-> Same File
|
||||
*
|
||||
* Some limitations:
|
||||
* Limitation:
|
||||
*
|
||||
* - only check against Node which not Assign or Class_
|
||||
* - The checked node doesn't has PhpDocInfo changed.
|
||||
* It only check against Node which not Assign or Class_
|
||||
*
|
||||
* which possibly changed by other process.
|
||||
*/
|
||||
|
@ -36,22 +34,12 @@ final class RectifiedAnalyzer
|
|||
*/
|
||||
private array $previousFileWithNodes = [];
|
||||
|
||||
public function __construct(
|
||||
private readonly PhpDocInfoFactory $phpDocInfoFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function verify(RectorInterface $rector, Node $node, File $currentFile): ?RectifiedNode
|
||||
{
|
||||
if (in_array($node::class, self::EXCLUDE_NODES, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
if ($phpDocInfo->hasChanged()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$smartFileInfo = $currentFile->getSmartFileInfo();
|
||||
$realPath = $smartFileInfo->getRealPath();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user