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

setcookie reports wrong signature when using named paramaters #10171

Closed
mattschlosser opened this issue Nov 20, 2023 · 3 comments
Closed

setcookie reports wrong signature when using named paramaters #10171

mattschlosser opened this issue Nov 20, 2023 · 3 comments

Comments

@mattschlosser
Copy link

Bug report

setcookie has two signatures.

After upgrading from 1.0.41 to 1.0.43, PHPStan is now expecting the third parameter to be an array if I use some named parameters when calling the function.

Parameter #3 $expires_or_options of function setcookie expects array{expires?: int, path?: string, domain?: string, secure?: bool, httponly?: bool, samesite?: 'Lax'|'lax'|'None'|'none'|'Strict'|'strict', url_encode?: int}, 0 given.

However, the documentation states that the second signature, which takes an array as the third parameter, is not usable with named parameters. Rather, the third parameter should be an non-negative int when using named parameters

Code snippet that reproduces the problem

https://phpstan.org/r/fdfab061-a7fe-40f1-926a-a340a3202ccb

Expected output

No error should be reported as it is valid.

Did PHPStan help you today? Did it make you happy in any way?

Thanks for all the hard work.

@mattschlosser mattschlosser changed the title setcookie reports wrong signature when using named paramaters setcookie reports wrong signature when using named paramaters Nov 20, 2023
@ondrejmirtes
Copy link
Member

/cc @schlndh

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#2752

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants