diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f60e71d..eb08ee2 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -34,6 +34,7 @@ jobs: - "8.1" - "8.2" - "8.3" + - "8.4" postgres-version: - "16" extension: @@ -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+" @@ -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+" @@ -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+" @@ -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+" @@ -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+" @@ -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+" diff --git a/CHANGELOG.md b/CHANGELOG.md index 188d6c1..7f7528e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/dev.sh b/dev.sh index 771bcc7..a9e6eb2 100755 --- a/dev.sh +++ b/dev.sh @@ -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="" @@ -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 ;; diff --git a/docker-compose.yaml b/docker-compose.yaml index 40a2c54..08d741a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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' diff --git a/src/Bridge/AbstractBridge.php b/src/Bridge/AbstractBridge.php index d83a103..d0d1801 100644 --- a/src/Bridge/AbstractBridge.php +++ b/src/Bridge/AbstractBridge.php @@ -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); @@ -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); diff --git a/src/DatabaseSession.php b/src/DatabaseSession.php index 1d0c27b..de1d928 100644 --- a/src/DatabaseSession.php +++ b/src/DatabaseSession.php @@ -74,7 +74,7 @@ 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. @@ -82,7 +82,7 @@ public function executeQuery(string|Expression $expression = null, mixed $argume * @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. diff --git a/src/DefaultQueryBuilder.php b/src/DefaultQueryBuilder.php index b1be012..d43814d 100644 --- a/src/DefaultQueryBuilder.php +++ b/src/DefaultQueryBuilder.php @@ -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); diff --git a/src/Platform/Transaction/AbstractTransaction.php b/src/Platform/Transaction/AbstractTransaction.php index 94723d4..a21506a 100644 --- a/src/Platform/Transaction/AbstractTransaction.php +++ b/src/Platform/Transaction/AbstractTransaction.php @@ -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")); diff --git a/src/Query/Partial/FromClauseTrait.php b/src/Query/Partial/FromClauseTrait.php index da5c560..0c3082f 100644 --- a/src/Query/Partial/FromClauseTrait.php +++ b/src/Query/Partial/FromClauseTrait.php @@ -109,7 +109,7 @@ 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); } @@ -117,7 +117,7 @@ final public function innerJoinWhere(string|Expression $table, string $alias = n /** * 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); } diff --git a/src/QueryBuilder.php b/src/QueryBuilder.php index 36b5802..44db29c 100644 --- a/src/QueryBuilder.php +++ b/src/QueryBuilder.php @@ -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. diff --git a/src/Result/IterableResult.php b/src/Result/IterableResult.php index 5948c68..00f6c07 100644 --- a/src/Result/IterableResult.php +++ b/src/Result/IterableResult.php @@ -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); diff --git a/src/Transaction/Transaction.php b/src/Transaction/Transaction.php index 5d9c8a1..f6deae9 100644 --- a/src/Transaction/Transaction.php +++ b/src/Transaction/Transaction.php @@ -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. * @@ -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). diff --git a/src/Type/Type.php b/src/Type/Type.php index 0454493..05b71dd 100644 --- a/src/Type/Type.php +++ b/src/Type/Type.php @@ -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); } @@ -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); } diff --git a/src/Where.php b/src/Where.php index de55162..2839296 100644 --- a/src/Where.php +++ b/src/Where.php @@ -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)); diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php index e9cb594..474250f 100644 --- a/src/Writer/Writer.php +++ b/src/Writer/Writer.php @@ -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 '';