Closed
Description
Symfony version(s) affected
7.2.0
Description
This PR #58049 affected psalm and phpstan validation on Count constraint use:
ERROR: InvalidArgument - src/XXXX/Model/MyModel.php:44:31 - Argument 1 of Symfony\Component\Validator\Constraints\Count::__construct expects int<1, max>|null, but 0 provided (see https://psalm.dev/004)
new Assert\Count(max: 0),
With
#[Assert\AtLeastOneOf([
new Assert\Count(max: 0),
new Assert\IsNull(),
new AppAssert\IsValidSignature(),
])]
private ?array $signature = [];
My $signature is an array of coordinates and can be empty for some frontend reasons.
How to reproduce
Use Count constraint with max : 0
Possible Solution
Change @param max dockblock to accept zero
Additional Context
No response