forms-multiplier
forms-multiplier copied to clipboard
Multiplier::validate(): Filter out non-validatable components
45ed76a7ed22c9b97048441eccd4a7fb2f8f2d6f started filtering components to Control
s, to appease PHPStan, since Container::validate()
only accepts Control[]
. But Multiplier
does not actually have Control
s as direct children (other than the ‘Add’ Submitter
s), so it would stop validating and filtering multiplied controls.
a5a7348fdb1046275e83fa47d73a444695cf21b4 reverted that part but kept the incorrect phpdoc type cast.
Now, it works without the filter because Container::validate()
already ignores non-validatable components but we should still respect its contract.
Let’s filter the components before passing them down. This will also allow us to drop the lying phpdoc type cast.
Depends on https://github.com/nette/forms/pull/323 for PHPStan to pass.
- [x] Add test reproducing #68 or #79.