You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Therefore, I think that the error message being reported for PHP versions 7.1 to 7.4 is potentially incorrect - and in an unsafe way, since if someone stops checking for false due to this error message it could result in error conditions being missed.
I suggest that phpstan should be updated to define the return type for getopt as array<string, array<int, mixed>|string|false>|false for those PHP versions. (So, add false as a permitted return type).
The text was updated successfully, but these errors were encountered:
Please excuse me not sending a pull request for this. Please let me know if you need me to.
phpstan seems to think that between PHP 7.1 and 7.4,
getopt
returnedarray<string, array<int, mixed>|string|false>
. For those versions of PHP, phpstan returns the following error if you attempt to do a strict comparison of the output ofgetopt
with false.I have taken a look at old versions of the documentation for
getopt
using the Wayback Machine, and while the documented method signature says that previously returnedarray
only, the "Return Values" section always appears to have reported that it will returnfalse
on failure.Therefore, I think that the error message being reported for PHP versions 7.1 to 7.4 is potentially incorrect - and in an unsafe way, since if someone stops checking for
false
due to this error message it could result in error conditions being missed.I suggest that phpstan should be updated to define the return type for
getopt
asarray<string, array<int, mixed>|string|false>|false
for those PHP versions. (So, add false as a permitted return type).The text was updated successfully, but these errors were encountered: