mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-13 22:52:23 +00:00
* re-enable rectify and ecs * [Rectify] [Php81] Enable Rectify on Readonly Property only * comment * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify Co-authored-by: GitHub Action <action@github.com>
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Rector\Caching\FileSystem;
|
|
|
|
use PhpParser\Node;
|
|
use PHPStan\Analyser\MutatingScope;
|
|
use PHPStan\Analyser\NodeScopeResolver;
|
|
use PHPStan\Dependency\DependencyResolver as PHPStanDependencyResolver;
|
|
use Symplify\PackageBuilder\Reflection\PrivatesAccessor;
|
|
|
|
final class DependencyResolver
|
|
{
|
|
public function __construct(
|
|
private readonly NodeScopeResolver $nodeScopeResolver,
|
|
private readonly PHPStanDependencyResolver $phpStanDependencyResolver,
|
|
private readonly PrivatesAccessor $privatesAccessor
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @return string[]
|
|
*/
|
|
public function resolveDependencies(Node $node, MutatingScope $mutatingScope): array
|
|
{
|
|
$analysedFileAbsolutesPaths = $this->privatesAccessor->getPrivateProperty(
|
|
$this->nodeScopeResolver,
|
|
'analysedFiles'
|
|
);
|
|
|
|
$nodeDependencies = $this->phpStanDependencyResolver->resolveDependencies($node, $mutatingScope);
|
|
return $nodeDependencies->getFileDependencies($mutatingScope->getFile(), $analysedFileAbsolutesPaths);
|
|
}
|
|
}
|