-
-
Notifications
You must be signed in to change notification settings - Fork 507
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
Increase PHPStan's level #1803
Increase PHPStan's level #1803
Conversation
44832d2
to
90ecc0a
Compare
`string` is wrong as it can also be `null` or an `array`. Merging this (and tagging a new bugfix release) would help me with doctrine/mongodb-odm#1803 :)
Not sure about the history, but now we have an interface to "typehint" against. Also this merging this and releasing a new bugfix version will help me with doctrine/mongodb-odm#1803
`string` is wrong as it can also be `null` or an `array`. Merging this (and tagging a new bugfix release) would help me with doctrine/mongodb-odm#1803 :)
You can remove the As for the undefined Last but not least, the argument type mismatch doesn't make any sense. The typehint for |
Not sure about the history, but now we have an interface to "typehint" against. Also this merging this and releasing a new bugfix version will help me with doctrine/mongodb-odm#1803
PHPStan 0.10 was released. Maybe we should use it here? |
Heh I still need to fix stuff in other Doctrine packages :/ Maybe I can schedule some time tomorrow to get back to this, I'll see how much stuff needs to change with 0.10 |
@malarzm can you rebase and continue this or would you prefer me to take over? |
FWIW I'm trying to rebase this |
So this PR is again merge'able but I need to revisit all levels as I stopped fixing errors by 2nd one just to get through all the conflicts today. BTW @jmikola I've found interesting error that might be worth fixing in the driver (but not sure if it should so I'm not opening an issue there yet):
|
I can help with some of them, I think it's worth shipping finishing this before Beta-1. |
Reported the exception issue to the driver: mongodb/mongo-php-driver#940. In the meantime, we can just ignore the error entirely. |
357982c
to
a1f289c
Compare
Regarding assertions, we should make sure assertion checks are enabled on travis-ci to make sure we're triggering an error instead of using |
I finished up fixing stuff including level 7. @malarzm I think it'd be good if you could take a look at fixes from later commits. |
PR rebased to account for changes in |
LGTM 👍 |
`string` is wrong as it can also be `null` or an `array`. Merging this (and tagging a new bugfix release) would help me with doctrine/mongodb-odm#1803 :)
Leftovers for level 2:
@alcaeus I'm pretty sure I was asking you about it some time ago but I can't really remember the answer nor find anything useful on gitter...
Technically the method is there as it's inside of a path that checked for
__wakeup
existance. I was trying getting rid of it withassert(method_exists($proxy, '__wakeup')
to no avail. Ideas?To get to level 4 we need to fix Annotation's
$value
typehint as it hints againststring
while it can be anything:To deal with level 5 we again need to tweak Common stuff:
Also I have no clue so far why PHPStan is complaining about: