mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-21 16:02:23 +02:00
Compatibility with PHPStan 0.12.4
This commit is contained in:
parent
84e1e98a51
commit
b77fa521c3
@ -21,7 +21,7 @@
|
||||
"nikic/php-parser": "^4.3",
|
||||
"ondram/ci-detector": "^3.1",
|
||||
"phpstan/phpdoc-parser": "^0.4",
|
||||
"phpstan/phpstan": "0.12.3",
|
||||
"phpstan/phpstan": "^0.12.4",
|
||||
"phpstan/phpstan-phpunit": "^0.12",
|
||||
"sebastian/diff": "^3.0",
|
||||
"symfony/console": "^4.4|^5.0",
|
||||
|
@ -27,3 +27,6 @@ services:
|
||||
|
||||
PHPStan\Analyser\ScopeFactory:
|
||||
factory: ['@Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory', 'createScopeFactory']
|
||||
|
||||
PHPStan\DependencyInjection\Container:
|
||||
factory: ['@Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory', 'createContainer']
|
||||
|
@ -89,4 +89,9 @@ final class PHPStanServicesFactory
|
||||
{
|
||||
return $this->container->getByType(ScopeFactory::class);
|
||||
}
|
||||
|
||||
public function createContainer(): Container
|
||||
{
|
||||
return $this->container->getByType(Container::class);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,9 @@ use PHPStan\Analyser\ScopeContext;
|
||||
use PHPStan\Analyser\ScopeFactory as PHPStanScopeFactory;
|
||||
use PHPStan\Analyser\TypeSpecifier;
|
||||
use PHPStan\Broker\Broker;
|
||||
use PHPStan\DependencyInjection\Container;
|
||||
use PHPStan\DependencyInjection\Type\DynamicReturnTypeExtensionRegistryProvider;
|
||||
use PHPStan\DependencyInjection\Type\OperatorTypeSpecifyingExtensionRegistryProvider;
|
||||
use PHPStan\Rules\Properties\PropertyReflectionFinder;
|
||||
use Rector\PhpParser\Printer\BetterStandardPrinter;
|
||||
|
||||
@ -20,6 +23,11 @@ final class ScopeFactory
|
||||
*/
|
||||
private $broker;
|
||||
|
||||
/**
|
||||
* @var \PHPStan\DependencyInjection\Container
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @var TypeSpecifier
|
||||
*/
|
||||
@ -37,11 +45,13 @@ final class ScopeFactory
|
||||
|
||||
public function __construct(
|
||||
Broker $broker,
|
||||
Container $container,
|
||||
TypeSpecifier $typeSpecifier,
|
||||
PHPStanScopeFactory $phpStanScopeFactory,
|
||||
BetterStandardPrinter $betterStandardPrinter
|
||||
) {
|
||||
$this->broker = $broker;
|
||||
$this->container = $container;
|
||||
$this->typeSpecifier = $typeSpecifier;
|
||||
$this->phpStanScopeFactory = $phpStanScopeFactory;
|
||||
$this->betterStandardPrinter = $betterStandardPrinter;
|
||||
@ -52,6 +62,8 @@ final class ScopeFactory
|
||||
return new MutatingScope(
|
||||
$this->phpStanScopeFactory,
|
||||
$this->broker,
|
||||
$this->container->getByType(DynamicReturnTypeExtensionRegistryProvider::class)->getRegistry(),
|
||||
$this->container->getByType(OperatorTypeSpecifyingExtensionRegistryProvider::class)->getRegistry(),
|
||||
$this->betterStandardPrinter,
|
||||
$this->typeSpecifier,
|
||||
new PropertyReflectionFinder(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user