Skip to content

Commit ab44ec8

Browse files
committed
minor #20059 [Validator] drop type-hints for properties where the ´Type´ constraint is used (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [Validator] drop type-hints for properties where the ´Type´ constraint is used partially revert #18362 as having the native type-hints prevents the `Type` constraint to be applied in a meaningful way (if the types don't match, PHP will error before) Commits ------- 27a06be drop type-hints for properties where the Type constraint is used
2 parents a26d9d3 + 27a06be commit ab44ec8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reference/constraints/Type.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ This will check if ``emailAddress`` is an instance of ``Symfony\Component\Mime\A
3333
class Author
3434
{
3535
#[Assert\Type(Address::class)]
36-
protected Address $emailAddress;
36+
protected $emailAddress;
3737
3838
#[Assert\Type('string')]
39-
protected string $firstName;
39+
protected $firstName;
4040
4141
#[Assert\Type(
4242
type: 'integer',
4343
message: 'The value {{ value }} is not a valid {{ type }}.',
4444
)]
45-
protected int $age;
45+
protected $age;
4646
4747
#[Assert\Type(type: ['alpha', 'digit'])]
48-
protected string $accessCode;
48+
protected $accessCode;
4949
}
5050
5151
.. code-block:: yaml

0 commit comments

Comments
 (0)