Skip to content

Commit

Permalink
Fix Symfony 6.1 deprecation notice on $errorNames array
Browse files Browse the repository at this point in the history
See symfony/symfony#45371

BC Layer kept.
  • Loading branch information
damienalexandre authored and roukmoute committed Sep 26, 2023
1 parent 52b94d6 commit ca700cf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/Constraints/Mig.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ class Mig extends Constraint
public $migMessage = 'Cette valeur n\'est pas au format MIG.';

/** @var array<string, string> */
protected static $errorNames = [
protected const ERROR_NAMES = [
self::LENGTH_ERROR => 'LENGTH_ERROR',
self::MIG_INVALID => 'MIG_INVALID',
];

/**
* @var array<string, string>
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
*/
protected static $errorNames = self::ERROR_NAMES;
}
8 changes: 7 additions & 1 deletion src/Constraints/Nir.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ class Nir extends Constraint
public $nirKeyMessage = 'La clé ne correspond pas au NIR fourni.';

/** @var array<string, string> */
protected static $errorNames = [
protected const ERROR_NAMES = [
self::LENGTH_ERROR => 'LENGTH_ERROR',
self::NIR_INVALID => 'NIR_INVALID',
self::NIR_KEY_INVALID => 'NIR_KEY_INVALID',
];

/**
* @var array<string, string>
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
*/
protected static $errorNames = self::ERROR_NAMES;

/** @var NirKeyInterface */
public $nirKey;

Expand Down
8 changes: 7 additions & 1 deletion src/Constraints/Nnp.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ class Nnp extends Constraint
public $nnpMessage = 'Cette valeur n\'est pas au format NNP.';

/** @var array<string, string> */
protected static $errorNames = [
protected const ERROR_NAMES = [
self::LENGTH_ERROR => 'LENGTH_ERROR',
self::NNP_INVALID => 'NNP_INVALID',
];

/**
* @var array<string, string>
* @deprecated since Symfony 6.1, use const ERROR_NAMES instead
*/
protected static $errorNames = self::ERROR_NAMES;
}

0 comments on commit ca700cf

Please sign in to comment.