The sequence deformatter was not respecting strict mode. Now, if strict mode is set, it will reject anything that is not a sequence. In weak mode, it will accept a non-sequence list but call array_values() on it to coerce it to a sequence.
That allows fields to opt-in to being more permissive about what they accept, but still guarantees that after deserialiation a #[SequenceField] field will have a proper list/sequence in it, period.
There may be more strictness checks we can include, based on the array and key type, but that's for another time.
Motivation and context
Resolves #29.
Types of changes
What types of changes does your code introduce? Put an x in all the boxes that apply:
[X] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
Description
The sequence deformatter was not respecting strict mode. Now, if strict mode is set, it will reject anything that is not a sequence. In weak mode, it will accept a non-sequence list but call
array_values()
on it to coerce it to a sequence.That allows fields to opt-in to being more permissive about what they accept, but still guarantees that after deserialiation a
#[SequenceField]
field will have a proper list/sequence in it, period.There may be more strictness checks we can include, based on the array and key type, but that's for another time.
Motivation and context
Resolves #29.
Types of changes
What types of changes does your code introduce? Put an
x
in all the boxes that apply: