The expression return new SMartins\Exce...xception->getMessage()) returns the type SMartins\Exceptions\JsonApi\Error which is incompatible with the return type mandated by SMartins\Exceptions\Hand...stractHandler::handle() of array|Illuminate\Support\Collection.
In the issue above, the returned value is violating the contract defined by the
mentioned interface.
Let's take a look at an example:
interfaceHasName{/** @return string */publicfunctiongetName();}className{public$name;}classUserimplementsHasName{/** @return string|Name */publicfunctiongetName(){returnnewName('foo');// This is a violation of the ``HasName`` interface// which only allows a string value to be returned.}}
The method getHttpStatusCode() does not exist on SMartins\Exceptions\Handlers\OAuthServerHandler. Did you maybe mean getStatusCode()?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
15
return (new Error)->setStatus($this->/** @scrutinizer ignore-call */ getHttpStatusCode())
This check looks for calls to methods that do not seem to exist on a given type.
It looks for the method on the type itself as well as in inherited classes or
implemented interfaces.
This is most likely a typographical error or the method has been renamed.
This check looks for calls to methods that do not seem to exist on a given type.
It looks for the method on the type itself as well as in inherited classes or
implemented interfaces.
This is most likely a typographical error or the method has been renamed.
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: