Closed gsteel closed 1 year ago
Added a first stab at documentation @weierophinney
Added a first stab at documentation
Perfect!
I'm approving now, but only because I don't fully understand Marco's concern (though your explanation makes sense to me).
Thanks @gsteel!
Description
Adds a template to InputFilterInterface to define the array shape of filtered values
The plan here is better inference when calling
InputFilterInterface::getValues()
. It might cause a lot of noise for users because psalm requires a template declaration for all inheritors, that said, it'd be useful to those who care.Once merged, users will be able to define an input filter such as:
… and psalm will infer the types for whatever comes out of
$inputFilter->getValues()
such as:As part of wrestling with Psalm on this patch, it's worth mentioning that all input names can now be
array-key
as opposed tostring
. This is not really related to the patch but something I had to address becauseCollectionInputFilter
is effectively a nested list, it's actually a requirement to be able to fetch an input with something like$inputFilter->get(1)
This work has also uncovered at least one or two subtle bugs or ambiguous behaviour and fixes an issue where
InputFilter::add
will attempt to callInput::merge
with anInputFilter
as an argument