Database::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Exception;
6
7
use RuntimeException;
8
use Throwable;
9
10
class Database extends RuntimeException
11
{
12
    /**
13
     * Database constructor.
14
     *
15
     * @param array          $errorInfo
16
     * @param Throwable|null $previous
17
     */
18
    public function __construct(
19
        array $errorInfo = [],
20
        Throwable $previous = null
21
    ) {
22
        $message = $errorInfo[2] ?? print_r($errorInfo, true);
23
        $code    = $errorInfo[1] ?? 0;
24
25
        parent::__construct($message, $code, $previous);
0 ignored issues
show
Bug introduced by
It seems like $message can also be of type true; however, parameter $message of Exception::__construct() does only seem to accept 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

25
        parent::__construct(/** @scrutinizer ignore-type */ $message, $code, $previous);
Loading history...
26
    }
27
}
28