diff --git a/packages/Symfony/tests/Rector/Form/OptionNameRector/OptionNameRectorTest.php b/packages/Symfony/tests/Rector/Form/OptionNameRector/OptionNameRectorTest.php index a4368010b75..40943f22571 100644 --- a/packages/Symfony/tests/Rector/Form/OptionNameRector/OptionNameRectorTest.php +++ b/packages/Symfony/tests/Rector/Form/OptionNameRector/OptionNameRectorTest.php @@ -23,6 +23,8 @@ final class OptionNameRectorTest extends AbstractRectorTestCase */ protected function getRectorConfiguration(): array { - return [FormBuilder::class]; + return [ + '$formBuilderType' => FormBuilder::class + ]; } } diff --git a/src/DependencyInjection/Loader/RectorServiceParametersShifter.php b/src/DependencyInjection/Loader/RectorServiceParametersShifter.php index 8c7a7fd93c0..92ff9d39756 100644 --- a/src/DependencyInjection/Loader/RectorServiceParametersShifter.php +++ b/src/DependencyInjection/Loader/RectorServiceParametersShifter.php @@ -3,8 +3,10 @@ namespace Rector\DependencyInjection\Loader; use Nette\Utils\Strings; +use Rector\Exception\Configuration\InvalidConfigurationException; use ReflectionClass; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\Yaml\Yaml; /** * Before: @@ -74,7 +76,12 @@ final class RectorServiceParametersShifter // we can autowire exclusively 1 parameter only if (count($arrayParameterNames) !== 1) { - continue; + throw new InvalidConfigurationException(sprintf( + 'There must be array argument in "%s" constructor or explicit $argument name in configuration:%s%s', + $serviceName, + PHP_EOL . PHP_EOL, + Yaml::dump($serviceDefinition, Yaml::DUMP_OBJECT_AS_MAP) + )); } $serviceDefinition['arguments']['$' . $arrayParameterNames[0]] = $nonReservedNonVariables; diff --git a/src/DependencyInjection/RectorKernel.php b/src/DependencyInjection/RectorKernel.php index b8bf4d14036..d8308bd4500 100644 --- a/src/DependencyInjection/RectorKernel.php +++ b/src/DependencyInjection/RectorKernel.php @@ -2,11 +2,9 @@ namespace Rector\DependencyInjection; -use Rector\Contract\Rector\PhpRectorInterface; use Rector\Contract\Rector\RectorInterface; use Rector\DependencyInjection\CompilerPass\RemoveExcludedRectorsCompilerPass; use Rector\DependencyInjection\Loader\TolerantRectorYamlFileLoader; -use Rector\FileSystemRector\Contract\FileSystemRectorInterface; use Symfony\Component\Config\Loader\DelegatingLoader; use Symfony\Component\Config\Loader\GlobFileLoader; use Symfony\Component\Config\Loader\LoaderInterface; diff --git a/src/Rector/Architecture/Factory/NewObjectToFactoryCreateRector.php b/src/Rector/Architecture/Factory/NewObjectToFactoryCreateRector.php index f30ec672d19..26818f5bf75 100644 --- a/src/Rector/Architecture/Factory/NewObjectToFactoryCreateRector.php +++ b/src/Rector/Architecture/Factory/NewObjectToFactoryCreateRector.php @@ -28,9 +28,6 @@ final class NewObjectToFactoryCreateRector extends AbstractRector */ public function __construct(array $objectToFactoryMethod) { - dump($objectToFactoryMethod); - die; - $this->objectToFactoryMethod = $objectToFactoryMethod; } @@ -65,7 +62,7 @@ CODE_SAMPLE 'MyClass' => [ 'class' => 'MyClassFactory', 'method' => 'create', - ] + ], ] ), ]); diff --git a/tests/Rector/Architecture/Factory/NewObjectToFactoryCreateRector/NewObjectToFactoryCreateRectorTest.php b/tests/Rector/Architecture/Factory/NewObjectToFactoryCreateRector/NewObjectToFactoryCreateRectorTest.php index cd0db64b4a0..9de56b3d98f 100644 --- a/tests/Rector/Architecture/Factory/NewObjectToFactoryCreateRector/NewObjectToFactoryCreateRectorTest.php +++ b/tests/Rector/Architecture/Factory/NewObjectToFactoryCreateRector/NewObjectToFactoryCreateRectorTest.php @@ -28,7 +28,7 @@ final class NewObjectToFactoryCreateRectorTest extends AbstractRectorTestCase MyClass::class => [ 'class' => MyClassFactory::class, 'method' => 'create', - ] + ], ]; } }