Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

declare(strict_types=1);

namespace Rector\Symfony\Tests\CodeQuality\Rector\Class_\ControllerMethodInjectionToConstructorRector\Fixture;

use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

final class WithentityManager extends AbstractController
{
#[Route('/some-action', name: 'some_action')]
public function someAction(EntityManagerInterface $entityManager)
{
$entityManager->flush();
}
}

?>
-----
<?php

declare(strict_types=1);

namespace Rector\Symfony\Tests\CodeQuality\Rector\Class_\ControllerMethodInjectionToConstructorRector\Fixture;

use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

final class WithentityManager extends AbstractController
{
public function __construct(private readonly \Doctrine\ORM\EntityManagerInterface $entityManager)
{
}
#[Route('/some-action', name: 'some_action')]
public function someAction()
{
$this->entityManager->flush();
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class ControllerMethodInjectionToConstructorRector extends AbstractRector
/**
* @var string[]
*/
private const array COMMON_ENTITY_CONTAINS_SUBNAMESPACES = ["\\Entity", "\\Document", "\\Model"];
private const array COMMON_ENTITY_CONTAINS_SUBNAMESPACES = ["\\Entity\\", "\\Document", "\\Model"];

public function __construct(
private readonly ControllerAnalyzer $controllerAnalyzer,
Expand Down
Loading