update php-cs-fixer and rector + fix rules

This commit is contained in:
2024-01-09 13:50:45 +01:00
parent a63b40fb6c
commit 825cd127d1
79 changed files with 220 additions and 229 deletions

View File

@@ -20,9 +20,8 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
class AddressApiController extends ApiController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Duplicate an existing address.
*

View File

@@ -70,7 +70,7 @@ class ExportController extends AbstractController
*/
public function downloadResultAction(Request $request, mixed $alias)
{
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$export = $exportManager->getExport($alias);
$key = $request->query->get('key', null);
@@ -108,13 +108,13 @@ class ExportController extends AbstractController
*
* @param string $alias
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"})
*/
public function generateAction(Request $request, $alias)
{
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$key = $request->query->get('key', null);
$savedExport = $this->getSavedExportFromRequest($request);
@@ -274,7 +274,7 @@ class ExportController extends AbstractController
*/
protected function createCreateFormExport(string $alias, string $step, array $data, ?SavedExport $savedExport): FormInterface
{
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$isGenerate = str_starts_with($step, 'generate_');
@@ -444,7 +444,7 @@ class ExportController extends AbstractController
*
* @param string $alias
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
private function forwardToGenerate(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport)
{
@@ -452,7 +452,7 @@ class ExportController extends AbstractController
$dataFormatter = $this->session->get('formatter_step_raw', null);
$dataExport = $this->session->get('export_step_raw', null);
if (null === $dataFormatter && $export instanceof \Chill\MainBundle\Export\ExportInterface) {
if (null === $dataFormatter && $export instanceof ExportInterface) {
return $this->redirectToRoute('chill_main_export_new', [
'alias' => $alias,
'step' => $this->getNextStep('generate', $export, true),
@@ -531,7 +531,7 @@ class ExportController extends AbstractController
]);
}
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
$form = $this->createCreateFormExport($alias, 'centers', [], $savedExport);
@@ -620,11 +620,11 @@ class ExportController extends AbstractController
return 'export';
case 'export':
if ($export instanceof \Chill\MainBundle\Export\ExportInterface) {
if ($export instanceof ExportInterface) {
return $reverse ? 'centers' : 'formatter';
}
if ($export instanceof \Chill\MainBundle\Export\DirectExportInterface) {
if ($export instanceof DirectExportInterface) {
return $reverse ? 'centers' : 'generate';
}

View File

@@ -26,7 +26,8 @@ use Symfony\Component\HttpFoundation\Response;
class ScopeController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
private readonly EntityManagerInterface $entityManager,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
@@ -85,7 +86,7 @@ class ScopeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->findAll();
$entities = $em->getRepository(Scope::class)->findAll();
return $this->render('@ChillMain/Scope/index.html.twig', [
'entities' => $entities,
@@ -115,7 +116,7 @@ class ScopeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$scope = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->find($id);
$scope = $em->getRepository(Scope::class)->find($id);
if (!$scope) {
throw $this->createNotFoundException('Unable to find Scope entity.');

View File

@@ -45,7 +45,7 @@ class SearchController extends AbstractController
/** @var Chill\MainBundle\Search\HasAdvancedSearchFormInterface $variable */
$search = $this->searchProvider
->getHasAdvancedFormByName($name);
} catch (\Chill\MainBundle\Search\UnknowSearchNameException) {
} catch (UnknowSearchNameException) {
throw $this->createNotFoundException('no advanced search for '."{$name}");
}

View File

@@ -58,7 +58,7 @@ class UserController extends CRUDController
{
$em = $this->managerRegistry->getManager();
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
$user = $em->getRepository(User::class)->find($uid);
if (!$user) {
throw $this->createNotFoundException('Unable to find User entity.');
@@ -110,13 +110,13 @@ class UserController extends CRUDController
{
$em = $this->managerRegistry->getManager();
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
$user = $em->getRepository(User::class)->find($uid);
if (!$user) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$groupCenter = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
$groupCenter = $em->getRepository(GroupCenter::class)
->find($gcid);
if (!$groupCenter) {
@@ -434,7 +434,7 @@ class UserController extends CRUDController
{
$em = $this->managerRegistry->getManager();
$groupCenterManaged = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
$groupCenterManaged = $em->getRepository(GroupCenter::class)
->findOneBy([
'center' => $groupCenter->getCenter(),
'permissionsGroup' => $groupCenter->getPermissionsGroup(),