Skip to content

Commit

Permalink
Merge pull request #62 from williamdes/improvements-and-fixes
Browse files Browse the repository at this point in the history
Improvements and fixes
  • Loading branch information
jrbasso authored Dec 11, 2024
2 parents c869bcb + 864b259 commit 2f04cb7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ 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
- name: Validate composer.json and composer.lock
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') }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
}
],
"require": {
"php": "^7.0 || ^8.0",
"php": "^7.2 || ^8.0",
"ext-mbstring": "*"
},
"suggest": {
"opis/closure": "Allow to serialize PHP closures"
},
"require-dev": {
"phpunit/phpunit": ">=6.0 <11.0"
"phpunit/phpunit": ">=8 <12.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/JsonSerializer/JsonSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions tests/JsonSerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit 2f04cb7

Please sign in to comment.