diff --git a/src/Phinx/Db/Adapter/PdoAdapter.php b/src/Phinx/Db/Adapter/PdoAdapter.php index 52ba4d77d..872950416 100644 --- a/src/Phinx/Db/Adapter/PdoAdapter.php +++ b/src/Phinx/Db/Adapter/PdoAdapter.php @@ -98,7 +98,7 @@ protected function createPdoConnection(string $dsn, ?string $username = null, ?s throw new InvalidArgumentException(sprintf( 'There was a problem connecting to the database: %s', $e->getMessage() - ), $e->getCode(), $e); + ), 0, $e); } return $db; diff --git a/src/Phinx/Db/Adapter/PostgresAdapter.php b/src/Phinx/Db/Adapter/PostgresAdapter.php index e220a53ed..c3e459bde 100644 --- a/src/Phinx/Db/Adapter/PostgresAdapter.php +++ b/src/Phinx/Db/Adapter/PostgresAdapter.php @@ -94,7 +94,7 @@ public function connect(): void } catch (PDOException $exception) { throw new InvalidArgumentException( sprintf('Schema does not exists: %s', $options['schema']), - $exception->getCode(), + 0, $exception ); } diff --git a/src/Phinx/Db/Adapter/SqlServerAdapter.php b/src/Phinx/Db/Adapter/SqlServerAdapter.php index 7565aa045..b72e0cc1c 100644 --- a/src/Phinx/Db/Adapter/SqlServerAdapter.php +++ b/src/Phinx/Db/Adapter/SqlServerAdapter.php @@ -152,7 +152,7 @@ protected function connectDblib(): void throw new InvalidArgumentException(sprintf( 'There was a problem connecting to the database: %s', $exception->getMessage() - )); + ), 0, $exception); } $this->setConnection($db);