Skip to content

Commit 232df98

Browse files
authored
[DeadCode] Add fixture to keep constructor params with autowire attribute
1 parent a6f0ce5 commit 232df98

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

  • rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App;
6+
7+
use App\AbstractFilterExtension;
8+
use Psr\Container\ContainerInterface;
9+
use Symfony\Component\DependencyInjection\Attribute\Autowire;
10+
11+
namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveParentDelegatingConstructorRector\Fixture;
12+
13+
abstract class AbstractDo
14+
{
15+
public function __construct(private readonly ContainerInterface $filterLocator)
16+
{
17+
}
18+
19+
abstract protected function doSomething(): void;
20+
}
21+
22+
namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveParentDelegatingConstructorRector\Fixture;
23+
24+
final class DoSomething extends AbstractDo
25+
{
26+
public function __construct(
27+
#[Autowire(service: 'service_container')]
28+
ContainerInterface $filterLocator,
29+
) {
30+
parent::__construct($filterLocator);
31+
}
32+
33+
protected function doSomething(): void
34+
{
35+
}
36+
37+
}
38+
?>

0 commit comments

Comments
 (0)