Skip to content

Commit 2f04cb7

Browse files
authored
Merge pull request #62 from williamdes/improvements-and-fixes
Improvements and fixes
2 parents c869bcb + 864b259 commit 2f04cb7

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

.github/workflows/php.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php-version: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
15+
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1616
name: PHP ${{ matrix.php-version }}
1717
steps:
1818
- uses: actions/checkout@v4
1919
- name: Validate composer.json and composer.lock
2020
run: composer validate
2121
- name: Cache Composer packages
2222
id: composer-cache
23-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2424
with:
2525
path: vendor
2626
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Limitations:
4141
This project should not be confused with `JsonSerializable` interface added on PHP 5.4. This interface is used on
4242
`json_encode` to encode the objects. There is no unserialization with this interface, differently from this project.
4343

44-
*Json Serializer requires PHP >= 7.0 and tested until PHP 8.2*
44+
*Json Serializer requires PHP >= 7.2 and tested until PHP 8.2*
4545

4646
## Example
4747

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
}
2020
],
2121
"require": {
22-
"php": "^7.0 || ^8.0",
22+
"php": "^7.2 || ^8.0",
2323
"ext-mbstring": "*"
2424
},
2525
"suggest": {
2626
"opis/closure": "Allow to serialize PHP closures"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": ">=6.0 <11.0"
29+
"phpunit/phpunit": ">=8 <12.0"
3030
},
3131
"autoload": {
3232
"psr-4": {

src/JsonSerializer/JsonSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ class JsonSerializer
7272
/**
7373
* Constructor.
7474
*
75-
* @param ClosureSerializerInterface $closureSerializer This parameter is deprecated and will be removed in 5.0.0. Use addClosureSerializer() instead.
75+
* @param ClosureSerializerInterface|null $closureSerializer This parameter is deprecated and will be removed in 5.0.0. Use addClosureSerializer() instead.
7676
* @param array $customObjectSerializerMap
7777
*/
7878
public function __construct(
79-
ClosureSerializerInterface $closureSerializer = null,
79+
?ClosureSerializerInterface $closureSerializer = null,
8080
$customObjectSerializerMap = []
8181
) {
8282
$this->closureManager = new ClosureSerializer\ClosureSerializerManager();

tests/JsonSerializerTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class JsonSerializerTest extends TestCase
2626
* @before
2727
* @return void
2828
*/
29+
#[\PHPUnit\Framework\Attributes\Before]
2930
public function setUpSerializer()
3031
{
3132
$customObjectSerializerMap['Zumba\\JsonSerializer\\Test\\SupportClasses\\MyType'] = new \Zumba\JsonSerializer\Test\SupportClasses\MyTypeSerializer();
@@ -40,6 +41,7 @@ public function setUpSerializer()
4041
* @param string $jsoned
4142
* @return void
4243
*/
44+
#[\PHPUnit\Framework\Attributes\DataProvider('scalarData')]
4345
public function testSerializeScalar($scalar, $jsoned)
4446
{
4547
$this->assertSame($jsoned, $this->serializer->serialize($scalar));
@@ -74,6 +76,7 @@ public function testSerializeFloatLocalized()
7476
* @param string $jsoned
7577
* @return void
7678
*/
79+
#[\PHPUnit\Framework\Attributes\DataProvider('scalarData')]
7780
public function testUnserializeScalar($scalar, $jsoned)
7881
{
7982
$this->assertSame($scalar, $this->serializer->unserialize($jsoned));
@@ -134,6 +137,7 @@ public function testSerializeClosureWithoutSerializer()
134137
* @param string $jsoned
135138
* @return void
136139
*/
140+
#[\PHPUnit\Framework\Attributes\DataProvider('arrayNoObjectData')]
137141
public function testSerializeArrayNoObject($array, $jsoned)
138142
{
139143
$this->assertSame($jsoned, $this->serializer->serialize($array));
@@ -147,6 +151,7 @@ public function testSerializeArrayNoObject($array, $jsoned)
147151
* @param string $jsoned
148152
* @return void
149153
*/
154+
#[\PHPUnit\Framework\Attributes\DataProvider('arrayNoObjectData')]
150155
public function testUnserializeArrayNoObject($array, $jsoned)
151156
{
152157
$this->assertSame($array, $this->serializer->unserialize($jsoned));

0 commit comments

Comments
 (0)