GitHub - php-parallel-lint/PHP-Var-Dump-Check: Find forgotten variables dump in PHP source code. (original) (raw)

PHP VarDump Check

PHP console application for find forgotten variable dump. Support PHP build in methodprint_r, var_dump and var_export method and also method from Tracy debugger, Ladybug, Symfony, Laravel, Doctrine and Zend Framework.

Install

Just create a composer.json file and run the php composer.phar install command to install it:

{ "require-dev": { "php-parallel-lint/php-var-dump-check": "~0.4" } }

For colored output install suggested package php-parallel-lint/php-console-highlighter.

Usage and example output

$ ./vendor/bin/var-dump-check --no-colors --tracy .
...................X...

Checked 23 files in 0.1 second, dump found in 1 file

------------------------------------------------------------
Forgotten dump 'var_dump' found in ./test.php:36
    34|         <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>f</mi><mi>u</mi><mi>n</mi><mi>c</mi><mi>t</mi><mi>i</mi><mi>o</mi><mi>n</mi><mi>s</mi><mi>T</mi><mi>o</mi><mi>C</mi><mi>h</mi><mi>e</mi><mi>c</mi><mi>k</mi><mo>=</mo></mrow><annotation encoding="application/x-tex">functionsToCheck = </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal">u</span><span class="mord mathnormal">n</span><span class="mord mathnormal">c</span><span class="mord mathnormal">t</span><span class="mord mathnormal">i</span><span class="mord mathnormal">o</span><span class="mord mathnormal">n</span><span class="mord mathnormal">s</span><span class="mord mathnormal" style="margin-right:0.13889em;">T</span><span class="mord mathnormal">o</span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span><span class="mord mathnormal">h</span><span class="mord mathnormal">ec</span><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span></span></span></span>this->prepareFunctionCheck($this->settings->functionsToCheck);
    35|
  > 36| 	    var_dump($functionsToCheck);
    37|
    38|         foreach ($tokens as <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi><mi>e</mi><mi>y</mi><mo>=</mo><mo>&gt;</mo></mrow><annotation encoding="application/x-tex">key =&gt; </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="mord mathnormal" style="margin-right:0.03588em;">ey</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=&gt;</span></span></span></span>token) {

Options for run

For run from command line:

$ ./vendor/bin/var-dump-check --symfony --exclude app --exclude vendor .

or setting for ANT:


Build Status Downloads this Month Latest stable