zendframework / zend-inputfilter

InputFilter component from Zend Framework
BSD 3-Clause "New" or "Revised" License
64 stars 50 forks source link

Remove array type for input on InputFilterInterface::add() #31

Closed Maks3w closed 9 years ago

Maks3w commented 9 years ago

array capabilities only exists for InputFilter class but not for their parent BaseInputFilter which is responsible of implement the interface.

People with tools warning about unsafe type should typehint against Zend\InputFilter\InputFilter instead Zend\InputFilter\InputFilterInterface

Reverts:

Maks3w commented 9 years ago

IMO InputFilter::add() method should be deprecated and encourage the use of external call to Factory for achieve the same functionallity.

weierophinney commented 9 years ago

The one problem I see with this is that removing it from the interface would mean that InputFilter's implementation automatically violates the interface. While I totally understand your view point that we may want to recommend using an external factory instead of add()+array specification, that doesn't address the current and existing behavior.

weierophinney commented 9 years ago

A better solution would be to specify in the interface that the implementation MUST handle one or more of the argument types specified, and CAN raise an exception for any it cannot process. This would make it valid for all implementations shipped.

weierophinney commented 9 years ago

Updated with suggestions on merge.