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
Description
assertMatchesResourceItemJsonSchema throws JsonSchema\Exception\InvalidArgumentException: 0 is an invalid type for int when comparing against an int backed enum property.
How to reproduce
Simplified example:
public Status: int {
case Active = 1;
case Inactive = 0;
}
class Entity {
#[ORM\Column()]
private Status $status = Status::Active;
}
Use assertMatchesResourceItemJsonSchema against a request to /api/entities/1
Possible Solution
TypeConstraint.php@278 compares $type to 'integer'. Looks like int backed enums are detected as 'int' and not 'integer'.