Skip to content

Conversation

dktapps
Copy link
Contributor

@dktapps dktapps commented Sep 22, 2025

This now throws an error in PHP 8.4 when invalid args are given.

See https://www.php.net/manual/en/function.php-uname.php

This now throws an error in PHP 8.4 when invalid args are given.

See https://www.php.net/manual/en/function.php-uname.php
@thg2k
Copy link
Contributor

thg2k commented Sep 22, 2025

I believe that's a regression for phpstan, and that it should go in the 8.4-specific functionMap, so if you are validating for earlier versions it should not error. But that might be negligible.. so wait for the boss review :)

@dktapps
Copy link
Contributor Author

dktapps commented Sep 22, 2025

Well, the function still won't work as expected on <8.4 with wrong arguments

'php_sapi_name' => ['__benevolent<non-empty-string|false>'],
'php_strip_whitespace' => ['string', 'file_name'=>'string'],
'php_uname' => ['string', 'mode='=>'string'],
'php_uname' => ['string', 'mode='=>'"a"|"s"|"n"|"r"|"v"|"m"'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't accept parameter type restrictions outside of bleeding edge. Because this would require users to also narrow down their PHPDocs when they're currently just passing string there.

So this change belongs to resources/functionMap_bleedingEdge.php.

@ondrejmirtes ondrejmirtes merged commit d667db8 into phpstan:2.1.x Oct 6, 2025
544 of 549 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants