Issues (43)

src/Exception/Exception.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Exception;
6
7
use Stringable;
8
9
/**
10
 * Represents an exception that's caused by some DB-related operations.
11
 *
12
 * It provides more information about the error that's caused by the exception.
13
 */
14
class Exception extends \Exception implements Stringable
15
{
16
    public function __construct(string $message, public array|null $errorInfo = [], \Exception $previous = null)
17
    {
18 261
        parent::__construct($message, 0, $previous);
19
    }
20 261
21 261
    /**
22 261
     * @return string Readable representation of exception.
23
     */
24
    public function __toString(): string
25
    {
26
        return parent::__toString() . PHP_EOL . 'Additional Information:' . PHP_EOL . print_r($this->errorInfo, true);
0 ignored issues
show
Are you sure print_r($this->errorInfo, true) of type string|true can be used in concatenation? ( Ignorable by Annotation )

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

26
        return parent::__toString() . PHP_EOL . 'Additional Information:' . PHP_EOL . /** @scrutinizer ignore-type */ print_r($this->errorInfo, true);
Loading history...
27 5
    }
28
}
29