diff options
Diffstat (limited to 'vendor/doctrine/dbal/src/Exception/DriverRequired.php')
-rw-r--r-- | vendor/doctrine/dbal/src/Exception/DriverRequired.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Exception/DriverRequired.php b/vendor/doctrine/dbal/src/Exception/DriverRequired.php new file mode 100644 index 0000000..e37ac68 --- /dev/null +++ b/vendor/doctrine/dbal/src/Exception/DriverRequired.php | |||
@@ -0,0 +1,30 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\DBAL\Exception; | ||
6 | |||
7 | use function sprintf; | ||
8 | |||
9 | /** @psalm-immutable */ | ||
10 | final class DriverRequired extends InvalidArgumentException | ||
11 | { | ||
12 | /** @param string|null $url The URL that was provided in the connection parameters (if any). */ | ||
13 | public static function new(?string $url = null): self | ||
14 | { | ||
15 | if ($url !== null) { | ||
16 | return new self( | ||
17 | sprintf( | ||
18 | 'The options "driver" or "driverClass" are mandatory if a connection URL without scheme ' | ||
19 | . 'is given to DriverManager::getConnection(). Given URL "%s".', | ||
20 | $url, | ||
21 | ), | ||
22 | ); | ||
23 | } | ||
24 | |||
25 | return new self( | ||
26 | 'The options "driver" or "driverClass" are mandatory if no PDO ' | ||
27 | . 'instance is given to DriverManager::getConnection().', | ||
28 | ); | ||
29 | } | ||
30 | } | ||