mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 20:39:43 +01:00
Merge pull request #639 from bendavies/tests-for-various-problems
AnnotatedPropertyInjectToConstructorInjectionRector issues
This commit is contained in:
commit
e1ef0f1c6f
@ -21,6 +21,11 @@ final class AnnotatedPropertyInjectToConstructorInjectionRectorTest extends Abst
|
||||
public function provideWrongToFixedFiles(): Iterator
|
||||
{
|
||||
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'];
|
||||
yield [__DIR__ . '/Wrong/wrong5.php.inc', __DIR__ . '/Correct/correct5.php.inc'];
|
||||
yield [__DIR__ . '/Wrong/wrong6.php.inc', __DIR__ . '/Correct/correct6.php.inc'];
|
||||
}
|
||||
|
||||
protected function provideConfig(): string
|
||||
|
@ -1,19 +1,19 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
class ClassWithInjects
|
||||
class ClassWithInjects2
|
||||
{
|
||||
/**
|
||||
* @var stdClass
|
||||
* @autowired
|
||||
*/
|
||||
private $property;
|
||||
public $property;
|
||||
|
||||
/**
|
||||
* @var DateTimeInterface
|
||||
* @inject
|
||||
*/
|
||||
public $otherProperty;
|
||||
public function __construct(\stdClass $property)
|
||||
private $otherProperty;
|
||||
public function __construct(\DateTimeInterface $otherProperty)
|
||||
{
|
||||
$this->property = $property;
|
||||
$this->otherProperty = $otherProperty;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProduct;
|
||||
|
||||
class ClassWithInjects3
|
||||
{
|
||||
/**
|
||||
* @var SomeProduct
|
||||
*/
|
||||
private $property;
|
||||
|
||||
public function __construct(SomeProduct $property)
|
||||
{
|
||||
$this->property = $property;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProductWithInterface;
|
||||
|
||||
class ClassWithInjects4
|
||||
{
|
||||
/**
|
||||
* @var SomeProductWithInterface
|
||||
*/
|
||||
private $property;
|
||||
|
||||
public function __construct(SomeProductWithInterface $property)
|
||||
{
|
||||
$this->property = $property;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProductWithTrait;
|
||||
|
||||
class ClassWithInjects5
|
||||
{
|
||||
/**
|
||||
* @var SomeProductWithTrait
|
||||
*/
|
||||
private $property;
|
||||
|
||||
public function __construct(SomeProductWithTrait $property)
|
||||
{
|
||||
$this->property = $property;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProductWithParent;
|
||||
|
||||
class ClassWithInjects6
|
||||
{
|
||||
/**
|
||||
* @var SomeProductWithParent
|
||||
*/
|
||||
private $property;
|
||||
|
||||
public function __construct(SomeProductWithParent $property)
|
||||
{
|
||||
$this->property = $property;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
interface SomeInterface
|
||||
{
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
class SomeParent
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
final class SomeProduct
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
final class SomeProductWithInterface implements SomeInterface
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
final class SomeProductWithParent extends SomeParent
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
final class SomeProductWithTrait
|
||||
{
|
||||
use SomeTrait;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
trait SomeTrait
|
||||
{
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
class ClassWithInjects
|
||||
class ClassWithInjects2
|
||||
{
|
||||
/**
|
||||
* @var stdClass
|
||||
* @autowired
|
||||
*/
|
||||
protected $property;
|
||||
public $property;
|
||||
|
||||
/**
|
||||
* @var DateTimeInterface
|
||||
* @inject
|
||||
*/
|
||||
public $otherProperty;
|
||||
protected $otherProperty;
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProduct;
|
||||
|
||||
class ClassWithInjects3
|
||||
{
|
||||
/**
|
||||
* @var SomeProduct
|
||||
* @inject
|
||||
*/
|
||||
protected $property;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProductWithInterface;
|
||||
|
||||
class ClassWithInjects4
|
||||
{
|
||||
/**
|
||||
* @var SomeProductWithInterface
|
||||
* @inject
|
||||
*/
|
||||
protected $property;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProductWithTrait;
|
||||
|
||||
class ClassWithInjects5
|
||||
{
|
||||
/**
|
||||
* @var SomeProductWithTrait
|
||||
* @inject
|
||||
*/
|
||||
protected $property;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Rector\Tests\Rector\Architecture\DependencyInjection\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeProductWithParent;
|
||||
|
||||
class ClassWithInjects6
|
||||
{
|
||||
/**
|
||||
* @var SomeProductWithParent
|
||||
* @inject
|
||||
*/
|
||||
protected $property;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user