You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
This PR was merged into the 7.2 branch.
Discussion
----------
[Validator] the "max" option can be zero
| Q | A
| ------------- | ---
| Branch? | 7.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#59307
| License | MIT
Commits
-------
a5d95be the "max" option can be zero
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
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
The text was updated successfully, but these errors were encountered: