diff --git a/phpstan-7-4.neon.dist b/phpstan-7-4.neon.dist index 8c4c3f59d..565519f6f 100644 --- a/phpstan-7-4.neon.dist +++ b/phpstan-7-4.neon.dist @@ -14,6 +14,7 @@ parameters: excludePaths: - %currentWorkingDirectory%/tests/Fixtures/TypedProperties/UnionTypedProperties.php - %currentWorkingDirectory%/tests/Fixtures/TypedProperties/ConstructorPromotion/Vase.php + - %currentWorkingDirectory%/tests/Fixtures/TypedProperties/ConstructorPromotion/DefaultValuesAndAccessors.php - %currentWorkingDirectory%/tests/Fixtures/TypedProperties/UnionTypedProperties.php - %currentWorkingDirectory%/tests/Metadata/Driver/UnionTypedPropertiesDriverTest.php - %currentWorkingDirectory%/tests/Serializer/BaseSerializationTest.php diff --git a/src/Accessor/DefaultAccessorStrategy.php b/src/Accessor/DefaultAccessorStrategy.php index a52fba5da..16a927427 100644 --- a/src/Accessor/DefaultAccessorStrategy.php +++ b/src/Accessor/DefaultAccessorStrategy.php @@ -7,7 +7,6 @@ use JMS\Serializer\DeserializationContext; use JMS\Serializer\Exception\ExpressionLanguageRequiredException; use JMS\Serializer\Exception\LogicException; -use JMS\Serializer\Exception\NotAcceptableException; use JMS\Serializer\Exception\UninitializedPropertyException; use JMS\Serializer\Expression\CompilableExpressionEvaluatorInterface; use JMS\Serializer\Expression\Expression; diff --git a/tests/Fixtures/TypedProperties/ConstructorPromotion/DefaultValuesAndAccessors.php b/tests/Fixtures/TypedProperties/ConstructorPromotion/DefaultValuesAndAccessors.php index b2f09aa13..303055421 100644 --- a/tests/Fixtures/TypedProperties/ConstructorPromotion/DefaultValuesAndAccessors.php +++ b/tests/Fixtures/TypedProperties/ConstructorPromotion/DefaultValuesAndAccessors.php @@ -28,4 +28,4 @@ public function setPromotedWithSetter(string $value): void { $this->promotedWithSetter = $value . '_fromsetter'; } -} \ No newline at end of file +} diff --git a/tests/Fixtures/TypedProperties/ConstructorPromotion/Vase.php b/tests/Fixtures/TypedProperties/ConstructorPromotion/Vase.php index 56d7b844b..c87674c14 100644 --- a/tests/Fixtures/TypedProperties/ConstructorPromotion/Vase.php +++ b/tests/Fixtures/TypedProperties/ConstructorPromotion/Vase.php @@ -10,14 +10,11 @@ class Vase { public function __construct( public string $color, - #[JMS\Accessor(setter: 'setSize')] public string $size, - public ?string $plant = null, public string $typeOfSoil = 'potting mix', public int $daysSincePotting = -1, - #[JMS\Accessor(setter: 'setWeight')] public int $weight = 10, ) { @@ -25,16 +22,17 @@ public function __construct( public function setWeight(int $weight): void { - $this->weight = $weight+30; + $this->weight = $weight + 30; } public function setSize(string $size): void { - if ($size === 'big') { + if ('big' === $size) { $this->size = 'huge'; return; } + $this->size = $size; } } diff --git a/tests/Serializer/ArrayTest.php b/tests/Serializer/ArrayTest.php index df878caa5..fdbd0d289 100644 --- a/tests/Serializer/ArrayTest.php +++ b/tests/Serializer/ArrayTest.php @@ -95,7 +95,6 @@ public function testConstructorPromotionWithDefaultValuesOnly() $this->markTestSkipped(sprintf('%s requires PHP 8.0', __METHOD__)); } - /** @var DefaultValuesAndAccessors $deserialized */ $deserialized = $this->serializer->fromArray([], DefaultValuesAndAccessors::class); $expected = [