0

I've just started using PhpStan. I want to bind a specific base interface to a template variable, but the namespace is ignored. Whatever I try, PhpStand looks in namespace A\...

namespace A;
use B\FooInterface;
/**
 * @template T of FooInterface
 */
interface BarInterface
{
    /**
     * @param T $baz
     * @return mixed
     */
    public function doSomething($baz);
}

...complains about invalid bound type A\FooInterface.

namespace A;

/**
 * @template T of \B\FooInterface
 */
...

...complains about invalid bound type A\B\FooInterface

Looks like a bug in PHPStan to me, but since I've never used it before, I can't be sure if it isn't me...

S. Parton
  • 73
  • 1
  • 7

1 Answers1

0

Ok, I think the bug seemed to be in PhpStorms "rerun Inspection" function, which didn't take updated source code into account and so mislead my interpretation. Re-running the inspection from the menu, it seems to work.So, I guess it is NOT a bug in PhpStan, at least not in the tool's parsing functionality.

S. Parton
  • 73
  • 1
  • 7