rector/packages/VendorLocker/VendorLockResolver.php
Tomas Votruba e66f43136c Updated Rector to commit dbc08237828ceaaeb22d92a440c9ada6e16b4d36
dbc0823782 Skip @method reported as real one by phpstan class reflection (#138)
2021-06-01 21:34:08 +00:00

48 lines
2.1 KiB
PHP

<?php
declare (strict_types=1);
namespace Rector\VendorLocker;
use PhpParser\Node;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Property;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodParamVendorLockResolver;
use Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver;
use Rector\VendorLocker\NodeVendorLocker\PropertyTypeVendorLockResolver;
final class VendorLockResolver
{
/**
* @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodParamVendorLockResolver
*/
private $classMethodParamVendorLockResolver;
/**
* @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver
*/
private $classMethodReturnVendorLockResolver;
/**
* @var \Rector\VendorLocker\NodeVendorLocker\PropertyTypeVendorLockResolver
*/
private $propertyTypeVendorLockResolver;
public function __construct(\Rector\VendorLocker\NodeVendorLocker\ClassMethodParamVendorLockResolver $classMethodParamVendorLockResolver, \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver $classMethodReturnVendorLockResolver, \Rector\VendorLocker\NodeVendorLocker\PropertyTypeVendorLockResolver $propertyTypeVendorLockResolver)
{
$this->classMethodParamVendorLockResolver = $classMethodParamVendorLockResolver;
$this->classMethodReturnVendorLockResolver = $classMethodReturnVendorLockResolver;
$this->propertyTypeVendorLockResolver = $propertyTypeVendorLockResolver;
}
public function isClassMethodParamLockedIn(\PhpParser\Node $node) : bool
{
if (!$node instanceof \PhpParser\Node\Stmt\ClassMethod) {
return \false;
}
return $this->classMethodParamVendorLockResolver->isVendorLocked($node);
}
public function isReturnChangeVendorLockedIn(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
{
return $this->classMethodReturnVendorLockResolver->isVendorLocked($classMethod);
}
public function isPropertyTypeChangeVendorLockedIn(\PhpParser\Node\Stmt\Property $property) : bool
{
return $this->propertyTypeVendorLockResolver->isVendorLocked($property);
}
}