-
Notifications
You must be signed in to change notification settings - Fork 672
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
Fix CallMap of PDOStatement for PHP8 #5100
Conversation
sj-i
commented
Jan 24, 2021
•
edited
Loading
edited
- Fixes https://psalm.dev/r/57f8bc0be4
- The definitions are based on the php-src stub. https://github.com/php/php-src/blob/4bbb98c24fa691c176e403ab00a2fe3dd4224b3e/ext/pdo/pdo_stmt.stub.php
- The example above is valid on the runtime type checking. https://3v4l.org/ZXfT2
- The internal definitions are changed as of PHP 8.0, though the manual doesn't reflect it.
- e.g. https://3v4l.org/GRY5F
I found these snippets: https://psalm.dev/r/57f8bc0be4<?php
interface PDOStatementInterface
{
/**
* @param int $mode
* @param mixed ...$args
* @return array
*/
public function fetchAll(int $mode = \PDO::ATTR_DEFAULT_FETCH_MODE, ...$args);
}
class PDOStatementExtended extends \PDOStatement implements PDOStatementInterface
{
}
|
…ions. phpunit: at() is now deprecated. So added a polyfill to avoid warnings for now. psalm: MethodSignatureMismatch is emitted for PDOStatement::fetchAll() because of the wrong CallMap in the psalm side. See vimeo/psalm#5100
…ions. phpunit: at() is now deprecated. So added a polyfill to avoid warnings for now. psalm: MethodSignatureMismatch is emitted for PDOStatement::fetchAll() because of the wrong CallMap in the psalm side. See vimeo/psalm#5100
dictionaries/CallMap_80_delta.php
Outdated
@@ -286,6 +286,17 @@ | |||
'mktime' => ['int|false', 'hour='=>'int', 'minute='=>'int', 'second='=>'int', 'month='=>'int', 'day='=>'int', 'year='=>'int'], | |||
'parse_str' => ['void', 'encoded_string'=>'string', '&w_result='=>'array'], | |||
'password_hash' => ['string|false|null', 'password'=>'string', 'algo'=>'?string|?int', 'options='=>'array'], | |||
'PDOStatement::bindColumn' => ['bool', 'column'=>'mixed', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need corresponding changes added to Callmap.php
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and the fix was wrongly added to 'old' only. Fixed!
372ed8c
to
1ba828d
Compare
The definitions are based on the php-src stub. https://github.com/php/php-src/blob/4bbb98c24fa691c176e403ab00a2fe3dd4224b3e/ext/pdo/pdo_stmt.stub.php
1ba828d
to
a5cdda4
Compare
Thanks! |
The definitions are based on the php-src stub. https://github.com/php/php-src/blob/4bbb98c24fa691c176e403ab00a2fe3dd4224b3e/ext/pdo/pdo_stmt.stub.php