mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
Refactored code to use PHP8 attributes instead of annotations
In this change, Doctrine and validation annotations have been replaced with PHP8 Attributes. The Rector tool has been configured with a list of annotations to convert to attributes. As a consequence, the PHPStan's rules have been updated to reflect these changes. The PHP8's nullable operator (?) has been added where required, and comments in field declaration have been replaced with #[Attribute] syntax.
This commit is contained in:
@@ -13,9 +13,7 @@ namespace Chill\MainBundle\Validation\Constraint;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD)]
|
||||
class PhonenumberConstraint extends Constraint
|
||||
{
|
||||
public $notLandlineMessage = 'This is not a landline phonenumber';
|
||||
@@ -29,7 +27,13 @@ class PhonenumberConstraint extends Constraint
|
||||
*
|
||||
* @var string 'landline', 'mobile' or 'any'
|
||||
*/
|
||||
public $type;
|
||||
public string $type;
|
||||
|
||||
public function __construct(?array $options = null, ?string $type = null, ?array $groups = null, $payload = null)
|
||||
{
|
||||
parent::__construct($options ?? [], $groups, $payload);
|
||||
$this->type = $type ?? 'any';
|
||||
}
|
||||
|
||||
public function validatedBy()
|
||||
{
|
||||
|
Reference in New Issue
Block a user