Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 6f357af

Browse files
committed
php 8.4 and phpunit 11
1 parent 6c61bd1 commit 6f357af

File tree

14 files changed

+75
-67
lines changed

14 files changed

+75
-67
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,41 @@ on:
66
- cron: '0 0 * * *'
77

88
jobs:
9-
php81:
10-
name: PHP 8.1
11-
runs-on: ubuntu-22.04
9+
php82:
10+
name: PHP 8.2
11+
runs-on: ubuntu-24.04
1212
steps:
1313
- name: checkout
1414
uses: actions/checkout@v4
1515
- name: composer test
16-
uses: docker://ghcr.io/chubbyphp/ci-php81:latest
16+
uses: docker://ghcr.io/chubbyphp/ci-php82:latest
1717
env:
1818
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1919
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
20-
php82:
21-
name: PHP 8.2
22-
runs-on: ubuntu-22.04
20+
php83:
21+
name: PHP 8.3
22+
runs-on: ubuntu-24.04
2323
steps:
2424
- name: checkout
2525
uses: actions/checkout@v4
2626
- name: composer test
27-
uses: docker://ghcr.io/chubbyphp/ci-php82:latest
27+
uses: docker://ghcr.io/chubbyphp/ci-php83:latest
2828
env:
2929
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
31-
php83:
32-
name: PHP 8.3
33-
runs-on: ubuntu-22.04
31+
php84:
32+
name: PHP 8.4
33+
runs-on: ubuntu-24.04
3434
steps:
3535
- name: checkout
3636
uses: actions/checkout@v4
3737
- name: composer test
38-
uses: docker://ghcr.io/chubbyphp/ci-php83:latest
38+
uses: docker://ghcr.io/chubbyphp/ci-php84:latest
3939
env:
4040
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4141
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
4242
- name: sonarcloud.io
43-
uses: sonarsource/sonarcloud-github-action@master
43+
uses: sonarsource/sonarqube-scan-action@v4.1.0
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4646
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ A simple deserialization.
2525

2626
## Requirements
2727

28-
* php: ^8.1
28+
* php: ^8.2
2929
* chubbyphp/chubbyphp-decode-encode: ^1.1
3030
* psr/http-message: ^1.1|^2.0
31-
* psr/log: ^2.0|^3.0
31+
* psr/log: ^2.0|^3.0.2
3232

3333
## Suggest
3434

3535
* chubbyphp/chubbyphp-container: ^2.2
3636
* pimple/pimple: ^3.5
3737
* psr/container: ^2.0.2
38-
* symfony/config: ^5.4.31|^6.3.8|^7.0 (symfony integration)
39-
* symfony/dependency-injection: ^5.4.31|^6.3.8|^7.0 (symfony integration)
38+
* symfony/config: ^5.4.46|^6.4.14|^7.2 (symfony integration)
39+
* symfony/dependency-injection: ^5.4.46|^6.4.14|^7.2 (symfony integration)
4040

4141
## Installation
4242

4343
Through [Composer](http://getcomposer.org) as [chubbyphp/chubbyphp-deserialization][1].
4444

4545
```sh
46-
composer require chubbyphp/chubbyphp-deserialization "^4.1"
46+
composer require chubbyphp/chubbyphp-deserialization "^4.2"
4747
```
4848

4949
## Usage

composer.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^8.1",
13+
"php": "^8.2",
1414
"ext-dom": "*",
1515
"ext-json": "*",
1616
"ext-mbstring": "*",
1717
"chubbyphp/chubbyphp-decode-encode": "^1.1",
1818
"psr/http-message": "^1.1|^2.0",
19-
"psr/log": "^2.0|^3.0"
19+
"psr/log": "^2.0|^3.0.2"
2020
},
2121
"require-dev": {
2222
"chubbyphp/chubbyphp-container": "^2.2",
2323
"chubbyphp/chubbyphp-dev-helper": "dev-master",
2424
"chubbyphp/chubbyphp-laminas-config-factory": "^1.3",
25-
"chubbyphp/chubbyphp-mock": "^1.7.0",
26-
"doctrine/collections": "^2.1.4",
27-
"doctrine/persistence": "^3.2",
28-
"infection/infection": "^0.27.8",
25+
"chubbyphp/chubbyphp-mock": "^1.8",
26+
"doctrine/collections": "^2.2.2",
27+
"doctrine/persistence": "^4.0",
28+
"infection/infection": "^0.29.8",
2929
"php-coveralls/php-coveralls": "^2.7.0",
30-
"phpstan/extension-installer": "^1.3.1",
31-
"phpstan/phpstan": "^1.10.45",
32-
"phpunit/phpunit": "^10.4.2",
30+
"phpstan/extension-installer": "^1.4.3",
31+
"phpstan/phpstan": "^2.0.3",
32+
"phpunit/phpunit": "^11.5.0",
3333
"pimple/pimple": "^3.5",
3434
"psr/container": "^2.0.2",
35-
"symfony/config": "^5.4.31|^6.3.8|^7.0",
36-
"symfony/dependency-injection": "^5.4.31|^6.3.8|^7.0"
35+
"symfony/config": "^5.4.46|^6.4.14|^7.2",
36+
"symfony/dependency-injection": "^5.4.46|^6.4.14|^7.2"
3737
},
3838
"autoload": {
3939
"psr-4": { "Chubbyphp\\Deserialization\\": "src/" }
@@ -50,7 +50,7 @@
5050
},
5151
"extra": {
5252
"branch-alias": {
53-
"dev-master": "4.1-dev"
53+
"dev-master": "4.2-dev"
5454
}
5555
},
5656
"scripts": {
@@ -65,9 +65,9 @@
6565
],
6666
"test:cs": "mkdir -p build && PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
6767
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=93 --verbose --coverage=build/phpunit",
68-
"test:integration": "vendor/bin/phpunit --testsuite=Integration --cache-result-file=build/phpunit/result.cache",
68+
"test:integration": "vendor/bin/phpunit --testsuite=Integration --cache-directory=build/phpunit",
6969
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",
7070
"test:static-analysis": "mkdir -p build && bash -c 'vendor/bin/phpstan analyse src --no-progress --level=8 --error-format=junit | tee build/phpstan.junit.xml; if [ ${PIPESTATUS[0]} -ne \"0\" ]; then exit 1; fi'",
71-
"test:unit": "vendor/bin/phpunit --testsuite=Unit --coverage-text --coverage-clover=build/phpunit/clover.xml --coverage-html=build/phpunit/coverage-html --coverage-xml=build/phpunit/coverage-xml --log-junit=build/phpunit/junit.xml --cache-result-file=build/phpunit/result.cache"
71+
"test:unit": "vendor/bin/phpunit --testsuite=Unit --coverage-text --coverage-clover=build/phpunit/clover.xml --coverage-html=build/phpunit/coverage-html --coverage-xml=build/phpunit/coverage-xml --log-junit=build/phpunit/junit.xml --cache-directory=build/phpunit"
7272
}
7373
}

phpstan.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ parameters:
66
-
77
message: '/supplied for foreach, only iterables are supported/'
88
path: %currentWorkingDirectory%/src/Denormalizer/Relation/EmbedManyFieldDenormalizer.php
9+
-
10+
message: '/Call to function is_array\(\) with array will always evaluate to true./'
11+
path: %currentWorkingDirectory%/src/Denormalizer/Relation/EmbedManyFieldDenormalizer.php
912
-
1013
message: '/supplied for foreach, only iterables are supported/'
1114
path: %currentWorkingDirectory%/src/Denormalizer/Relation/ReferenceManyFieldDenormalizer.php
15+
-
16+
message: '/Call to function is_string\(\) with string will always evaluate to true./'
17+
path: %currentWorkingDirectory%/src/Denormalizer/Relation/ReferenceManyFieldDenormalizer.php
18+
-
19+
message: '/Parameter .*relatedObjects.*/'
20+
path: %currentWorkingDirectory%/src/Denormalizer/Relation/ReferenceManyFieldDenormalizer.php

src/Accessor/PropertyAccessor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public function getValue(object $object)
5555
return $getter($this->property);
5656
}
5757

58+
/**
59+
* @return class-string<object>
60+
*/
5861
private function getClass(object $object): string
5962
{
6063
if (interface_exists('Doctrine\Persistence\Proxy') && $object instanceof Proxy) {

src/Denormalizer/FieldDenormalizer.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
namespace Chubbyphp\Deserialization\Denormalizer;
66

77
use Chubbyphp\Deserialization\Accessor\AccessorInterface;
8-
use Chubbyphp\Deserialization\DeserializerRuntimeException;
98

109
final class FieldDenormalizer implements FieldDenormalizerInterface
1110
{
1211
public function __construct(private AccessorInterface $accessor, private bool $emptyToNull = false) {}
1312

14-
/**
15-
* @throws DeserializerRuntimeException
16-
*/
1713
public function denormalizeField(
1814
string $path,
1915
object $object,

src/DeserializerLogicException.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ final class DeserializerLogicException extends \LogicException
88
{
99
public static function createMissingContentType(string $contentType): self
1010
{
11-
return new self(sprintf('There is no decoder for content-type: "%s"', $contentType));
11+
return new self(\sprintf('There is no decoder for content-type: "%s"', $contentType));
1212
}
1313

1414
public static function createMissingDenormalizer(string $path): self
1515
{
16-
return new self(sprintf('There is no denormalizer at path: "%s"', $path));
16+
return new self(\sprintf('There is no denormalizer at path: "%s"', $path));
1717
}
1818

1919
public static function createMissingMapping(string $class): self
2020
{
21-
return new self(sprintf('There is no mapping for class: "%s"', $class));
21+
return new self(\sprintf('There is no mapping for class: "%s"', $class));
2222
}
2323

2424
/**
@@ -27,22 +27,22 @@ public static function createMissingMapping(string $class): self
2727
public static function createMissingMethod(string $class, array $methods): self
2828
{
2929
return new self(
30-
sprintf('There are no accessible method(s) "%s", within class: "%s"', implode('", "', $methods), $class)
30+
\sprintf('There are no accessible method(s) "%s", within class: "%s"', implode('", "', $methods), $class)
3131
);
3232
}
3333

3434
public static function createMissingProperty(string $class, string $property): self
3535
{
36-
return new self(sprintf('There is no property "%s" within class: "%s"', $property, $class));
36+
return new self(\sprintf('There is no property "%s" within class: "%s"', $property, $class));
3737
}
3838

3939
public static function createFactoryDoesNotReturnObject(string $path, string $dataType): self
4040
{
41-
return new self(sprintf('Factory does not return object, "%s" given at path: "%s"', $dataType, $path));
41+
return new self(\sprintf('Factory does not return object, "%s" given at path: "%s"', $dataType, $path));
4242
}
4343

4444
public static function createConvertTypeDoesNotExists(string $convertType): self
4545
{
46-
return new self(sprintf('Convert type "%s" is not supported', $convertType));
46+
return new self(\sprintf('Convert type "%s" is not supported', $convertType));
4747
}
4848
}

src/DeserializerRuntimeException.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ final class DeserializerRuntimeException extends \RuntimeException
99
public static function createInvalidDataType(string $path, string $givenType, string $wishedType): self
1010
{
1111
return new self(
12-
sprintf('There is an invalid data type "%s", needed "%s" at path: "%s"', $givenType, $wishedType, $path)
12+
\sprintf('There is an invalid data type "%s", needed "%s" at path: "%s"', $givenType, $wishedType, $path)
1313
);
1414
}
1515

1616
public static function createNotParsable(string $contentType, ?string $error = null): self
1717
{
18-
$message = sprintf('Data is not parsable with content-type: "%s"', $contentType);
18+
$message = \sprintf('Data is not parsable with content-type: "%s"', $contentType);
1919
if (null !== $error) {
20-
$message .= sprintf(', error: "%s"', $error);
20+
$message .= \sprintf(', error: "%s"', $error);
2121
}
2222

2323
return new self($message);
@@ -28,15 +28,15 @@ public static function createNotParsable(string $contentType, ?string $error = n
2828
*/
2929
public static function createNotAllowedAdditionalFields(array $paths): self
3030
{
31-
return new self(sprintf('There are additional field(s) at paths: "%s"', implode('", "', $paths)));
31+
return new self(\sprintf('There are additional field(s) at paths: "%s"', implode('", "', $paths)));
3232
}
3333

3434
/**
3535
* @param array<int, string> $supportedTypes
3636
*/
3737
public static function createMissingObjectType(string $path, array $supportedTypes): self
3838
{
39-
return new self(sprintf(
39+
return new self(\sprintf(
4040
'Missing object type, supported are "%s" at path: "%s"',
4141
implode('", "', $supportedTypes),
4242
$path
@@ -48,7 +48,7 @@ public static function createMissingObjectType(string $path, array $supportedTyp
4848
*/
4949
public static function createInvalidObjectType(string $path, string $type, array $supportedTypes): self
5050
{
51-
return new self(sprintf(
51+
return new self(\sprintf(
5252
'Unsupported object type "%s", supported are "%s" at path: "%s"',
5353
$type,
5454
implode('", "', $supportedTypes),
@@ -58,6 +58,6 @@ public static function createInvalidObjectType(string $path, string $type, array
5858

5959
public static function createTypeIsNotAString(string $path, string $dataType): self
6060
{
61-
return new self(sprintf('Type is not a string, "%s" given at path: "%s"', $dataType, $path));
61+
return new self(\sprintf('Type is not a string, "%s" given at path: "%s"', $dataType, $path));
6262
}
6363
}

tests/Integration/DeserializerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public function testDenormalizeWithAllowedAdditionalFields(): void
499499

500500
private function getLogger(): AbstractLogger
501501
{
502-
return new class() extends AbstractLogger {
502+
return new class extends AbstractLogger {
503503
private array $entries = [];
504504

505505
public function log($level, $message, array $context = []): void

tests/Unit/Accessor/MethodAccessorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class MethodAccessorTest extends TestCase
1717
{
1818
public function testSetValue(): void
1919
{
20-
$object = new class() {
20+
$object = new class {
2121
private ?string $name = null;
2222

2323
public function getName(): string
@@ -41,15 +41,15 @@ public function testMissingSet(): void
4141
{
4242
$this->expectException(DeserializerLogicException::class);
4343

44-
$object = new class() {};
44+
$object = new class {};
4545

4646
$accessor = new MethodAccessor('name');
4747
$accessor->setValue($object, 'Name');
4848
}
4949

5050
public function testGetValue(): void
5151
{
52-
$object = new class() {
52+
$object = new class {
5353
private ?string $name = null;
5454

5555
public function getName(): string
@@ -72,7 +72,7 @@ public function setName(string $name): void
7272

7373
public function testHasValue(): void
7474
{
75-
$object = new class() {
75+
$object = new class {
7676
private ?string $name = null;
7777

7878
public function hasName(): bool
@@ -95,7 +95,7 @@ public function setName(string $name): void
9595

9696
public function testIsValue(): void
9797
{
98-
$object = new class() {
98+
$object = new class {
9999
private ?string $name = null;
100100

101101
public function isName(): bool
@@ -120,7 +120,7 @@ public function testMissingGet(): void
120120
{
121121
$this->expectException(DeserializerLogicException::class);
122122

123-
$object = new class() {};
123+
$object = new class {};
124124

125125
$accessor = new MethodAccessor('name');
126126
$accessor->getValue($object);

0 commit comments

Comments
 (0)