rector/packages/Caching/FileSystem/DependencyResolver.php
Abdul Malik Ikhsan fc10fce13d
[Rectify] [Php81] Enable Rectify on Readonly Property only (#1384)
* 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>
2021-12-04 15:32:52 +03:00

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);
}
}