codeguy / php-the-right-way

An easy-to-read, quick reference for PHP best practices, accepted coding standards, and links to authoritative tutorials around the Web
https://www.phptherightway.com
Other
9.05k stars 3.24k forks source link

[suggestion] Code quality #612

Open ftwbzhao opened 8 years ago

ftwbzhao commented 8 years ago
codeguy commented 6 years ago

Agreed. Will work on getting this started shortly.

ariaieboy commented 2 years ago

any update about this ? i think in modern PHP era we should use static analyzers for having a really better code quality. some of the great packagees in this section is :

https://github.com/phpstan/phpstan https://github.com/nunomaduro/larastan https://github.com/vimeo/psalm https://github.com/phan/phan

JonisoftGermany commented 2 years ago

Hi everybody, code quality is a very important topic. It contains so many more aspects than mentioned here before.

For me it starts with an IDE, which provides syntax highlighting. Many of you might not think that there are some people around, which still use an unmodified VIM or editor (windows) or textedit (mac os) without any hinting. But there are! Many! I do not know if you want to mention commercial products besides open source IDE. So I will not go into detail, which IDE I am using to not influence this discussion to one direction.

IDE usually allows plug-ins. They can provide so much more detailed checking than just syntax checking. The plug-in I really really recommend is PHP Inspections EA ( https://github.com/kalessil/phpinspectionsea ). Also PhpClean is on my list ( https://plugins.jetbrains.com/plugin/11272-phpclean ).

The problem with deep code inspection tools in IDE or static analyzers is that it provides good feedback for experienced developers. Beginners might enable all levels and try to fight all notices. By clearing issue by issue beginners might not solve the architectural mistakes behind it. Personally I am struggling with naming a static analyzer "a tool for everybody". They are easy to use - Yes. They provide helpful hints for everybody - Yes. But the conclusion of using a static analyzer cannot be to solve every displayed error without architectural changes.

Here is my recommendation for changes:

If you consider these or familiar changes, I would love to support you by writing a draft. What do you think?