Consider using a different method name as you override a private method of the parent class.
Overwriting private methods is generally fine as long as you also use private
visibility. It might still be preferable for understandability to use a different
method name.
Loading history...
11
{
12
if (! isset($server['SERVER_PROTOCOL'])) {
13
return '1.1';
14
}
15
if (! preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) {
It seems like $server can also be of type null; however, Zend\Diactoros\ServerReq...tory::normalizeServer() does only seem to accept array, maybe add an additional type check?
If a method or function can return multiple different values and unless you are
sure that you only can receive a single value in this context, we recommend
to add an additional type check:
/** * @return array|string */functionreturnsDifferentValues($x){if($x){return'foo';}returnarray();}$x=returnsDifferentValues($y);if(is_array($x)){// $x is an array.}
If this a common case that PHP Analyzer should handle natively, please let us
know by opening an issue.
It seems like you call parent on a different method (normalizeServer() instead of fromGlobals()). Are you sure this is correct? If so, you might want to change this to $this->normalizeServer().
This check looks for a call to a parent method whose name is different than
the method from which it is called.
It seems like $files can also be of type null; however, Zend\Diactoros\ServerReq...ctory::normalizeFiles() does only seem to accept array, maybe add an additional type check?
If a method or function can return multiple different values and unless you are
sure that you only can receive a single value in this context, we recommend
to add an additional type check:
/** * @return array|string */functionreturnsDifferentValues($x){if($x){return'foo';}returnarray();}$x=returnsDifferentValues($y);if(is_array($x)){// $x is an array.}
If this a common case that PHP Analyzer should handle natively, please let us
know by opening an issue.
It seems like you call parent on a different method (normalizeFiles() instead of fromGlobals()). Are you sure this is correct? If so, you might want to change this to $this->normalizeFiles().
This check looks for a call to a parent method whose name is different than
the method from which it is called.
It seems like you call parent on a different method (marshalHeaders() instead of fromGlobals()). Are you sure this is correct? If so, you might want to change this to $this->marshalHeaders().
This check looks for a call to a parent method whose name is different than
the method from which it is called.
It seems like you call parent on a different method (marshalUriFromServer() instead of fromGlobals()). Are you sure this is correct? If so, you might want to change this to $this->marshalUriFromServer().
This check looks for a call to a parent method whose name is different than
the method from which it is called.
It seems like you call parent on a different method (get() instead of fromGlobals()). Are you sure this is correct? If so, you might want to change this to $this->get().
This check looks for a call to a parent method whose name is different than
the method from which it is called.
It seems like $cookies defined by parameter $cookies on line 30 can also be of type null; however, Zend\Diactoros\ServerRequest::__construct() does only seem to accept array, maybe add an additional type check?
This check looks at variables that have been passed in as parameters and are passed out again
to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
It seems like $query defined by parameter $query on line 28 can also be of type null; however, Zend\Diactoros\ServerRequest::__construct() does only seem to accept array, maybe add an additional type check?
This check looks at variables that have been passed in as parameters and are passed out again
to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
Overwriting private methods is generally fine as long as you also use private visibility. It might still be preferable for understandability to use a different method name.