mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 04:19:44 +01:00
add AutowireDefaultCompilerPass
This commit is contained in:
parent
e20d8692ca
commit
58d8775221
@ -1,28 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\YamlRector\DependencyInjection\CompilerPass;
|
||||
|
||||
use Rector\YamlRector\Contract\YamlRectorInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @todo use AutowireDefaultCompilerPass instead
|
||||
*/
|
||||
final class AutowireYamlRectorCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $containerBuilder): void
|
||||
{
|
||||
foreach ($containerBuilder->getDefinitions() as $definition) {
|
||||
if ($definition->getClass() === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! is_a($definition->getClass(), YamlRectorInterface::class, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$definition->setAutowired(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,11 +2,10 @@
|
||||
|
||||
namespace Rector\DependencyInjection\CompilerPass;
|
||||
|
||||
use Rector\Contract\Rector\RectorInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
final class AutowireRectorCompilerPass implements CompilerPassInterface
|
||||
final class AutowireDefaultCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $containerBuilder): void
|
||||
{
|
||||
@ -15,10 +14,6 @@ final class AutowireRectorCompilerPass implements CompilerPassInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! is_a($definition->getClass(), RectorInterface::class, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$definition->setAutowired(true);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
namespace Rector\DependencyInjection;
|
||||
|
||||
use Rector\DependencyInjection\CompilerPass\AutoBindParametersCompilerPass;
|
||||
use Rector\DependencyInjection\CompilerPass\AutowireDefaultCompilerPass;
|
||||
use Rector\DependencyInjection\CompilerPass\AutowireRectorCompilerPass;
|
||||
use Rector\DependencyInjection\CompilerPass\CollectorCompilerPass;
|
||||
use Rector\NodeTypeResolver\DependencyInjection\CompilerPass\NodeTypeResolverCollectorCompilerPass;
|
||||
@ -64,8 +65,7 @@ final class RectorKernel extends Kernel
|
||||
{
|
||||
$containerBuilder->addCompilerPass(new CollectorCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new YamlRectorCollectorCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new AutowireRectorCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new AutowireYamlRectorCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new AutowireDefaultCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new NodeTypeResolverCollectorCompilerPass());
|
||||
$containerBuilder->addCompilerPass(new AutowireSinglyImplementedCompilerPass());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user