Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPDoc of Slim\Http\Request::getParams it's wrong #2890

Closed
sdecandelario opened this issue Nov 29, 2019 · 3 comments
Closed

PHPDoc of Slim\Http\Request::getParams it's wrong #2890

sdecandelario opened this issue Nov 29, 2019 · 3 comments
Labels

Comments

@sdecandelario
Copy link

Hello, In my project we use PHPStan for the static analysis, and throw me an error from the method getParams from \Slim\Http\Request because say the method can return null or array.

But i reviewd the two returns of the method and in both only return an array, that are or $onlyParams or $params, is the PHPDoc returnwrong?

@odan
Copy link
Contributor

odan commented Nov 29, 2019

getParams from \Slim\Http\Request

In the latest version of slim/http the signature of ServerRequest::getParams looks like this:

/**
 * Fetch associative array of body and query string parameters.
 *
 * Note: This method is not part of the PSR-7 standard.
 *
 * @return mixed[]
*/
public function getParams(): array

But I could not find a Request::getParams method in slim/http.

A Phpstan scan didn't give me any errors.

Do you use Slim 3 or Slim 4?

@sdecandelario
Copy link
Author

sdecandelario commented Nov 29, 2019

Sorry, I forgot to put the version we are using. We are in the version 3.11.0 for the moment

Here is the line in 3.11.0 and 3.12.3

3.11.0 https://github.com/slimphp/Slim/blob/3.11.0/Slim/Http/Request.php#L1207
3.12.3 https://github.com/slimphp/Slim/blob/3.12.3/Slim/Http/Request.php#L1189

@l0gicgate
Copy link
Member

That's actually an error. We should fix that, it can only return an array.

@l0gicgate l0gicgate modified the milestone: 3.12.4 Nov 29, 2019
@t0mmy742 t0mmy742 mentioned this issue Dec 25, 2019
l0gicgate added a commit that referenced this issue Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants