Apply rector rules: symfony up to 54

This commit is contained in:
2024-04-04 23:30:25 +02:00
parent 1ee3b9e2f0
commit 579bd829f8
204 changed files with 974 additions and 2346 deletions

View File

@@ -58,9 +58,7 @@ class AdminDocGeneratorTemplateController extends CRUDController
return parent::new($request);
}
/**
* @Route("{_locale}/admin/docgen/template/pick-context", name="chill_docgen_admin_template_pick-context")
*/
#[Route(path: '{_locale}/admin/docgen/template/pick-context', name: 'chill_docgen_admin_template_pick-context')]
public function pickContext(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_ADMIN');

View File

@@ -51,12 +51,7 @@ final class DocGeneratorTemplateController extends AbstractController
private readonly ChillSecurity $security
) {}
/**
* @Route(
* "{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}",
* name="chill_docgenerator_test_generate_from_template"
* )
*/
#[Route(path: '{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_test_generate_from_template')]
public function adminTestGenerateDocFromTemplateAction(
DocGeneratorTemplate $template,
string $entityClassName,
@@ -71,12 +66,7 @@ final class DocGeneratorTemplateController extends AbstractController
);
}
/**
* @Route(
* "{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}",
* name="chill_docgenerator_generate_from_template"
* )
*/
#[Route(path: '{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_generate_from_template')]
public function generateDocFromTemplateAction(
DocGeneratorTemplate $template,
string $entityClassName,
@@ -91,12 +81,7 @@ final class DocGeneratorTemplateController extends AbstractController
);
}
/**
* @Route(
* "/api/1.0/docgen/templates/by-entity/{entityClassName}",
* name="chill_docgenerator_templates_for_entity_api"
* )
*/
#[Route(path: '/api/1.0/docgen/templates/by-entity/{entityClassName}', name: 'chill_docgenerator_templates_for_entity_api')]
public function listTemplateApiAction(string $entityClassName): Response
{
$nb = $this->docGeneratorTemplateRepository->countByEntity($entityClassName);
@@ -116,13 +101,9 @@ final class DocGeneratorTemplateController extends AbstractController
}
/**
* @Route(
* "{_locale}/admin/doc/gen/generate/test/redirect",
* name="chill_docgenerator_test_generate_redirect"
* )
*
* @return void
*/
#[Route(path: '{_locale}/admin/doc/gen/generate/test/redirect', name: 'chill_docgenerator_test_generate_redirect')]
public function redirectToTestGenerate(Request $request): RedirectResponse
{
$template = $request->query->getInt('template');

View File

@@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_docgen_template")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "docgen_template": DocGeneratorTemplate::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['docgen_template' => DocGeneratorTemplate::class])]
class DocGeneratorTemplate
{
/**
@@ -43,9 +40,8 @@ class DocGeneratorTemplate
/**
* @ORM\Column(type="text", nullable=true)
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?string $description = null;
/**
@@ -66,16 +62,14 @@ class DocGeneratorTemplate
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private array $name = [];
/**

View File

@@ -238,10 +238,9 @@ final class DocGenObjectNormalizerTest extends KernelTestCase
class TestableParentClass
{
/**
* @Serializer\Groups("docgen:read")
*
* @Serializer\Context(normalizationContext={"groups": "docgen:read:foo"}, groups={"docgen:read"})
*/
#[Serializer\Groups('docgen:read')]
public ?TestableChildClass $child;
public function __construct()
@@ -252,27 +251,19 @@ class TestableParentClass
class TestableChildClass
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public string $baz = 'bloup';
/**
* @Serializer\Groups("docgen:read:foo")
*/
#[Serializer\Groups('docgen:read:foo')]
public string $foo = 'bar';
}
class TestableClassWithBool
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public bool $foo;
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public function getThing(): bool
{
return true;
@@ -281,9 +272,7 @@ class TestableClassWithBool
class TestableWithIntersectionReadableCollection
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public ReadableCollection&Selectable $collection;
public function __construct()
@@ -294,9 +283,7 @@ class TestableWithIntersectionReadableCollection
class TestableWithCollection
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public Collection&Selectable $collection;
public function __construct()