{"repo":"povils/phpmnd","free":true,"listed":false,"github":"https://github.com/povils/phpmnd","clone":"git clone https://github.com/povils/phpmnd.git","description":"PHP Magic Number Detector","language":"PHP","stars":586,"topics":["php","cli","automation","static-analysis","magic-numbers","clean-code","detector","analysis","checker"],"license":"MIT","category":"workflow-automation","readme_excerpt":"PHP Magic Number Detector (PHPMND) phpmnd is a tool that aims to help you to detect magic numbers in your PHP code. By default 0 and 1 are not considered to be magic numbers. What is a magic number? A magic number is a numeric literal that is not defined as a constant, but which may change at a later stage, and therefore can be hard to update. It's considered a bad programming practice to use numbers directly in any source code without an explanation. In most cases this makes programs harder to read, understand, and maintain. Consider the following hypothetical code: which should be refactored to: This clearly improves the code readability and also reduces its maintenance cost. Of course not every literal number is a magic number. Surely in this case the number 2 is not a magic number. My rule of thumb: Installation Locally You can add this tool as a local, per-project, development dependency to your project by using Composer: Afterwards you can then invoke it using the vendor/bin/phpmnd executable. Globally To install it globally simply run: Afterwards make sure you have the global Composer binaries directory in your PATH . Example for some Unix systems: Usage Example Demo Basic usage The --allow-array-mapping option allow keys as strings when using \"array\" extension. The --exclude-file option will exclude a file from the code analysis. Multiple values are allowed. The --exclude-path option will exclude a path, which must be relative to the source, from the code analysis. Mu","default_branch":null,"files":null,"tree":[],"storefront":"/r/povils","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/povils/phpmnd/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}