"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?

1 comment

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

Please sign in to leave a comment.