Skip to content

Commit

Permalink
no issue - PHP 8.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
pounard committed Nov 27, 2024
1 parent b3ef670 commit 0761fd3
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 28 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
postgres-version:
- "16"
extension:
Expand Down Expand Up @@ -68,7 +69,7 @@ jobs:
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--ignore-platform-req=php+"
Expand Down Expand Up @@ -132,7 +133,7 @@ jobs:
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--ignore-platform-req=php+"

Expand Down Expand Up @@ -195,7 +196,7 @@ jobs:
extensions: "${{ matrix.extension }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--ignore-platform-req=php+"

Expand Down Expand Up @@ -256,7 +257,7 @@ jobs:
extensions: "${{ matrix.extension }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--ignore-platform-req=php+"

Expand Down Expand Up @@ -314,7 +315,7 @@ jobs:
extensions: "${{ matrix.extension }}-5.10.0"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--ignore-platform-req=php+"

Expand Down Expand Up @@ -363,7 +364,7 @@ jobs:
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--ignore-platform-req=php+"

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Next

* [feature] ⭐️ PHP 8.4 support.

## 1.6.2

* [feature] ⭐️ Allow `Converter::fromSql()` `$type` parameter to be a user-given callback.
Expand Down
10 changes: 8 additions & 2 deletions dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GREEN='\033[0;32m'
NC='\033[0m' # No Color

# PHP version.
PHPVER="8-1"
PHPVER="8-4"
# Extra parameters passed to all docker command lines.
EXTRA_DOCKER_ENV=""

Expand All @@ -21,11 +21,17 @@ while getopts ":xp:l" opt; do
p)
p=${OPTARG}
case "${OPTARG}" in
"8.1")
PHPVER="8-1"
;;
"8.3")
PHPVER="8-3"
;;
"8.4")
PHPVER="8-4"
;;
*)
PHPVER="8-1"
PHPVER="8-4"
;;
esac
;;
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ services:
XDEBUG_MODE: "${XDEBUG_MODE:-debug}"
extra_hosts:
- "host.docker.internal:host-gateway"
phpunit-8-4:
build: ./docker/php-8.4
networks:
- query-builder-test
volumes:
- ./:/var/www
environment:
PHP_IDE_CONFIG: ${PHP_IDE_CONFIG:-serverName=docker}
XDEBUG_CONFIG: "client_host=host.docker.internal client_port=9000 log=/tmp/xdebug/xdebug.log output_dir=/tmp/xdebug start_with_request=trigger"
XDEBUG_MODE: "${XDEBUG_MODE:-debug}"
extra_hosts:
- "host.docker.internal:host-gateway"
mysql57:
image: mysql:5.7
restart: 'no'
Expand Down
4 changes: 2 additions & 2 deletions src/Bridge/AbstractBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function getDefaultSchema(): string
abstract protected function doExecuteQuery(string $expression, array $arguments = []): Result;

#[\Override]
public function executeQuery(string|Expression $expression = null, mixed $arguments = null): Result
public function executeQuery(null|string|Expression $expression = null, mixed $arguments = null): Result
{
if (\is_string($expression)) {
$expression = new Raw($expression, $arguments);
Expand All @@ -277,7 +277,7 @@ public function executeQuery(string|Expression $expression = null, mixed $argume
abstract protected function doExecuteStatement(string $expression, array $arguments = []): ?int;

#[\Override]
public function executeStatement(string|Expression $expression = null, mixed $arguments = null): ?int
public function executeStatement(null|string|Expression $expression = null, mixed $arguments = null): ?int
{
if (\is_string($expression)) {
$expression = new Raw($expression, $arguments);
Expand Down
4 changes: 2 additions & 2 deletions src/DatabaseSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ public function vendorVersionIs(string $version, string $operator = '>='): bool;
/**
* Execute query and return result.
*/
public function executeQuery(string|Expression $expression = null, mixed $arguments = null): Result;
public function executeQuery(null|string|Expression $expression = null, mixed $arguments = null): Result;

/**
* Execute query and return affected row count if possible.
*
* @return null|int
* Affected row count if applyable and driver supports it.
*/
public function executeStatement(string|Expression $expression = null, mixed $arguments = null): ?int;
public function executeStatement(null|string|Expression $expression = null, mixed $arguments = null): ?int;

/**
* Creates a new transaction.
Expand Down
2 changes: 1 addition & 1 deletion src/DefaultQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function delete(string|Expression $table, ?string $alias = null): Delete
}

#[\Override]
public function raw(string $expression = null, mixed $arguments = null, bool $returns = false): RawQuery
public function raw(null|string $expression = null, mixed $arguments = null, bool $returns = false): RawQuery
{
$ret = new RawQuery($expression, $arguments, $returns);
$this->prepareQuery($ret);
Expand Down
2 changes: 1 addition & 1 deletion src/Platform/Transaction/AbstractTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function deferred($constraint = null): static
}

#[\Override]
public function savepoint(string $name = null): TransactionSavepoint
public function savepoint(null|string $name = null): TransactionSavepoint
{
if (!$this->started) {
throw new TransactionError(\sprintf("can not commit a non-running transaction"));
Expand Down
4 changes: 2 additions & 2 deletions src/Query/Partial/FromClauseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ final public function leftJoin(string|Expression $table, $condition = null, ?str
/**
* Add inner statement and return the associated Where.
*/
final public function innerJoinWhere(string|Expression $table, string $alias = null): Where
final public function innerJoinWhere(string|Expression $table, null|string $alias = null): Where
{
return $this->joinWhere($table, $alias, Query::JOIN_INNER);
}

/**
* Add left outer join statement and return the associated Where.
*/
final public function leftJoinWhere(string|Expression $table, string $alias = null): Where
final public function leftJoinWhere(string|Expression $table, null|string $alias = null): Where
{
return $this->joinWhere($table, $alias, Query::JOIN_LEFT_OUTER);
}
Expand Down
2 changes: 1 addition & 1 deletion src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function delete(string|Expression $table, ?string $alias = null): Delete;
/**
* Create raw SQL query.
*/
public function raw(string $expression = null, mixed $arguments = null, bool $returns = false): RawQuery;
public function raw(null|string $expression = null, mixed $arguments = null, bool $returns = false): RawQuery;

/**
* Get the expression factory.
Expand Down
2 changes: 1 addition & 1 deletion src/Result/IterableResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class IterableResult extends AbstractResult
public function __construct(
iterable $data,
private ?int $rowCount = null,
callable $freeCallback = null,
null|callable $freeCallback = null,
) {
parent::__construct(false);

Expand Down
12 changes: 6 additions & 6 deletions src/Transaction/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@ public function start(): static;
/**
* Set as immediate all or a set of constraints.
*
* @param string|string[] $constraint
* @param null|string|string[] $constraint
* If set to null, all constraints are set immediate
* If a string or a string array, only the given constraint
* names are set as immediate.
*/
public function immediate(string|array $constraint = null): static;
public function immediate(null|string|array $constraint = null): static;

/**
* Defer all or a set of constraints.
*
* @param string|string[] $constraint
* @param null|string|string[] $constraint
* If set to null, all constraints are set immediate
* If a string or a string array, only the given constraint
* names are set as immediate.
*/
public function deferred(string|array $constraint = null): static;
public function deferred(null|string|array $constraint = null): static;

/**
* Creates a savepoint and return its name.
*
* @param string $name
* @param null|string $name
* Optional user given savepoint name, if none provided a name will be
* automatically computed using a serial.
*
Expand All @@ -64,7 +64,7 @@ public function deferred(string|array $constraint = null): static;
* @return TransactionSavepoint
* The nested transaction.
*/
public function savepoint(string $name = null): TransactionSavepoint;
public function savepoint(null|string $name = null): TransactionSavepoint;

/**
* Is transaction nested (ie. is a savepoint).
Expand Down
4 changes: 2 additions & 2 deletions src/Type/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function bool(): self
/**
* Padded fixed-with character string.
*/
public static function char(int $length = null): self
public static function char(null|int $length = null): self
{
return new self(internal: InternalType::CHAR, length: $length);
}
Expand All @@ -79,7 +79,7 @@ public static function dateInterval(): self
/**
* Decimal/numeric arbitrary precision numeric value.
*/
public static function decimal(?int $precision = null, int $scale = null): self
public static function decimal(null|int $precision = null, null|int $scale = null): self
{
return new self(internal: InternalType::DECIMAL, precision: $precision, scale: $scale);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Where.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function addNotExpression(mixed $expression): void
/**
* Add a single raw SQL expression.
*/
public function withRaw(string $expression, mixed $arguments = null): static
public function withRaw(null|string $expression, mixed $arguments = null): static
{
$this->addExpression(new Raw($expression, $arguments));

Expand Down
2 changes: 1 addition & 1 deletion src/Writer/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ protected function doFormatJoin(
array $join,
bool $transformFirstJoinAsFrom = false,
?string $fromPrefix = null,
Query $query = null
null|Query $query = null
): string {
if (!$join) {
return '';
Expand Down

0 comments on commit 0761fd3

Please sign in to comment.