It seems that VS Code with PHP tools does not detect the @psalm-import-typeInputSpecification from InputFilterInterface in the Laminas\InputFilter\InputFilter (ver. 2.21.0), and throws a warning for “Unknown class”.
And probably because of this it does not like the array that I provide to the inputfilter->add() and shows error:
Argument '1' passed to add() is expected to be of type
It looks like this is used in a form class. Right?
If so, please avoid this variant, because this isolates the input filter from your application. For example, custom filters and validators that use a factory or delegator cannot be used here.
Define the input filter via the implementation of the interface Laminas\InputFilter\InputFilterProviderInterface:
Hi, thank you for the great suggestion it does not complain for the type any more.
If I am not asking too much, could you please explain why it works?
If I check the InputFilterProviderInterface, the editor still shows warning for unknown type for InputFilterSpecification|CollectionSpecification, like it does for the inputFilter but now it accepts the array in my form