"string" type hint, and "method not implemented" inspection regarding "_toString"

In a method I'm using (from SF `Kernel` class) I have the following:

public function __construct(string $environment, bool $debug)

And down the line $environment will be used like

this:$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');

But on this line (and others like it), I receive the following inspection warning:

Warning:(63, 47) Method __toString is not implemented for '\Symfony\Component\HttpKernel\string'

string here is not a class, but a primitve, but the inspection treating as a class that doesn't implement `_toString`, which doesn't make any sense for a string primitive.

Is there any workaround that doesn't involve disabling that inspection completely?

3 comments

It sounds like this one: https://youtrack.jetbrains.com/issue/WI-30024
But it's been fixed years ago.

Is there a chance you could share the project with us on [our issue tracker](https://youtrack.jetbrains.com/newIssue?project=WI)?
Maybe not the whole project, but some stub reproducing the issue.

Thank you!

0

Can't find the time to create an empty project to properly replicate this.

But today I found the same issue.

Curiously enough, happens when I switch to "light" theme (sometimes inmediately, sometimes after restarting PhpStorm), most of the time goes away when I switch back to Darkula (and I always had to restart). Rediscovered the issue thanks to having to change my theme because of a too sunny morrning and a ill positioned screen:

 

Not even in the same version of PhpStorm since I originally posted this, but the issue persists. Sadness.

0

We need a reproducible sample badly, that's hard to tell what's going on there without having one.

0

Please sign in to leave a comment.