Download the PHP package tombenevides/dump-linter without Composer
On this page you can find all versions of the php package tombenevides/dump-linter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tombenevides/dump-linter
More information about tombenevides/dump-linter
Files in tombenevides/dump-linter
Package dump-linter
Short Description A custom rules to remove dump functions from PHP code
License MIT
Informations about the package dump-linter
Sometimes you are debugging and end up deploying with your code a dump
or a var_dump
(if you're a Laravel dev, the infamous dd
) and that could be annoying, so Dump Linter is a package that complements PHP-CS-Fixer, providing a rule to remove dump statements from the source code.
❗ IMPORTANT: the rule is considered risky by PHP-CS-Fixer metrics because technically
dump
/var_dump
are not errors or bad writing, so be careful and use this rule if you're completely sure that you don't want them in the codebase.
REQUIREMENTS
HOW TO INSTALL
To install the package, just use composer:
HOW TO USE
Configuring PHP-CS-Fixer
After installing, you need to edit the .php-cs-fixer.dist.php
file (or the file that you're chose), adding the custom rule using registerCustomFixers()
function and then set the rule, as you can see below:
List of dump statements that will be removed:
dump()
,var_dump()
,dd()
,ray()
anddumps()
.
More info or questions about PHP-CS-Fixer configuration file, just check this link.
Running the linter with custom rule
Since this is a risky rule, the default command php-cs-fixer fix -v
will not work. Therefore, to allow the rule to make the expected changes, you need to give the linter permission to perform risky actions. You do this by adding the --allow-risky=yes
flag.
LICENSE
Dump Linter is a software under the MIT License
UPDATES
👋 Follow the author @devatreides on Twitter to know more about the last updates and other projects. Say Hi!