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

Refactored MySQLiStatement::$columnNames #3817

Merged

Conversation

morozov
Copy link
Member

@morozov morozov commented Jan 11, 2020

Q A
Type improvement
BC Break yes
Fixed issues Scrutinizer
Depends on #3590

The $columnNames property has a too complex type string[]|false|null which leads to:

  1. Non-trivial to understand conditions like if ($columnNames === false), if ($columnNames === true).
  2. Avoidable assertions assert(is_array($columnNames)).
  3. Avoidable false-positives on Scrutinizer that thinks that $columnNames can be TRUE.

Making this a non-breaking change requires resolving #3590 first since it declares the MysqliStatement class final.

@Ocramius
Copy link
Member

Looking good! What is still WIP about this?

@morozov
Copy link
Member Author

morozov commented Jan 12, 2020

Nothing about this one specifically. Let me merge #3590 and rebase this one.

@morozov morozov force-pushed the refactor-mysql-statement-column-names branch from 5255ecd to 6040522 Compare January 12, 2020 01:20
The `$columnNames` property has a too complex type `string[]|false|null` which leads to:

1. Non-trivial to understand conditions and assertions like `if ($columnNames === false)`, `if ($columnNames === true)` and `assert(is_array($columnNames))`.
2. Avoidable [false-positives](https://scrutinizer-ci.com/g/doctrine/dbal/inspections/20d1aea4-2217-4f38-8adc-5ce10fa9cf0b/issues/files/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php?status=new&orderField=path&order=asc&honorSelectedPaths=0) on Scrutinizer that thinks that `$columnNames` can be TRUE.
@morozov morozov force-pushed the refactor-mysql-statement-column-names branch from 6040522 to e4c37f5 Compare January 12, 2020 01:23
@morozov morozov removed the WIP label Jan 12, 2020
@morozov morozov requested a review from Ocramius January 12, 2020 01:55
@Ocramius Ocramius self-assigned this Jan 12, 2020
@Ocramius Ocramius merged commit bfc8bb9 into doctrine:master Jan 12, 2020
@morozov morozov deleted the refactor-mysql-statement-column-names branch January 12, 2020 17:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 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.

2 participants