From c0b75a35290c56ee07f89a693f457debfa70e36a Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 11 Dec 2024 02:04:06 +0100 Subject: [PATCH 1/5] Require PHP 7.2 --- README.md | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3fc9900..61d81fd 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Limitations: This project should not be confused with `JsonSerializable` interface added on PHP 5.4. This interface is used on `json_encode` to encode the objects. There is no unserialization with this interface, differently from this project. -*Json Serializer requires PHP >= 7.0 and tested until PHP 8.2* +*Json Serializer requires PHP >= 7.2 and tested until PHP 8.2* ## Example diff --git a/composer.json b/composer.json index 6653a83..a41a695 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } ], "require": { - "php": "^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "ext-mbstring": "*" }, "suggest": { From 5e73834fc87f185c2a95e6f47778151e84f10b20 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 11 Dec 2024 02:05:36 +0100 Subject: [PATCH 2/5] Support PHPUnit 11 and drop PHPUnit 6 & 7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a41a695..1726403 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "opis/closure": "Allow to serialize PHP closures" }, "require-dev": { - "phpunit/phpunit": ">=6.0 <11.0" + "phpunit/phpunit": ">=8 <12.0" }, "autoload": { "psr-4": { From ccf71645ed0db4a13ad4cbbe6f4fdf3ffd2f428a Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 11 Dec 2024 02:06:47 +0100 Subject: [PATCH 3/5] Adjust the CI for PHP versions + Bump actions/cache --- .github/workflows/php.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 9088dae..a3eddf3 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] name: PHP ${{ matrix.php-version }} steps: - uses: actions/checkout@v4 @@ -20,7 +20,7 @@ jobs: run: composer validate - name: Cache Composer packages id: composer-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} From 64c9bf9cd25ca33332d1998fd70757a51c59c1e2 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 11 Dec 2024 02:12:07 +0100 Subject: [PATCH 4/5] Fix #61 - Mark implicit nullable as explicitly nullable Fixes: #61 --- src/JsonSerializer/JsonSerializer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/JsonSerializer/JsonSerializer.php b/src/JsonSerializer/JsonSerializer.php index 1d51814..040fa8e 100644 --- a/src/JsonSerializer/JsonSerializer.php +++ b/src/JsonSerializer/JsonSerializer.php @@ -72,11 +72,11 @@ class JsonSerializer /** * Constructor. * - * @param ClosureSerializerInterface $closureSerializer This parameter is deprecated and will be removed in 5.0.0. Use addClosureSerializer() instead. + * @param ClosureSerializerInterface|null $closureSerializer This parameter is deprecated and will be removed in 5.0.0. Use addClosureSerializer() instead. * @param array $customObjectSerializerMap */ public function __construct( - ClosureSerializerInterface $closureSerializer = null, + ?ClosureSerializerInterface $closureSerializer = null, $customObjectSerializerMap = [] ) { $this->closureManager = new ClosureSerializer\ClosureSerializerManager(); From 864b2599cf62118084bdcf6e485de4abdae761fe Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 11 Dec 2024 02:16:28 +0100 Subject: [PATCH 5/5] Add PHPUnit 11 attributes --- tests/JsonSerializerTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/JsonSerializerTest.php b/tests/JsonSerializerTest.php index 6889e17..9642a3a 100644 --- a/tests/JsonSerializerTest.php +++ b/tests/JsonSerializerTest.php @@ -26,6 +26,7 @@ class JsonSerializerTest extends TestCase * @before * @return void */ + #[\PHPUnit\Framework\Attributes\Before] public function setUpSerializer() { $customObjectSerializerMap['Zumba\\JsonSerializer\\Test\\SupportClasses\\MyType'] = new \Zumba\JsonSerializer\Test\SupportClasses\MyTypeSerializer(); @@ -40,6 +41,7 @@ public function setUpSerializer() * @param string $jsoned * @return void */ + #[\PHPUnit\Framework\Attributes\DataProvider('scalarData')] public function testSerializeScalar($scalar, $jsoned) { $this->assertSame($jsoned, $this->serializer->serialize($scalar)); @@ -74,6 +76,7 @@ public function testSerializeFloatLocalized() * @param string $jsoned * @return void */ + #[\PHPUnit\Framework\Attributes\DataProvider('scalarData')] public function testUnserializeScalar($scalar, $jsoned) { $this->assertSame($scalar, $this->serializer->unserialize($jsoned)); @@ -134,6 +137,7 @@ public function testSerializeClosureWithoutSerializer() * @param string $jsoned * @return void */ + #[\PHPUnit\Framework\Attributes\DataProvider('arrayNoObjectData')] public function testSerializeArrayNoObject($array, $jsoned) { $this->assertSame($jsoned, $this->serializer->serialize($array)); @@ -147,6 +151,7 @@ public function testSerializeArrayNoObject($array, $jsoned) * @param string $jsoned * @return void */ + #[\PHPUnit\Framework\Attributes\DataProvider('arrayNoObjectData')] public function testUnserializeArrayNoObject($array, $jsoned) { $this->assertSame($array, $this->serializer->unserialize($jsoned));