-
Notifications
You must be signed in to change notification settings - Fork 43
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
Bug: One-off declarations on @psalm-params for Connection::executeUpdate && Connection::executeStatement #106
Comments
The error you get is because you're trying to push |
Heya @orklah, thank you for the correction. You are absolutely correct. |
Psalm matches params to docblock tags by parameter name. |
small error on my part, you didn't push |
I know. I mixed it up when reading the param descriptions, the words "query" and "parameter" came off very prominent to me but the rest is history. |
Actually, we're getting hit with the same problem. I think that the updated stub introduced in #105 is incorrect, as the following code is perfectly valid, yet Psalm is complaining: $this->entityManager->getConnection()->executeStatement($sql, [$uuids], [Connection::PARAM_STR_ARRAY]); results in: ERROR: InvalidArgument - some/path/Service.php:621:13 - Argument 2 of Doctrine\DBAL\Connection::executeStatement expects array<array-key, scalar>, array{int, array<array-key, mixed>} provided (see https://psalm.dev/004)
[$uuids], The doc block for the @param array<int, mixed>|array<string, mixed> $params Statement parameters Shouldn't the stub's parameter be |
Can you propose a PR? |
@psalm-param definitions for $query and $types are off by one on executeUpdate and executeStatement.
Connection::executeUpdate
psalm-plugin-doctrine/stubs/Connection.phpstub
Line 63 in 089d10e
psalm-plugin-doctrine/stubs/Connection.phpstub
Line 64 in 089d10e
Connection::executeStatement
psalm-plugin-doctrine/stubs/Connection.phpstub
Line 72 in 089d10e
psalm-plugin-doctrine/stubs/Connection.phpstub
Line 73 in 089d10e
Proposal:
Error Output:
BR
Martin
The text was updated successfully, but these errors were encountered: