mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
apply rules rector up to php82
This commit is contained in:
@@ -13,11 +13,11 @@ namespace Chill\BudgetBundle\Calculator;
|
||||
|
||||
class CalculatorResult
|
||||
{
|
||||
public const TYPE_CURRENCY = 'currency';
|
||||
final public const TYPE_CURRENCY = 'currency';
|
||||
|
||||
public const TYPE_PERCENTAGE = 'percentage';
|
||||
final public const TYPE_PERCENTAGE = 'percentage';
|
||||
|
||||
public const TYPE_RATE = 'rate';
|
||||
final public const TYPE_RATE = 'rate';
|
||||
|
||||
public $label;
|
||||
|
||||
|
@@ -31,7 +31,7 @@ use function count;
|
||||
|
||||
class ElementController extends AbstractController
|
||||
{
|
||||
public function __construct(private CalculatorManager $calculator, private ResourceRepository $resourceRepository, private ChargeRepository $chargeRepository)
|
||||
public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -24,15 +24,15 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
class Charge extends AbstractElement implements HasCentersInterface
|
||||
{
|
||||
public const HELP_ASKED = 'running';
|
||||
final public const HELP_ASKED = 'running';
|
||||
|
||||
public const HELP_NO = 'no';
|
||||
final public const HELP_NO = 'no';
|
||||
|
||||
public const HELP_NOT_RELEVANT = 'not-relevant';
|
||||
final public const HELP_NOT_RELEVANT = 'not-relevant';
|
||||
|
||||
public const HELP_YES = 'yes';
|
||||
final public const HELP_YES = 'yes';
|
||||
|
||||
public const HELPS = [
|
||||
final public const HELPS = [
|
||||
self::HELP_ASKED,
|
||||
self::HELP_NO,
|
||||
self::HELP_YES,
|
||||
|
@@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ChargeType extends AbstractType
|
||||
{
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ChargeKindRepository $repository, private TranslatorInterface $translator)
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ChargeKindRepository $repository, private readonly TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ResourceType extends AbstractType
|
||||
{
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepository $repository, private TranslatorInterface $translator)
|
||||
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ResourceKindRepository $repository, private readonly TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
final readonly class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
public function __construct(private Security $security)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class ChargeKindRepository implements ChargeKindRepositoryInterface
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class ResourceKindRepository implements ResourceKindRepositoryInterface
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -24,20 +24,20 @@ use UnexpectedValueException;
|
||||
|
||||
class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
public const CREATE = 'CHILL_BUDGET_ELEMENT_CREATE';
|
||||
final public const CREATE = 'CHILL_BUDGET_ELEMENT_CREATE';
|
||||
|
||||
public const DELETE = 'CHILL_BUDGET_ELEMENT_DELETE';
|
||||
final public const DELETE = 'CHILL_BUDGET_ELEMENT_DELETE';
|
||||
|
||||
public const ROLES = [
|
||||
final public const ROLES = [
|
||||
self::CREATE,
|
||||
self::DELETE,
|
||||
self::SEE,
|
||||
self::UPDATE,
|
||||
];
|
||||
|
||||
public const SEE = 'CHILL_BUDGET_ELEMENT_SEE';
|
||||
final public const SEE = 'CHILL_BUDGET_ELEMENT_SEE';
|
||||
|
||||
public const UPDATE = 'CHILL_BUDGET_ELEMENT_UPDATE';
|
||||
final public const UPDATE = 'CHILL_BUDGET_ELEMENT_UPDATE';
|
||||
|
||||
protected VoterHelperInterface $voter;
|
||||
|
||||
|
@@ -27,7 +27,7 @@ use function count;
|
||||
/**
|
||||
* Helps to find a summary of the budget: the sum of resources and charges.
|
||||
*/
|
||||
final class SummaryBudget implements SummaryBudgetInterface
|
||||
final readonly class SummaryBudget implements SummaryBudgetInterface
|
||||
{
|
||||
private const QUERY_CHARGE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, charge_id AS kind_id FROM chill_budget.charge WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY charge_id';
|
||||
|
||||
|
@@ -20,7 +20,7 @@ use Symfony\Component\Templating\EngineInterface;
|
||||
/**
|
||||
* @implements ChillEntityRenderInterface<ResourceKind|ChargeKind>
|
||||
*/
|
||||
final class BudgetElementTypeRender implements ChillEntityRenderInterface
|
||||
final readonly class BudgetElementTypeRender implements ChillEntityRenderInterface
|
||||
{
|
||||
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private EngineInterface $engine)
|
||||
{
|
||||
|
@@ -66,11 +66,11 @@ final class SummaryBudgetTest extends TestCase
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
|
||||
->will(static function ($args) use ($queryResources, $queryCharges) {
|
||||
if (str_contains($args[0], 'chill_budget.resource')) {
|
||||
if (str_contains((string) $args[0], 'chill_budget.resource')) {
|
||||
return $queryResources->reveal();
|
||||
}
|
||||
|
||||
if (str_contains($args[0], 'chill_budget.charge')) {
|
||||
if (str_contains((string) $args[0], 'chill_budget.charge')) {
|
||||
return $queryCharges->reveal();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user