Passed
Push — html ( 51e1ba...d230bc )
by Peter
02:59
created

Debug::prettyPrint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Helper;
6
7
class Debug
8
{
9
    /**
10
     * @param string $str
11
     * @param mixed  $val
12
     * @param mixed  ...$extra
13
     *
14
     * @return string
15
     */
16
    public static function prettyPrint(string $str, $val, ...$extra): string
17
    {
18
        return sprintf($str, print_r($val, true), ...$extra);
1 ignored issue
show
Bug introduced by
It seems like print_r($val, true) can also be of type true; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

18
        return sprintf($str, /** @scrutinizer ignore-type */ print_r($val, true), ...$extra);
Loading history...
19
    }
20
}
21