[SymfonyExtra] add test to GetterToPropertyRector

This commit is contained in:
TomasVotruba 2017-09-02 15:29:43 +02:00
parent ffa4d0c6ef
commit e4ef19b2d1
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<?php declare (strict_types=1);
class ClassWithNamedService implements ContainerAwareInterface
{
/**
* @var stdClass
*/
private $stdClass;
public function __construct(stdClass $stdClass)
{
$this->stdClass = $stdClass;
}
public function render()
{
$this->renderTwig([
'posts' => $this->stdClass->callMe()
]);
}
}

View File

@ -23,6 +23,11 @@ final class Test extends AbstractRectorTestCase
__DIR__ . '/Wrong/wrong3.php.inc',
__DIR__ . '/Correct/correct3.php.inc'
);
$this->doTestFileMatchesExpectedContent(
__DIR__ . '/Wrong/wrong4.php.inc',
__DIR__ . '/Correct/correct4.php.inc'
);
}
/**

View File

@ -0,0 +1,11 @@
<?php declare (strict_types=1);
class ClassWithNamedService implements ContainerAwareInterface
{
public function render()
{
$this->renderTwig([
'posts' => $this->get('some_service')->callMe()
]);
}
}