diff --git a/src/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector.php b/src/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector.php index cad144bae7b..f97f0404bed 100644 --- a/src/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector.php +++ b/src/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector.php @@ -33,7 +33,7 @@ final class GetParameterToConstructorInjectionRector extends AbstractRector */ private $getParameterAwareTypes = [ 'Symfony\Bundle\FrameworkBundle\Controller\Controller', - 'Symfony\Component\DependencyInjection\ContainerAwareInterface' + 'Symfony\Component\DependencyInjection\ContainerAwareInterface', ]; /** diff --git a/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Correct/correct2.php.inc b/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Correct/correct2.php.inc index 853791d964a..3ba069734b4 100644 --- a/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Correct/correct2.php.inc +++ b/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Correct/correct2.php.inc @@ -2,7 +2,9 @@ namespace SomeNamespace; -class ClassWithNamedService3 implements ContainerAwareInterface +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +class ClassWithNamedService3 extends Controller { /** * @var string @@ -14,9 +16,7 @@ class ClassWithNamedService3 implements ContainerAwareInterface } public function render() { - $this->renderTwig([ - 'value' => $this->someParameter - ]); + $value = $this->someParameter; $query = new DoctrineQuery(); $queryId = $query->getParameter('id'); diff --git a/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/GetParameterToConstructorInjectionRectorTest.php b/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/GetParameterToConstructorInjectionRectorTest.php index 2a9cb2c9331..04432fc3254 100644 --- a/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/GetParameterToConstructorInjectionRectorTest.php +++ b/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/GetParameterToConstructorInjectionRectorTest.php @@ -24,7 +24,7 @@ final class GetParameterToConstructorInjectionRectorTest extends AbstractRectorT { return [ [__DIR__ . '/Wrong/wrong.php.inc', __DIR__ . '/Correct/correct.php.inc'], -// [__DIR__ . '/Wrong/wrong2.php.inc', __DIR__ . '/Correct/correct2.php.inc'], + [__DIR__ . '/Wrong/wrong2.php.inc', __DIR__ . '/Correct/correct2.php.inc'], ]; } diff --git a/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Wrong/wrong2.php.inc b/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Wrong/wrong2.php.inc index c8c14bb2f32..1012c1057fc 100644 --- a/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Wrong/wrong2.php.inc +++ b/tests/Rector/Contrib/Symfony/HttpKernel/GetParameterToConstructorInjectionRector/Wrong/wrong2.php.inc @@ -2,13 +2,13 @@ namespace SomeNamespace; -class ClassWithNamedService3 implements ContainerAwareInterface +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +class ClassWithNamedService3 extends Controller { public function render() { - $this->renderTwig([ - 'value' => $this->container->getParameter('some_parameter') - ]); + $value = $this->getParameter('some_parameter'); $query = new DoctrineQuery(); $queryId = $query->getParameter('id');