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...

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.