Merge branch 'fix-review' into 'common-sprint-2'

refactor: ♻️ replace trim with mb_trim

See merge request ldc-web/projets/mesbr!40
This commit is contained in:
Corentin HUET 2026-09-24 12:36:30 +00:00
commit 24324e3029
14 changed files with 17 additions and 17 deletions

View file

@ -9,7 +9,7 @@ final readonly class ActorDisplayName
public function __construct(
public string $value,
) {
$trimmed = trim($value);
$trimmed = mb_trim($value);
if ($trimmed === '') {
throw new \DomainException('Display name cannot be empty.');

View file

@ -9,7 +9,7 @@ final readonly class CampaignCode
public function __construct(
public string $code,
) {
$trimmed = trim($code);
$trimmed = mb_trim($code);
if ($trimmed === '') {
throw new \DomainException('Campaign code cannot be empty.');

View file

@ -9,7 +9,7 @@ final readonly class CampaignName
public function __construct(
public string $value,
) {
$trimmed = trim($value);
$trimmed = mb_trim($value);
if ($trimmed === '') {
throw new \DomainException('Campaign name cannot be empty.');

View file

@ -13,7 +13,7 @@ final readonly class Applicant
public string $lastname,
public Email $email,
) {
$trimmedFirstname = trim($firstname);
$trimmedFirstname = mb_trim($firstname);
if ($trimmedFirstname === '') {
throw new \DomainException('Applicant firstname cannot be empty.');
@ -23,7 +23,7 @@ final readonly class Applicant
throw new \DomainException('Applicant firstname exceeds the maximum allowed length.');
}
$trimmedLastname = trim($lastname);
$trimmedLastname = mb_trim($lastname);
if ($trimmedLastname === '') {
throw new \DomainException('Applicant lastname cannot be empty.');

View file

@ -9,7 +9,7 @@ final readonly class RejectionReason
public function __construct(
public string $value,
) {
$trimmed = trim($value);
$trimmed = mb_trim($value);
if ($trimmed === '') {
throw new \DomainException('Rejection reason cannot be empty.');

View file

@ -13,7 +13,7 @@ final readonly class CouponLegalInformation implements Equatable
public string $legalText,
public Country $forLocale
) {
$trimmed = trim($this->legalText);
$trimmed = mb_trim($this->legalText);
if ($trimmed === '') {
throw new \DomainException('Legal text cannot be empty.');

View file

@ -15,7 +15,7 @@ final readonly class CouponProduct
/** @var CouponProductInfo[] */
public array $labels,
) {
$trimmed = trim($this->name);
$trimmed = mb_trim($this->name);
if ($trimmed === '') {
throw new \DomainException('Coupon Product name cannot be empty.');

View file

@ -15,19 +15,19 @@ final readonly class CouponProductInfo implements Equatable
public string $validityText,
public Country $forLocale
) {
$trimmedName = trim($this->name);
$trimmedName = mb_trim($this->name);
if ($trimmedName === '') {
throw new \DomainException('Product Info name cannot be empty.');
}
$trimmedRange = trim($this->range);
$trimmedRange = mb_trim($this->range);
if ($trimmedRange === '') {
throw new \DomainException('Product Info range cannot be empty.');
}
$trimmedValidityText = trim($this->validityText);
$trimmedValidityText = mb_trim($this->validityText);
if ($trimmedValidityText === '') {
throw new \DomainException('Product Info validity text cannot be empty.');

View file

@ -9,7 +9,7 @@ final readonly class CouponName
public function __construct(
public string $value,
) {
$trimmed = trim($value);
$trimmed = mb_trim($value);
if ($trimmed === '') {
throw new \DomainException('Coupon name cannot be empty.');

View file

@ -9,7 +9,7 @@ final readonly class CouponProductName
public function __construct(
public string $value,
) {
$trimmed = trim($value);
$trimmed = mb_trim($value);
if ($trimmed === '') {
throw new \DomainException('Coupon product name cannot be empty.');

View file

@ -13,7 +13,7 @@ final readonly class GS1 implements \Stringable, Equatable
public string $value,
public BarcodeFormat $format
) {
$trimmed = trim($this->value);
$trimmed = mb_trim($this->value);
if ($trimmed === '') {
throw new \DomainException('GS1 value cannot be empty.');

View file

@ -11,7 +11,7 @@ final readonly class ProcessingCode implements \Stringable, Equatable
public function __construct(
public string $value,
) {
$trimmed = trim($this->value);
$trimmed = mb_trim($this->value);
if ($trimmed === '') {
throw new \DomainException('Processing Code value cannot be empty.');

View file

@ -18,7 +18,7 @@ final readonly class StockAdjustment
throw new \DomainException('Stock Amount should be more than 0.');
}
$trimmed = trim($reason);
$trimmed = mb_trim($reason);
if ($trimmed === '') {
throw new \DomainException('Reason cannot be empty.');

View file

@ -9,7 +9,7 @@ final readonly class TagName
public function __construct(
public string $value,
) {
$trimmed = trim($value);
$trimmed = mb_trim($value);
if ($trimmed === '') {
throw new \DomainException('Tag name cannot be empty.');