Skip to content

Commit

Permalink
Merge pull request #255 from nextras/php8.4
Browse files Browse the repository at this point in the history
Fixes for PHP 8.4
  • Loading branch information
hrach authored Nov 9, 2024
2 parents 0256d6e + bcb1373 commit 8f2e51c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
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.7",
"phpstan/phpstan-deprecation-rules": "1.2.1",
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

0 comments on commit 8f2e51c

Please sign in to comment.