Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for PHP 8.4 #229

Merged
merged 5 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
operating-system:
- ubuntu-latest
php-version:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
srjlewis marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
],
"require": {
"php": ">=8.1",
"php": ">=8.4",
frederikbosch marked this conversation as resolved.
Show resolved Hide resolved
"psr/log": "^1.0 || ^2.0 || ^3.0",
"ext-pdo": "*"
},
Expand Down
10 changes: 2 additions & 8 deletions src/ExtendedPdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ public static function connect(
array $queries = [],
?ProfilerInterface $profiler = null
): static {
$pdo = new static($dsn, $username, $password, $options ?? [], $queries, $profiler);
$pdo->establishConnection();
return $pdo;
return new static($dsn, $username, $password, $options ?? [], $queries, $profiler);
}

/**
Expand All @@ -113,11 +111,7 @@ public function establishConnection(): void
// connect
$this->profiler->start(__FUNCTION__);
list($dsn, $username, $password, $options, $queries) = $this->args;
if(version_compare(phpversion(), '8.4.0', '<')) {
$this->pdo = new PDO($dsn, $username, $password, $options);
} else {
$this->pdo = PDO::connect($dsn, $username, $password, $options);
}
$this->pdo = PDO::connect($dsn, $username, $password, $options);
$this->profiler->finish();

// connection-time queries
Expand Down
11 changes: 11 additions & 0 deletions tests/ExtendedConnectPdoTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use Aura\Sql\ExtendedPdo;

class ExtendedConnectPdoTest extends \Aura\Sql\ExtendedPdoTest
{
protected function newPdo()
{
return ExtendedPdo::connect('sqlite::memory:');
}
}
Loading