mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -16,9 +16,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AdminController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/{_locale}/admin/budget", name="chill_admin_budget")
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/budget', name: 'chill_admin_budget')]
|
||||
public function indexAdminAction()
|
||||
{
|
||||
return $this->render('@ChillBudget/Admin/index.html.twig');
|
||||
|
@@ -21,9 +21,8 @@ class ChargeController extends AbstractElementController
|
||||
{
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/delete", name="chill_budget_charge_delete")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/delete', name: 'chill_budget_charge_delete')]
|
||||
public function deleteAction(Request $request, Charge $charge)
|
||||
{
|
||||
return $this->_delete(
|
||||
@@ -36,9 +35,8 @@ class ChargeController extends AbstractElementController
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/edit", name="chill_budget_charge_edit")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/edit', name: 'chill_budget_charge_edit')]
|
||||
public function editAction(Request $request, Charge $charge)
|
||||
{
|
||||
return $this->_edit(
|
||||
@@ -51,9 +49,8 @@ class ChargeController extends AbstractElementController
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-person/{id}/new", name="chill_budget_charge_new")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-person/{id}/new', name: 'chill_budget_charge_new')]
|
||||
public function newAction(Request $request, Person $person)
|
||||
{
|
||||
return $this->_new(
|
||||
@@ -66,9 +63,8 @@ class ChargeController extends AbstractElementController
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-household/{id}/new", name="chill_budget_charge_household_new")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-household/{id}/new', name: 'chill_budget_charge_household_new')]
|
||||
public function newHouseholdAction(Request $request, Household $household)
|
||||
{
|
||||
return $this->_new(
|
||||
@@ -81,9 +77,8 @@ class ChargeController extends AbstractElementController
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/view", name="chill_budget_charge_view")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/view', name: 'chill_budget_charge_view')]
|
||||
public function viewAction(Charge $charge)
|
||||
{
|
||||
return $this->_view($charge, '@ChillBudget/Charge/view.html.twig');
|
||||
|
@@ -23,9 +23,7 @@ class ElementController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) {}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-person/{id}", name="chill_budget_elements_index")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-person/{id}', name: 'chill_budget_elements_index')]
|
||||
public function indexAction(Person $person)
|
||||
{
|
||||
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $person);
|
||||
@@ -47,9 +45,7 @@ class ElementController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-household/{id}", name="chill_budget_elements_household_index")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-household/{id}', name: 'chill_budget_elements_household_index')]
|
||||
public function indexHouseholdAction(Household $household)
|
||||
{
|
||||
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household);
|
||||
|
@@ -20,9 +20,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class ResourceController extends AbstractElementController
|
||||
{
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/delete", name="chill_budget_resource_delete")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/delete', name: 'chill_budget_resource_delete')]
|
||||
public function deleteAction(Request $request, Resource $resource)
|
||||
{
|
||||
return $this->_delete(
|
||||
@@ -33,9 +31,7 @@ class ResourceController extends AbstractElementController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/edit", name="chill_budget_resource_edit")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/edit', name: 'chill_budget_resource_edit')]
|
||||
public function editAction(Request $request, Resource $resource): Response
|
||||
{
|
||||
return $this->_edit(
|
||||
@@ -48,9 +44,8 @@ class ResourceController extends AbstractElementController
|
||||
|
||||
/**
|
||||
* Create a new budget element for a person.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-person/{id}/new", name="chill_budget_resource_new")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-person/{id}/new', name: 'chill_budget_resource_new')]
|
||||
public function newAction(Request $request, Person $person): Response
|
||||
{
|
||||
return $this->_new(
|
||||
@@ -63,9 +58,8 @@ class ResourceController extends AbstractElementController
|
||||
|
||||
/**
|
||||
* Create new budget element for a household.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-household/{id}/new", name="chill_budget_resource_household_new")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-household/{id}/new', name: 'chill_budget_resource_household_new')]
|
||||
public function newHouseholdAction(Request $request, Household $household): Response
|
||||
{
|
||||
return $this->_new(
|
||||
@@ -76,9 +70,7 @@ class ResourceController extends AbstractElementController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/view", name="chill_budget_resource_view")
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/view', name: 'chill_budget_resource_view')]
|
||||
public function viewAction(Resource $resource): Response
|
||||
{
|
||||
return $this->_view($resource, '@ChillBudget/Resource/view.html.twig');
|
||||
|
@@ -27,15 +27,9 @@ abstract class AbstractElement
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="amount", type="decimal", precision=10, scale=2)
|
||||
*
|
||||
* @Assert\GreaterThan(
|
||||
* value=0
|
||||
* )
|
||||
*
|
||||
* @Assert\NotNull(
|
||||
* message="The amount cannot be empty"
|
||||
* )
|
||||
*/
|
||||
#[Assert\GreaterThan(value: 0)]
|
||||
#[Assert\NotNull(message: 'The amount cannot be empty')]
|
||||
private string $amount;
|
||||
|
||||
/**
|
||||
@@ -45,12 +39,8 @@ abstract class AbstractElement
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="endDate", type="datetime_immutable", nullable=true)
|
||||
*
|
||||
* @Assert\GreaterThan(
|
||||
* propertyPath="startDate",
|
||||
* message="The budget element's end date must be after the start date"
|
||||
* )
|
||||
*/
|
||||
#[Assert\GreaterThan(propertyPath: 'startDate', message: "The budget element's end date must be after the start date")]
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
/**
|
||||
@@ -69,9 +59,8 @@ abstract class AbstractElement
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="startDate", type="datetime_immutable")
|
||||
*
|
||||
* @Assert\Date
|
||||
*/
|
||||
#[Assert\Date]
|
||||
private \DateTimeImmutable $startDate;
|
||||
|
||||
/**
|
||||
|
@@ -23,9 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
* )
|
||||
*
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @UniqueEntity(fields={"kind"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['kind'])]
|
||||
class ChargeKind
|
||||
{
|
||||
/**
|
||||
@@ -44,11 +43,9 @@ class ChargeKind
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false)
|
||||
*
|
||||
* @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric")
|
||||
*
|
||||
* @Assert\Length(min=3)
|
||||
*/
|
||||
#[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')]
|
||||
#[Assert\Length(min: 3)]
|
||||
private string $kind = '';
|
||||
|
||||
/**
|
||||
|
@@ -22,11 +22,12 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
*
|
||||
* @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"})
|
||||
* })
|
||||
* @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"})
|
||||
* })
|
||||
*
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @UniqueEntity(fields={"kind"})
|
||||
*/
|
||||
#[UniqueEntity(fields: ['kind'])]
|
||||
class ResourceKind
|
||||
{
|
||||
/**
|
||||
@@ -45,11 +46,9 @@ class ResourceKind
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=false, options={"default": ""})
|
||||
*
|
||||
* @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric")
|
||||
*
|
||||
* @Assert\Length(min=3)
|
||||
*/
|
||||
#[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')]
|
||||
#[Assert\Length(min: 3)]
|
||||
private string $kind = '';
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user