Any other #php nerds out there ... ?
(In our team... We do mostly e-commerce #dev )
I'm learning #phpstan ...
Any hints are more than welcomed!
If you are... How are you using it ?
Reading my colleague Maurits #blog post on ...
https://tqdev.com/2022-phpstan-find-bugs-without-writing-tests
@jla I work for one of the biggest US shopping sites (RetailMeNot) with mostly a PHP backend (along with Python) and we use PHPStan as part of our development process — cannot merge in code changes if they fail analysis. Helps us to make the intent of our code very clear
@grmpyprogrammer @jla oh wow, I forgot about RetailMeNot. I think I did some web design work for them back in like... 2010-11.
@jla I don't know what sort of hints you expect with regard to PHPStan. My hint: at least try starting one new project with the maximum PHPStan level. It might be very annoying in some cases, like when you're passing and processing arrays, but it being annoying may push you towards using data objects where possible instead, and that would be a good thing.
Other than that – well, whichever level you choose, hook it into pull request review process and require all PRs to pass its analysis.
@rq @jla
Yup. Also, phpstan has useful plugins (e.g. I use a plugin that analyzes the Symfony container and makes sure your service references are accessible, a plugin that analyzes your Doctrine entities and query builders, a plugin that finds awkward phpunit assertions, a plugin that flags messy code as a direct replacement for phpmd… ) — worth investigating those.