79789585

Date: 2025-10-13 19:39:29
Score: 0.5
Natty:
Report link

I just ran into a similar issue.

Instead of having something like this on your DTO:

#[Assert\Range(min: 0)]
#[Assert\NotNull()]
public float $price = null;

You can explicitly allow integers as well:

#[Assert\Range(min: 0)]
#[Assert\NotNull()]
public float|int|null $price = null;
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: P. Rathje