We are running phpstan on a laminas project and running into errors.
As an example, in the controller we have some standard code which works fine.
$request = $this->getRequest();
if ($request->isPost()) { ... }
However phpstan is complaining:
Call to an undefined method Laminas\Stdlib\RequestInterface::isPost()
The problem appears that getRequest() is actually returning an instance of Laminas\Http\PhpEnvironment\Request which does inherit the isPost function from Laminas\Http\Request. But this function is not defined in RequestInterface.
One solution would be to define isPost in RequestInterface although I would prefer to avoid changes to the vendor code.
Is there a better way of getting round this?