From fc95ac842238e6e58afc626bd1f0bd5de21e795f Mon Sep 17 00:00:00 2001 From: Tom Kay Date: Fri, 6 Nov 2026 11:25:16 +0000 Subject: [PATCH] Run tests on PHP 7.4 and fix jsonSerialize on PHP 7 jsonSerialize() declared a `mixed` return type, which PHP 7 reads as a class name, so json_encode() of any DAO or collection threw a TypeError. Drop the native type; #[\ReturnTypeWillChange] keeps 8.1+ quiet. Add 7.4 to the test matrix and bump actions/checkout to v7. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/php-test.yml | 3 ++- src/Foundation/AbstractDao.php | 2 +- src/Foundation/DaoCollection.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index c51361e..76003b2 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -16,6 +16,7 @@ jobs: fail-fast: false matrix: php-version: + - "7.4" - "8.0" - "8.1" - "8.2" @@ -49,7 +50,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Setup MySQL run: | diff --git a/src/Foundation/AbstractDao.php b/src/Foundation/AbstractDao.php index 0cc22d2..3d00ff8 100644 --- a/src/Foundation/AbstractDao.php +++ b/src/Foundation/AbstractDao.php @@ -424,7 +424,7 @@ public function getId($forceArray = false) * which is a value of any type other than a resource. */ #[\ReturnTypeWillChange] - public function jsonSerialize(): mixed + public function jsonSerialize() { return Objects::propertyValues($this); } diff --git a/src/Foundation/DaoCollection.php b/src/Foundation/DaoCollection.php index a1745eb..c287614 100644 --- a/src/Foundation/DaoCollection.php +++ b/src/Foundation/DaoCollection.php @@ -314,7 +314,7 @@ public function offsetUnset($offset) * which is a value of any type other than a resource. */ #[\ReturnTypeWillChange] - public function jsonSerialize(): mixed + public function jsonSerialize() { $this->_prepareDaos(); if($this->isEmpty())