Skip to content

Commit 2e30fbc

Browse files
Douglasdc3JakubOnderka
authored andcommitted
Add laravel dump helper
Adds laravel `dump` helper method as one of the checks performed during the laravel preset. Resolves #29
1 parent c7b30cb commit 2e30fbc

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Options for run
4747
- `--zend` - check dump: `Zend_Debug::dump`, `\Zend\Debug\Debug::dump`
4848
- `--doctrine` - check dump: `Doctrine::dump`, `\Doctrine\Common\Util\Debug::dump`
4949
- `--symfony` - check dump: `dump`, `VarDumper::dump`, `VarDumper::setHandler`
50-
- `--laravel` - check dump: `dd`
50+
- `--laravel` - check dump: `dd`, `dump`
5151
- `--no-colors` - disable colors from output
5252
- `--exclude folder/` - exclude *folder/* from check
5353
- `--extensions php,phpt,php7` - map file extensions for check

src/Settings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Settings
2525
SYMFONY_VARDUMPER_DUMP_SHORTCUT = 'dump',
2626

2727
LARAVEL_DUMP_DD = 'dd',
28+
LARAVEL_DUMP = 'dump',
2829

2930
DOCTRINE_DUMP = 'Doctrine::dump',
3031
DOCTRINE_DUMP_2 = '\Doctrine\Common\Util\Debug::dump';
@@ -116,6 +117,7 @@ public static function parseArguments(array $arguments)
116117

117118
case '--laravel':
118119
$setting->functionsToCheck[] = self::LARAVEL_DUMP_DD;
120+
$setting->functionsToCheck[] = self::LARAVEL_DUMP;
119121
break;
120122

121123
case '--doctrine':

tests/JakubOnderka/PhpVarDumpCheck/LaravelTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function __construct()
1212
$settings = new PhpVarDumpCheck\Settings();
1313
$settings->functionsToCheck = array_merge($settings->functionsToCheck, array(
1414
PhpVarDumpCheck\Settings::LARAVEL_DUMP_DD,
15+
PhpVarDumpCheck\Settings::LARAVEL_DUMP,
1516
));
1617
$this->uut = new PhpVarDumpCheck\Checker($settings);
1718
}
@@ -22,6 +23,16 @@ public function testCheck_laravelDumpDd()
2223
$content = <<<PHP
2324
<?php
2425
dd(\$var);
26+
PHP;
27+
$result = $this->uut->check($content);
28+
$this->assertCount(1, $result);
29+
}
30+
31+
public function testCheck_laravelDump()
32+
{
33+
$content = <<<PHP
34+
<?php
35+
dump(\$var);
2536
PHP;
2637
$result = $this->uut->check($content);
2738
$this->assertCount(1, $result);

0 commit comments

Comments
 (0)