Skip to content

Conversation

zonuexe
Copy link
Contributor

@zonuexe zonuexe commented Feb 5, 2025

PHP Manual scandir()

@@ -10283,7 +10283,7 @@
'scalebarObj::set' => ['int', 'property_name'=>'string', 'new_value'=>''],
'scalebarObj::setImageColor' => ['int', 'red'=>'int', 'green'=>'int', 'blue'=>'int'],
'scalebarObj::updateFromString' => ['int', 'snippet'=>'string'],
'scandir' => ['list<string>|false', 'dir'=>'string', 'sorting_order='=>'SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING| SCANDIR_SORT_NONE', 'context='=>'resource'],
'scandir' => ['__benevolent<list<string>|false>', 'dir'=>'string', 'sorting_order='=>'SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING|SCANDIR_SORT_NONE', 'context='=>'resource'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If directory is not a directory, then boolean false is returned, and an error of level E_WARNING is generated.

It makes sense to add ____benevolent<>.

@zonuexe zonuexe changed the title Make precise scandir() argument and return type Fix scandir() argument and return type Feb 5, 2025
@@ -99,6 +99,7 @@
'PhpToken::getTokenName' => ['non-falsy-string'],
'preg_match_all' => ['0|positive-int|false', 'pattern'=>'string', 'subject'=>'string', '&w_subpatterns='=>'array', 'flags='=>'int', 'offset='=>'int'],
'proc_get_status' => ['array{command: string, pid: int, running: bool, signaled: bool, stopped: bool, exitcode: int, termsig: int, stopsig: int}', 'process'=>'resource'],
'scandir' => ['__benevolent<list<string>|false>', 'dir'=>'string', 'sorting_order='=>'SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING|SCANDIR_SORT_NONE', 'context='=>'?resource'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changelog

8.0.0 context is now nullable.

@ondrejmirtes ondrejmirtes merged commit 192fefa into phpstan:2.1.x Feb 27, 2025
431 of 433 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.

2 participants