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

2.9 BC Break on Doctrine\DBAL\Schema\Table method signatures #3380

Closed
ricardofiorani opened this issue Dec 4, 2018 · 11 comments · Fixed by #3392
Closed

2.9 BC Break on Doctrine\DBAL\Schema\Table method signatures #3380

ricardofiorani opened this issue Dec 4, 2018 · 11 comments · Fixed by #3392

Comments

@ricardofiorani
Copy link

Q A
BC Break yes
Version 2.9.0

Summary

Sorry if this is intended, but I couldn't find anywhere mentioning these changes on these Doctrine\DBAL\Schema\Table method signatures :

  • setPrimaryKey(int, string) -> setPrimaryKey(array)
  • addUniqueIndex(int, string) -> addUniqueIndex(array)
  • addIndex(int, string) -> addIndex(array)

I can drop a PR either reverting the method signature's back or update the docs if needed.

@Ocramius
Copy link
Member

Ocramius commented Dec 4, 2018

@ricardofiorani what version are you comparing this to? I don't see changes in those methods within the last year.

@ricardofiorani
Copy link
Author

@Ocramius from v2.8.0 to v2.9.0

@ricardofiorani
Copy link
Author

On my composer.json I was requiring it as "doctrine/dbal": "^2.8",

@ricardofiorani
Copy link
Author

@Ocramius

On the docblock:

2.9 * @param mixed[][] $columns
2.8 * @param array $columns

PHPStan don't like it :(

@Ocramius
Copy link
Member

Ocramius commented Dec 4, 2018

Yes, but this is correct: we just documented what the expected types are.

If those are not the parameters you were passing to it, then your application had a pre-existing bug in it.

@ricardofiorani
Copy link
Author

@Ocramius but by mixed[][] you are suggesting that it is a two level array, which is not the case in any of those methods... it should be mixed[] then.

@ricardofiorani
Copy link
Author

Anyway, I'll stick my application with 2.8 until I have some more time to dig into this.

Thank you for your responses.

@Ocramius
Copy link
Member

Ocramius commented Dec 4, 2018

@ricardofiorani send a patch to fix the types there then - running phpstan on that file (specifically) will likely reveal more issues that we haven't inspected yet 👍

@morozov
Copy link
Member

morozov commented Dec 4, 2018

We probably need to fix parameter names as well. In most cases, $columns is mixed[][] which is an array of column definitions, which are arrays themselves. In the case of setPrimaryKey(), it should have been $columnNames, same as in addIndex().

@morozov morozov reopened this Dec 4, 2018
@morozov morozov added this to the 2.9.1 milestone Dec 4, 2018
@morozov morozov removed the Invalid label Dec 6, 2018
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants