refactor: add explicit types to class constants (PHP 8.3+)

This commit is contained in:
Jérémy Munsch 2026-08-17 09:41:10 +02:00
parent 13091c4ec6
commit 0c25d663f8
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4
9 changed files with 10 additions and 9 deletions

View file

@ -8,7 +8,7 @@ use Shared\DDD\EntityId;
final readonly class ArcadiaEmployeeId extends EntityId
{
private const PATTERN = '/^\d{7,8}$/';
private const string PATTERN = '/^\d{7,8}$/';
public function __construct(
public readonly string $value

View file

@ -6,7 +6,7 @@ namespace Domain\Models\ValueObjects;
final readonly class EstablishmentCode
{
private const PATTERN = '/^[\dA-Z]{2,}$/';
private const string PATTERN = '/^[\dA-Z]{2,}$/';
public function __construct(
public readonly string $value

View file

@ -8,7 +8,7 @@ use Shared\DDD\EntityId;
final readonly class IncoCompositionId extends EntityId
{
private const PATTERN = '/^\d{1,}$/';
private const string PATTERN = '/^\d{1,}$/';
public function __construct(
public readonly string $value

View file

@ -8,7 +8,7 @@ use Shared\DDD\EntityId;
final readonly class IncoId extends EntityId
{
private const PATTERN = '/^\d{1,}$/';
private const string PATTERN = '/^\d{1,}$/';
public function __construct(
public readonly string $value

View file

@ -29,7 +29,7 @@ final readonly class PortionAmount
/**
* The number of decimals allowed, this should not change
*/
private const ALLOWED_DECIMAL_SIZE = 2;
private const int ALLOWED_DECIMAL_SIZE = 2;
/**
* NbPortion

View file

@ -9,7 +9,7 @@ namespace Domain\Models\ValueObjects;
*/
final readonly class ServiceId
{
private const PATTERN = '/^\d{1,}$/';
private const string PATTERN = '/^\d{1,}$/';
public function __construct(
public readonly string $value

View file

@ -9,7 +9,7 @@ namespace Domain\Models\ValueObjects;
*/
final readonly class SiteId
{
private const PATTERN = '/^[A-Z]{2,}$/';
private const string PATTERN = '/^[A-Z]{2,}$/';
public function __construct(
public readonly string $value

View file

@ -18,7 +18,8 @@ use Shared\Pagination;
final class EloquentIncoShortSheetDirectory implements IncoShortSheetDirectory
{
private const SHORT_FIELDS = ['id', 'name', 'label', 'created_at', 'updated_at'];
/** @var list<string> */
private const array SHORT_FIELDS = ['id', 'name', 'label', 'created_at', 'updated_at'];
#[\Override]
public function findAll(

View file

@ -10,7 +10,7 @@ namespace Shared;
final readonly class Pagination
{
/** ERR_TOO_MANY_RECORDS fixed to 10k */
public const MAX_PAGE_SIZE = 10000;
public const int MAX_PAGE_SIZE = 10000;
public function __construct(
private int $from,