Passed
Push — master ( 4c9e55...edca11 )
by Evert
03:38
created

ddl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
nc 2
nop 2
dl 0
loc 9
rs 10
c 1
b 0
f 0
1
<?php
2
3
if (!function_exists('ddl')) {
4
    function ddl($var, ...$moreVars)
5
    {
6
        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
7
        if (php_sapi_name() == 'cli') {
8
            print_r("\e[1;30m dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "\e[40m\n");
9
        } else {
10
            print_r("[dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "]\n");
11
        }
12
        return dd($var, ...$moreVars);
0 ignored issues
show
Bug introduced by
Are you sure the usage of dd($var, $moreVars) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
13
    }
14
}