This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
It seems like \CodexShaper\OAuth2\Serv...:getPsrServerResponse() of type object<Nyholm\Psr7\Response> is incompatible with the declared type object<CodexShaper\OAuth...sponses\ServerResponse> of property $response.
Our type inference engine has found an assignment to a property that is incompatible
with the declared type of that property.
Either this assignment is in error or the assigned type should be added
to the documentation/type hint for that property..
$this->request is of type object<CodexShaper\OAuth...Requests\ServerRequest>, but the function expects a object<Psr\Http\Message\ServerRequestInterface>.
It seems like the type of the argument is not accepted by the function/method
which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this
might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
functionacceptsInteger($int){}$x='123';// string "123"// Instead ofacceptsInteger($x);// we recommend to useacceptsInteger((integer)$x);
The return type of return $this->server->re...->response)->getBody(); (Psr\Http\Message\StreamInterface) is incompatible with the return type documented by CodexShaper\OAuth2\Serve...oller::issueAccessToken of type League\OAuth2\Server\Res...s\ResponseTypeInterface.
If you return a value from a function or method, it should be a sub-type of the
type that is given by the parent type f.e. an interface, or abstract method.
This is more formally defined by the
Lizkov substitution principle,
and guarantees that classes that depend on the parent type can use any instance
of a child type interchangably. This principle also belongs to the
SOLID principles
for object oriented design.
Our function my_function expects a Post object, and outputs the author
of the post. The base class Post returns a simple string and outputting a
simple string will work just fine. However, the child class BlogPost which
is a sub-type of Post instead decided to return an object, and is
therefore violating the SOLID principles. If a BlogPost were passed to
my_function, PHP would not complain, but ultimately fail when executing the
strtoupper call in its body.
The class CodexShaper\OAuth2\Serve...rs\OAuthServerException does not exist. Did you forget a USE statement, or did you not list all dependencies?
Scrutinizer analyzes your composer.json/composer.lock file if available to
determine the classes, and functions that are defined by your dependencies.
It seems like the listed class was neither found in your dependencies, nor was it
found in the analyzed files in your repository. If you are using some other form
of dependency management, you might want to disable this analysis.
Loading history...
64
65
// All instances of OAuthServerException can be formatted into a HTTP response
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.