laminas / laminas-mvc

Laminas's event-driven MVC layer, including MVC Applications, Controllers, and Plugins
https://docs.laminas.dev/laminas-mvc/
BSD 3-Clause "New" or "Revised" License
141 stars 51 forks source link

PHPStan fixes #9

Closed weierophinney closed 4 years ago

weierophinney commented 4 years ago

In order to bump to PHP 7 minimum version in the future, I used phpstan to static analyse the code, correcting some phpdoc errors and adding guards throwing exceptions when needed. Code quality will be improved when other components will be improved.

It's just a first step, but I think it will be useful.

I don't know if this could be considered a BC break, probably it isn't.


Originally posted by @thomasvargiu at https://github.com/zendframework/zend-mvc/pull/296

weierophinney commented 4 years ago

@Ocramius I can add phpstan on CI, but just a low level. Too many errors depends on other libraries.


Originally posted by @thomasvargiu at https://github.com/zendframework/zend-mvc/pull/296#issuecomment-429845580

weierophinney commented 4 years ago

@thomasvargiu that's fine - we can raise the level as we get better


Originally posted by @Ocramius at https://github.com/zendframework/zend-mvc/pull/296#issuecomment-429848539

weierophinney commented 4 years ago

@thomasvargiu btw, I still suggest getting rid of all the throw new SomeException($someString), and having throw SomeException::unexpectedType($expected, $actual) instead


Originally posted by @Ocramius at https://github.com/zendframework/zend-mvc/pull/296#issuecomment-429881636

weierophinney commented 4 years ago

@Ocramius I'm still working on this. I set this PR as WIP


Originally posted by @thomasvargiu at https://github.com/zendframework/zend-mvc/pull/296#issuecomment-429882201

weierophinney commented 4 years ago

Done. Needs a complete review


Originally posted by @thomasvargiu at https://github.com/zendframework/zend-mvc/pull/296#issuecomment-429959339

samsonasik commented 4 years ago

Based on this https://github.com/laminas/technical-steering-committee/blob/429d1c7cd38bebd45aff08bfd61618726d9c6b03/meetings/minutes/2020-08-03-TSC-Minutes.md#vote-on-static-analysis-tooling , we are going to use psalm.

I am closing this.