apply rector ruleset "symfony constructor injection"

This commit is contained in:
2025-11-03 16:22:02 +01:00
parent adab2ffe63
commit 7654db4e39
124 changed files with 183 additions and 171 deletions

View File

@@ -15,7 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class example extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, private readonly \Chill\MainBundle\Pagination\PaginatorFactoryInterface $paginatorFactory)
{
}
public function yourAction(): \Symfony\Component\HttpFoundation\Response
@@ -27,7 +27,7 @@ class example extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractControl
->getSingleScalarResult();
// get the PaginatorFactory
$paginatorFactory = $this->get('chill_main.paginator_factory');
$paginatorFactory = $this->paginatorFactory;
// create a pagination instance. This instance is only valid for
// the current route and parameters

View File

@@ -18,7 +18,7 @@ use Symfony\Component\Security\Core\Role\Role;
class ConsultationController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, private readonly \Chill\PersonBundle\Repository\PersonRepository $personRepository)
{
}
/**
@@ -31,7 +31,7 @@ class ConsultationController extends \Symfony\Bundle\FrameworkBundle\Controller\
public function listAction($id): \Symfony\Component\HttpFoundation\Response
{
/** @var \Chill\PersonBundle\Entity\Person $person */
$person = $this->get('chill.person.repository.person')
$person = $this->personRepository
->find($id);
if (null === $person) {