mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
README: add compiler pass + inspiration
This commit is contained in:
parent
e44a887f73
commit
b5a3333c5e
@ -188,8 +188,26 @@ foreach ($nodes as $node) {
|
||||
}
|
||||
```
|
||||
|
||||
3. Add CompilerPass to your Kernel
|
||||
|
||||
```php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Rector\NodeTypeResolver\DependencyInjection\CompilerPass\NodeTypeResolverCollectorCompilerPass;
|
||||
|
||||
class AppKernel extends Kernel
|
||||
{
|
||||
protected function build(ContainerBuilder $containerBuilder): void
|
||||
{
|
||||
$containerBuilder->addCompilerPass(new NodeTypeResolverCollectorCompilerPass());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
And that's it!
|
||||
|
||||
### Inspiration
|
||||
|
||||
@todo silverstripe
|
||||
- [PHPStanScopeVisitor](https://github.com/silverstripe/silverstripe-upgrader/blob/532182b23e854d02e0b27e68ebc394f436de0682/src/UpgradeRule/PHP/Visitor/PHPStanScopeVisitor.php) in [SilverStripe](https://github.com/silverstripe/) - Thank you ❤️️
|
||||
|
@ -25,7 +25,7 @@ final class ScopeFactory
|
||||
/**
|
||||
* @var PHPStanScopeFactory
|
||||
*/
|
||||
private $pHPStanScopeFactory;
|
||||
private $phpStanScopeFactory;
|
||||
|
||||
/**
|
||||
* @var BetterStandardPrinter
|
||||
@ -35,19 +35,19 @@ final class ScopeFactory
|
||||
public function __construct(
|
||||
Broker $broker,
|
||||
TypeSpecifier $typeSpecifier,
|
||||
PHPStanScopeFactory $pHPStanScopeFactory,
|
||||
PHPStanScopeFactory $phpStanScopeFactory,
|
||||
BetterStandardPrinter $betterStandardPrinter
|
||||
) {
|
||||
$this->broker = $broker;
|
||||
$this->typeSpecifier = $typeSpecifier;
|
||||
$this->pHPStanScopeFactory = $pHPStanScopeFactory;
|
||||
$this->phpStanScopeFactory = $phpStanScopeFactory;
|
||||
$this->betterStandardPrinter = $betterStandardPrinter;
|
||||
}
|
||||
|
||||
public function createFromFileInfo(SplFileInfo $splFileInfo): Scope
|
||||
{
|
||||
return new Scope(
|
||||
$this->pHPStanScopeFactory,
|
||||
$this->phpStanScopeFactory,
|
||||
$this->broker,
|
||||
$this->betterStandardPrinter,
|
||||
$this->typeSpecifier,
|
||||
|
Loading…
x
Reference in New Issue
Block a user