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

Fixes for PHP 8.4 #255

Merged
merged 5 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
php-version: [ '8.1', '8.2', '8.3', '8.4' ]

steps:
- name: Checkout
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
php-version: [ '8.1', '8.2', '8.3', '8.4' ]

runs-on: ubuntu-latest

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"nette/tester": "~2.4",
"nette/caching": "~3.0",
"nette/di": "~3.0",
"nette/utils": "~3.0",
"nette/finder": "~2.5",
"nette/utils": "~3.0 || ~4.0",
"nette/finder": "~2.5 || ~3.0",
"nette/neon": "~3.0",
"nextras/multi-query-parser": "1.0.0",
"nextras/multi-query-parser": "~1.0",
"phpstan/extension-installer": "1.4.3",
"phpstan/phpstan": "1.12.6",
"phpstan/phpstan-deprecation-rules": "1.1.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getName()
}


public function collect(Request $request, Response $response, \Throwable $exception = null): void
public function collect(Request $request, Response $response, \Throwable|null $exception = null): void
{
foreach ($this->queries as [$sqlQuery, $timeTaken, $rowsCount]) {
$row = [
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Exception/DriverException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct(
string $message,
private readonly int $errorCode = 0,
private readonly string $errorSqlState = '',
Exception $previousException = null
Exception|null $previousException = null
)
{
parent::__construct($message, 0, $previousException);
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Exception/QueryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct(
string $message,
int $errorCode = 0,
string $errorSqlState = '',
Exception $previousException = null,
Exception|null $previousException = null,
private readonly ?string $sqlQuery = null
)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Exception/UnknownMysqlTimezoneException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct(
string $message,
int $errorCode = 0,
string $errorSqlState = '',
Exception $previousException = null,
Exception|null $previousException = null,
?string $sqlQuery = null,
)
{
Expand Down
8 changes: 6 additions & 2 deletions src/Drivers/Mysqli/MysqliDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,12 @@ public function getServerVersion(): string
public function ping(): bool
{
$this->checkConnection();
assert($this->connection !== null);
return $this->connection->ping();
try {
$this->query('SELECT 1');
return true;
} catch (DriverException) {
return false;
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Mysqli/MysqliResultNormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function resolve(array $types): array
static $ints = [
MYSQLI_TYPE_BIT => true,
MYSQLI_TYPE_INT24 => true,
MYSQLI_TYPE_INTERVAL => true,
MYSQLI_TYPE_ENUM => true,
MYSQLI_TYPE_TINY => true,
MYSQLI_TYPE_SHORT => true,
MYSQLI_TYPE_LONG => true,
Expand Down
Loading