mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
GetToConstructorInjectionRector - add test case for parent class with trait
This commit is contained in:
parent
f3348c84d8
commit
6e931c857c
@ -31,20 +31,24 @@ final class ClassAndInterfaceTypeResolverTest extends AbstractNodeTypeResolverTe
|
||||
|
||||
public function dataProvider(): Iterator
|
||||
{
|
||||
// yield [__DIR__ . '/Source/ClassWithParentInterface.php', 0, [
|
||||
// ClassWithParentInterface::class,
|
||||
// SomeInterface::class,
|
||||
// ]];
|
||||
//
|
||||
// yield [__DIR__ . '/Source/ClassWithParentClass.php', 0, [
|
||||
// ClassWithParentClass::class,
|
||||
// ParentClass::class,
|
||||
// ]];
|
||||
yield [__DIR__ . '/Source/ClassWithParentInterface.php', 0, [
|
||||
ClassWithParentInterface::class,
|
||||
SomeInterface::class,
|
||||
]];
|
||||
|
||||
// yield [__DIR__ . '/Source/ClassWithTrait.php', 0, [ClassWithTrait::class, AnotherTrait::class]];
|
||||
yield [__DIR__ . '/Source/ClassWithParentClass.php', 0, [
|
||||
ClassWithParentClass::class,
|
||||
ParentClass::class,
|
||||
]];
|
||||
|
||||
yield [__DIR__ . '/Source/ClassWithParentTrait.php', 0, [ClassWithParentTrait::class, ClassWithTrait::class, AnotherTrait::class]];
|
||||
yield [__DIR__ . '/Source/ClassWithTrait.php', 0, [ClassWithTrait::class, AnotherTrait::class]];
|
||||
|
||||
// yield [__DIR__ . '/Source/AnonymousClass.php', 0, [ParentClass::class, SomeInterface::class]];
|
||||
yield [
|
||||
__DIR__ . '/Source/ClassWithParentTrait.php',
|
||||
0,
|
||||
[ClassWithParentTrait::class, ClassWithTrait::class, AnotherTrait::class],
|
||||
];
|
||||
|
||||
yield [__DIR__ . '/Source/AnonymousClass.php', 0, [ParentClass::class, SomeInterface::class]];
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\ClassTypeResolver\Source;
|
||||
|
||||
new class extends ParentClass implements SomeInterface
|
||||
{
|
||||
use AnotherTrait;
|
||||
};
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\ClassTypeResolver\Source;
|
||||
|
||||
trait AnotherTrait
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\ClassTypeResolver\Source;
|
||||
|
||||
final class ClassWithParentClass extends ParentClass
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\ClassTypeResolver\Source;
|
||||
|
||||
final class ClassWithParentInterface implements SomeInterface
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\ClassTypeResolver\Source;
|
||||
|
||||
final class ClassWithTrait
|
||||
{
|
||||
use AnotherTrait;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\ClassTypeResolver\Source;
|
||||
|
||||
class ParentClass
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\ClassTypeResolver\Source;
|
||||
|
||||
interface SomeInterface
|
||||
{
|
||||
|
||||
}
|
@ -12,7 +12,6 @@ class ClassWithNamedServiceAndParentTrait extends ParentClassWithGetTrait
|
||||
{
|
||||
$this->someTranslator = $someTranslator;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$this->someTranslator;
|
||||
|
@ -30,6 +30,7 @@ final class GetToConstructorInjectionRectorTest extends AbstractRectorTestCase
|
||||
yield [__DIR__ . '/Wrong/wrong.php.inc', __DIR__ . '/Correct/correct.php.inc'];
|
||||
yield [__DIR__ . '/Wrong/wrong2.php.inc', __DIR__ . '/Correct/correct2.php.inc'];
|
||||
yield [__DIR__ . '/Wrong/wrong3.php.inc', __DIR__ . '/Correct/correct3.php.inc'];
|
||||
yield [__DIR__ . '/Wrong/wrong4.php.inc', __DIR__ . '/Correct/correct4.php.inc'];
|
||||
}
|
||||
|
||||
protected function provideConfig(): string
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Symfony\Tests\Rector\FrameworkBundle\GetToConstructorInjectionRector\Source;
|
||||
|
||||
class ParentClassWithGetTrait
|
||||
{
|
||||
use GetTrait;
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user