![]() Nevertheless here some handly links to Jetbrain’s documentation: Since I don’t use PhpStorm anymore, I won’t explain how to install these tools in the IDE. As a reference you can consult my neomake config file. You can even create your own makers to use every php code quality tools you want. It will display in the gutter warnings and errors. With the plugin neomake you can plug easily PHPMD, PHPSTAN and PHPCS to Vim. You can easily configure in Vim every tools you want and let them parse your open files. Every examples assume that your codebase is in the folder src. I advise you to call the tools from the main folder of your project. I describe this process for every tools in this article. Most of the time you just need to pass the codebase’s path as an argument and voila! How to Use the Tools In Your TerminalĪll the tools can be used in the terminal. You can refer to the documentation of each tools to have every possible ways of installing them. You can as well use the PHAR format, in most cases. My personal preference is to use composer’s global package installation using cgr to avoid dependency problems on the global scope. There are always multiple ways to install the tools described here. If you are already bored by this article and just want to see a plain PHP tools list, you can directly go to the reference list at the end.Ī last thing before diving in: tools presented in this article analyse or format your code, I won’t speak about testing. As often, it depends largely on the context: is your codebase large? Is there a good reason the cyclomatic complexity is high for some function? It can help your colleagues detect defects in the codebase and teach them some key concepts.ĭon’t forget however that the advice and the data they can provide won’t be appropriate everywhere. You’ve got the good approach dear reader: code quality tools are essential to write solid and error-free PHP code. Then, you decide to introduce to your team some code quality tools. With a calm worthy of a Zen monk, you first fix the bug driving your boss crazy with Dave’s help. Teaching instead of blaming always give better results. However, since you are such a respectful human being, you know it’s not a good solution. You could ask Dave to come to your desk, yelling at him that you never saw anywhere such a crappy code, cursing him and his family for generations to come. ![]() Shacking, you open the unit tests to understand how it should work… but they don’t exist. There are so many dependencies you need to scroll down for minutes to escape the bloated constructor. The classes are full of formatting errors, poor indentation and weird one letter variables. They were coded by Dave, your colleague developer. , updated Twitter #PHP #Complexity PHP Code Quality Tools to Check and Improve your Code ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |