1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\DBAL\Driver\IBMDB2\Exception;
6
7use Doctrine\DBAL\Driver\IBMDB2\DB2Exception;
8
9/**
10 * @internal
11 *
12 * @psalm-immutable
13 */
14final class CannotCopyStreamToStream extends DB2Exception
15{
16    /**
17     * @psalm-param array{message: string}|null $error
18     */
19    public static function new(?array $error): self
20    {
21        $message = 'Could not copy source stream to temporary file';
22
23        if ($error !== null) {
24            $message .= ': ' . $error['message'];
25        }
26
27        return new self($message);
28    }
29}
30