Error on throw
I'm getting a warning (red squiggly line) "The thrown object must be an instance of the Exception or Throwable"
I'd like to turn it off, but can't find it anywhere.
Can you give me instructions on how to do this.
Please sign in to leave a comment.
What version you're using?
Please try a simple IDE restart.
If that doesn't help please attach a code sample causing this.
PhpStorm 2017.1.4
Build #PS-171.4694.2, built on May 16, 2017
Licensed to Jim Longo
Subscription is active until February 20, 2018
JRE: 1.8.0_112-release-736-b21 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.5
restart made no difference
Hello,
Should not it be
> throw new \Exception((__METHOD__ . ' no partner_ens config for '.$partner->partner_id).' / '.static::getPenId());
?
Since this is all still our message and there are no other parameters that we use, we must enclose it whole within brackets.
I'll look into that.
But my original question still is unanswered, "how do I turn this warning off?"
@Vladimir
There is no need for the inner () -- just move existing ) to the end.
@Jim
>But my original question still is unanswered, "how do I turn this warning off?"
This comes from the parser level -- it cannot be turned off. This indicates that you either have an error in your code... or PhpStorm has a bug in PHP parser.
Right now (based on your code sample) -- IDE is correct and your code is simply invalid -- you cannot join string to the thrown exception.