laminas / laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria

Home Page:https://docs.laminas.dev/laminas-validator/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`@psalm-assert` error upstream due to `ValidatorChain`

internalsystemerror opened this issue · comments

Bug Report

Q A
Version(s) >2.18.0

Summary

The following line introduces an error upstream:

* @psalm-assert ValidatorPluginManager $this->plugins
.

Current behavior

Running psalm on laminas/laminas-form we get the error:

ERROR: InvalidDocblock - src/FormAbstractServiceFactory.php:144:58 - Variable $this is not an argument so cannot be asserted (see https://psalm.dev/008)
        $inputFilterFactory->getDefaultValidatorChain()->setPluginManager($container->get('ValidatorManager'));

How to reproduce

Run static analysis as stated above.

Expected behavior

No error

I think this appears to be more of a bug in psalm than laminas-validator, as:

        $validatorChain = $inputFilterFactory->getDefaultValidatorChain();
        $validatorChain->setPluginManager($container->get('ValidatorManager'));

does not give the same error