[FIXED] PhpStorm Parameter Scalar Type Hint mixed with namespace

Answered

I'm having trouble with PhpStorm type hint, the `Symfony\Component\HttpFoudantion\Response::setStatusCode` for example accepts `int` but when i pass an `int`, PhpStorm says the method expected `Symfony\Component\HttpFoudantion\int`, `int` was given, how do i deal with this ?

Here's an other example :

 

8 comments

Hi there,

How GetResponseForControllerResultEvent is declared? Must be some wrong declaration there (looks like it).

0

Yes, that signature is OK.

Another thought -- what PHP Language Level do you have set in PhpStorm for this project? Maybe it's lower than 7.0 (when such native typehints were introduced)?

No better ideas right now, except trying "File | Invalidate Caches..." and restarting IDE if you have not done it yet.

2

PHP Language level is 7.2 ( php Interpreter 7.2.6 )
invalidating the cache and restarting fixed the issues, thanks for your support.

0

Invaliding Cache and Restarting is only a TEMP solution.

I've had this happen countless times, it is 100% reproducable when you have a project opened and install a new composer package.

This is so frustrating I've downgraded PHPStorm until they can fix it.

Been almost a year and it's still broke.

2

I've just had this and it's the most frustrating thing, invalidated cache/restarting has fixed for now, currently on 2019.1. Not downloading an EAP as there's enough bugs in PHPStorm whilst stable nevermind a beta.

1

This does happen when I manually switch a PHP project version via composer.  Invalidated cache/restart did indeed work and it does not seem to happen often for me.

0

Please sign in to leave a comment.