Skip to content

Commit

Permalink
[11.x] Add PDO subclass support for PHP 8.4 (#52538)
Browse files Browse the repository at this point in the history
* feat: add PDO subclass support for PHP 8.4

* chore: remove duplicate parentheses

Co-authored-by: Julius Kiekbusch <[email protected]>

* chore: ignore error as method is available in 8.4

---------

Co-authored-by: Julius Kiekbusch <[email protected]>
  • Loading branch information
ju5t and Jubeki authored Aug 22, 2024
1 parent cbaca59 commit 8a4a52e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Illuminate/Database/Connectors/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public function createConnection($dsn, array $config, array $options)
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
return new PDO($dsn, $username, $password, $options);
return version_compare(phpversion(), '8.4.0', '<')
? new PDO($dsn, $username, $password, $options)
: PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */
}

/**
Expand Down

0 comments on commit 8a4a52e

Please sign in to comment.