8000 Upgrade Psalm to its latest version by greg0ire · Pull Request #4222 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Upgrade Psalm to its latest version #4222

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

Merged
merged 3 commits into from
Aug 24, 2020
Merged

Conversation

greg0ire
Copy link
Member

No description provided.

@greg0ire greg0ire linked an issue Aug 23, 2020 that may be closed by this pull request
@greg0ire
Copy link
Member Author

The inferred type 'int' does not match the declared return type 'string' for Doctrine\DBAL\Driver\Mysqli\MysqliConnection::lastInsertId

What should be done about that error? We can either widen the type in interface, but the description says it is supposed to be a string representation… should that error be suppressed, and addressed in the next major by casting to string?

@morozov
Copy link
Member
morozov commented Aug 23, 2020

What should be done about that error?

Let's suppress for now. This API was attempted to be fixed for a couple of years now and it's really questionable per se.

@@ -10,12 +10,12 @@ class Connection extends PDOConnection
/**
* {@inheritdoc}
*/
public function quote($value, $type = ParameterType::STRING)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use $value everywhere. The fact that only input needs to be quoted is $1M misconception.

@@ -52,13 +52,13 @@ public static function assertValidIdentifier($identifier)
/**
* {@inheritDoc}
*/
public function getSubstringExpression($value, $position, $length = null)
public function getSubstringExpression($value, $from, $length = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure this is consistent with master (#3494). The idea is to have the arguments match ANSI SQL analogs if possible (e.g. SUBSTR()).

It cannot be fixed without a BC break
@@ -384,11 +384,11 @@ public function getListSequencesSQL($database)
/**
* {@inheritDoc}
*/
protected function _getCreateTableSQL($table, array $columns, array $options = [])
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is against the approach taken in #4172:

Argument names have been simplified where possible (e.g. dropTable($tableName)dropTable($name)).

Unless we're dealing both with a table and a name in the same context, there's no much point in being too specific IMO.

@@ -1105,9 +1105,9 @@ public function getDateTimeTzFormatString()
/**
* {@inheritDoc}
*/
public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "quoted" attribute should stay as is. It's a rabbit hole but it has its meaning. I can provide more details if necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust you :)

* @param mixed[][] $columns
* @param mixed[] $options
*
* @return string[]
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
protected function _getCreateTableSQL($name, array $columns, array $options = [])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this must a reason why the tests fail… $name is already taken

@greg0ire greg0ire requested a review from morozov August 23, 2020 20:29
@greg0ire greg0ire marked this pull request as ready for review August 23, 2020 20:29
Copy link
Member
@morozov morozov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the Psalm version constraint be updated as well? Otherwise, looks good.

@greg0ire
Copy link
Member Author

Sure, let's prevent accidental downgrades 👍

@greg0ire greg0ire merged commit 51cb7a8 into doctrine:2.10.x Aug 24, 2020
@greg0ire greg0ire deleted the upgrade-psalm branch August 24, 2020 06:28
@greg0ire greg0ire added this to the 2.10.3 milestone Aug 24, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent parameter names
2 participants
0