mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 02:36:52 +01:00
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace Rector\ReadWrite\ReadNodeAnalyzer;
|
||
|
|
||
|
use PhpParser\Node\Expr;
|
||
|
use PhpParser\Node\Stmt\Return_;
|
||
|
use Rector\Core\Exception\NotImplementedYetException;
|
||
|
use Rector\Core\NodeFinder\NodeUsageFinder;
|
||
|
use Rector\NodeNestingScope\ParentScopeFinder;
|
||
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||
|
|
||
|
abstract class AbstractReadNodeAnalyzer
|
||
|
{
|
||
|
/**
|
||
|
* @var ParentScopeFinder
|
||
|
*/
|
||
|
protected $parentScopeFinder;
|
||
|
|
||
|
/**
|
||
|
* @var NodeUsageFinder
|
||
|
*/
|
||
|
protected $nodeUsageFinder;
|
||
|
|
||
|
/**
|
||
|
* @required
|
||
|
*/
|
||
|
public function autowireAbstractReadNodeAnalyzer(
|
||
|
ParentScopeFinder $parentScopeFinder,
|
||
|
NodeUsageFinder $nodeUsageFinder
|
||
|
): void {
|
||
|
$this->parentScopeFinder = $parentScopeFinder;
|
||
|
$this->nodeUsageFinder = $nodeUsageFinder;
|
||
|
}
|
||
|
|
||
|
protected function isCurrentContextRead(Expr $expr): bool
|
||
|
{
|
||
|
$parent = $expr->getAttribute(AttributeKey::PARENT_NODE);
|
||
|
if ($parent instanceof Return_) {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
throw new NotImplementedYetException();
|
||
|
}
|
||
|
}
|