Kdyby / FormsReplicator

Other
30 stars 57 forks source link

Fix type annotations #59

Open jtojnar opened 4 years ago

jtojnar commented 4 years ago

When validating my app using Psalm, I get the following error:

ERROR: PossiblyInvalidArgument - app/forms/TeamFormFactory.php:63:26 - Argument 1 of iterator_count expects Traversable, possibly different type Iterator|array<array-key, Nette\Forms\Container> provided
            return iterator_count($replicator->getContainers()) <= $maxMembers;

Since Nette\ComponentModel\Container::getComponents only returns Iterator, let’s fix the annotations using generics.