mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-05 19:00:49 +00:00
NamedServicesReconstructor - add test for double use of one service
This commit is contained in:
parent
885a4e4f03
commit
4fe18bacab
|
@ -9,15 +9,10 @@ final class Test extends AbstractReconstructorTestCase
|
|||
{
|
||||
public function test(): void
|
||||
{
|
||||
$this->doTestFileMatchesExpectedContent(
|
||||
__DIR__ . '/wrong/wrong.php.inc',
|
||||
__DIR__ . '/correct/correct.php.inc'
|
||||
);
|
||||
|
||||
$this->doTestFileMatchesExpectedContent(
|
||||
__DIR__ . '/wrong/wrong2.php.inc',
|
||||
__DIR__ . '/correct/correct2.php.inc'
|
||||
$this->doTestFileMatchesExpectedContent(__DIR__ . '/wrong/wrong.php.inc', __DIR__ . '/correct/correct.php.inc');
|
||||
$this->doTestFileMatchesExpectedContent(__DIR__ . '/wrong/wrong2.php.inc', __DIR__ . '/correct/correct2.php.inc'
|
||||
);
|
||||
$this->doTestFileMatchesExpectedContent(__DIR__ . '/wrong/wrong3.php.inc', __DIR__ . '/correct/correct3.php.inc');
|
||||
}
|
||||
|
||||
protected function getReconstructorClass(): string
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php declare (strict_types=1);
|
||||
class ClassWitNamedService implements ContainerAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var stdClass
|
||||
*/
|
||||
private $stdClass;
|
||||
public function __construct(stdClass $stdClass)
|
||||
{
|
||||
$this->stdClass = $stdClass;
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$someService = $this->stdClass;
|
||||
$someResult = $this->stdClass->callMe();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php declare (strict_types=1);
|
||||
|
||||
class ClassWitNamedService implements ContainerAwareInterface
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$someService = $this->get('some.class');
|
||||
$someResult = $this->get('some.class')->callMe();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user