Conversation
TysonAndre
left a comment
There was a problem hiding this comment.
Will cherry-pick these changes when I have the time to do this.
I also need to update the version in this repo to mirror phan at some point, and update this from the 7.3 callmap to the 7.4 callmap.
I've found it easier to try to apply deltas from the last few months in git than copy all deltas that look relevant (but some older changes were probably missed).
| 'bcpow' => ['string', 'base'=>'string', 'exponent'=>'string', 'scale='=>'int'], | ||
| 'bcpowmod' => ['?string', 'base'=>'string', 'exponent'=>'string', 'modulus'=>'string', 'scale='=>'int'], | ||
| 'bcscale' => ['bool', 'scale='=>'int'], | ||
| 'bcscale' => ['int', 'scale='=>'int'], |
There was a problem hiding this comment.
https://www.php.net/manual/en/function.bcscale.php#refsect1-function.bcscale-returnvalues
I'll want to add deltas for 7.2
| 'CURLFile::setMimeType' => ['void', 'mime'=>'string'], | ||
| 'CURLFile::setPostFilename' => ['void', 'name'=>'string'], | ||
| 'current' => ['mixed|false', 'array_arg'=>'array|object'], | ||
| 'current' => ['mixed|false', 'array_arg'=>'array'], |
There was a problem hiding this comment.
It's deprecated to use current that way, and I wouldn't use it that way, but object is still a valid type for this in php 7
php > $x = (object)['a' => 2, 'b' => 3];
php > var_export(current($x));
2
| 'DatePeriod::getEndDate' => ['?DateTimeInterface'], | ||
| 'DatePeriod::getStartDate' => ['DateTimeInterface'], | ||
| 'DateTime::__construct' => ['void', 'time='=>'?string', 'timezone='=>'?DateTimeZone'], | ||
| 'DateTime::__construct' => ['void', 'time='=>'string', 'timezone='=>'?DateTimeZone'], |
There was a problem hiding this comment.
new DateTime(null) seems to work in 7.3 - I could conceivably pass null to get now in $timezone
There was a problem hiding this comment.
Yeah, I think the idea is that it's almost always programmer error (sort of like get_class(null))
| 'DateTime::setTimezone' => ['static', 'timezone'=>'DateTimeZone'], | ||
| 'DateTime::sub' => ['static', 'interval'=>'DateInterval'], | ||
| 'DateTimeImmutable::__construct' => ['void', 'time='=>'?string', 'timezone='=>'?DateTimeZone'], | ||
| 'DateTimeImmutable::__construct' => ['void', 'time='=>'string', 'timezone='=>'?DateTimeZone'], |
There was a problem hiding this comment.
as above, might be programmer error that we want to flag.
| 'expect_expectl' => ['int', 'expect'=>'resource', 'cases'=>'array', 'match='=>'array'], | ||
| 'expect_popen' => ['resource', 'command'=>'string'], | ||
| 'explode' => ['array<int,string>', 'separator'=>'string', 'str'=>'string', 'limit='=>'int'], | ||
| 'explode' => ['array<int,string>|false', 'separator'=>'string', 'str'=>'string', 'limit='=>'int'], |
There was a problem hiding this comment.
Phan is deliberately excluding most of the false return types for anything that doesn't involve disk/network IO - merging these changes would just result in too many false positives with phan --strict-type-checking.
PHP 8 being released and throwing runtime errors for many issues caused by invalid parameters will be a relief (at least for analyzing return types).
| 'imap_utf8' => ['string', 'mime_encoded_text'=>'string'], | ||
| 'imap_utf8_to_mutf7' => ['string|false', 'in'=>'string'], | ||
| 'implode' => ['string', 'glue'=>'string', 'pieces'=>'array'], | ||
| 'implode\'1' => ['string', 'pieces'=>'array', 'glue='=>'string'], |
There was a problem hiding this comment.
This was/was going to be added to the deltas for 8.0 - phan warns about this separately
| 'ingres_set_environment' => ['bool', 'link'=>'resource', 'options'=>'array'], | ||
| 'ingres_unbuffered_query' => ['mixed', 'link'=>'resource', 'query'=>'string', 'params='=>'array', 'types='=>'string'], | ||
| 'ini_alter' => ['string|false', 'varname'=>'string', 'newvalue'=>'string|int|float|bool'], | ||
| 'ini_alter' => ['string|false', 'varname'=>'string', 'newvalue'=>'string'], |
| 'newt_win_messagev' => ['void', 'title'=>'string', 'button_text'=>'string', 'format'=>'string', 'args'=>'array'], | ||
| 'newt_win_ternary' => ['int', 'title'=>'string', 'button1_text'=>'string', 'button2_text'=>'string', 'button3_text'=>'string', 'format'=>'string', 'args='=>'mixed', '...args='=>'mixed'], | ||
| 'next' => ['mixed', '&rw_array_arg'=>'array|object'], | ||
| 'next' => ['mixed', '&rw_array_arg'=>'array'], |
| 'VarnishStat::getSnapshot' => ['array'], | ||
| 'version_compare' => ['int|bool', 'ver1'=>'string', 'ver2'=>'string', 'oper='=>'\'\x3c\'|\'lt\'|\'\x3c=\'|\'le\'|\'\x3e\'|\'gt\'|\'\x3e=\'|\'ge\'|\'==\'|\'=\'|\'eq\'|\'!=\'|\'\x3c\x3e\'|\'ne\''], | ||
| 'version_compare' => ['bool', 'ver1'=>'string', 'ver2'=>'string', 'oper'=>'\'\x3c\'|\'lt\'|\'\x3c=\'|\'le\'|\'\x3e\'|\'gt\'|\'\x3e=\'|\'ge\'|\'==\'|\'=\'|\'eq\'|\'!=\'|\'\x3c\x3e\'|\'ne\''], | ||
| 'version_compare\'1' => ['int', 'ver1'=>'string', 'ver2'=>'string', 'oper='=>''], |
There was a problem hiding this comment.
Aside: The third oper should probably be removed from the alternate signature in psalm.
php > var_export(version_compare(1, 2, null));
true
php > var_export(version_compare(1, 2, false));
true
php > var_export(version_compare(1, 2, ''));
true
Phan currently does a poor job of pattern matching alternate signatures (in the backlog), which is why many of these signatures are combined in Phan's version
| 'ssh2_sftp_unlink' => ['bool', 'sftp'=>'resource', 'filename'=>'string'], | ||
| 'ssh2_shell' => ['resource', 'session'=>'resource', 'term_type='=>'string', 'env='=>'array', 'width='=>'int', 'height='=>'int', 'width_height_type='=>'int'], | ||
| 'ssh2_tunnel' => ['resource', 'session'=>'resource', 'host'=>'string', 'port'=>'int'], | ||
| 'ssh2_shell' => ['resource|false', 'session'=>'resource', 'term_type='=>'string', 'env='=>'array', 'width='=>'int', 'height='=>'int', 'width_height_type='=>'int'], |
No description provided.