Skip to content
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

Merged
merged 1 commit into from
Jan 25, 2021
Merged

Conversation

sj-i
Copy link
Contributor

@sj-i sj-i commented Jan 24, 2021

@psalm-github-bot
Copy link

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
{
}
Psalm output (using commit ae172b2):

ERROR: MoreSpecificImplementedParamType - 14:7 - Argument 2 of PDOStatement::fetchAll has the more specific type 'callable|int|string', expecting 'mixed' as defined by PDOStatementInterface::fetchAll

sj-i added a commit to sj-i/php-database that referenced this pull request Jan 24, 2021
…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
sj-i added a commit to sj-i/php-database that referenced this pull request Jan 24, 2021
…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
@@ -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'],
Copy link
Collaborator

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.

Copy link
Contributor Author

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!

@sj-i sj-i force-pushed the fix-pdostatement-80 branch from 372ed8c to 1ba828d Compare January 25, 2021 13:59
@sj-i sj-i force-pushed the fix-pdostatement-80 branch from 1ba828d to a5cdda4 Compare January 25, 2021 14:07
@muglug muglug merged commit e61daf5 into vimeo:master Jan 25, 2021
@muglug
Copy link
Collaborator

muglug commented Jan 25, 2021

Thanks!

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.

3 participants