From 3233781608ae814842be55735281abd14e05af82 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 9 Dec 2023 11:19:25 -0500 Subject: [PATCH 1/2] Require PHP 7.4 and Symfony 5.4 --- .github/workflows/benchmark.yaml | 4 +- .github/workflows/ci.yaml | 2 - .github/workflows/coding-standards.yaml | 2 +- composer.json | 20 +-- phpcs.xml.dist | 2 +- src/Annotation/Type.php | 4 +- src/Builder/DefaultDriverFactory.php | 4 +- src/Exception/NonCastableTypeException.php | 4 +- src/Exception/NonVisitableTypeException.php | 2 +- src/Exception/RuntimeException.php | 2 +- .../DeserializationGraphNavigator.php | 2 +- src/Handler/DateHandler.php | 2 +- src/Handler/FormErrorHandler.php | 2 +- src/JsonDeserializationVisitor.php | 2 +- src/Metadata/ClassMetadata.php | 8 +- .../Driver/AnnotationOrAttributeDriver.php | 10 +- src/Metadata/Driver/AttributeDriver.php | 6 +- .../AttributeDriver/AttributeReader.php | 7 +- src/Metadata/Driver/DocBlockDriver.php | 4 +- .../DocBlockDriver/DocBlockTypeResolver.php | 2 +- src/Metadata/Driver/DoctrineTypeDriver.php | 2 +- src/Metadata/Driver/TypedPropertiesDriver.php | 4 - src/Metadata/Driver/XmlDriver.php | 4 +- src/Metadata/Driver/YamlDriver.php | 22 +-- .../AlphabeticalPropertyOrderingStrategy.php | 2 +- src/Serializer.php | 12 +- src/SerializerBuilder.php | 12 +- src/Type/Parser.php | 8 +- .../XmlSerializationVisitorFactory.php | 2 +- src/XmlDeserializationVisitor.php | 4 +- src/XmlSerializationVisitor.php | 2 +- .../Benchmark/AbstractSerializationBench.php | 2 +- ...jectWithXmlKeyValuePairsWithObjectType.php | 2 +- .../ObjectWithXmlKeyValuePairsWithType.php | 4 +- tests/Handler/DateHandlerTest.php | 12 +- tests/Handler/FormErrorHandlerTest.php | 12 +- tests/Handler/IteratorHandlerTest.php | 8 +- tests/Handler/SymfonyUidHandlerTest.php | 12 +- tests/Metadata/Driver/BaseDriverTestCase.php | 12 +- .../Driver/DefaultDriverFactoryTest.php | 4 - tests/Metadata/Driver/DocBlockDriverTest.php | 150 +++++------------- .../Driver/DocBlockTypeResolverTest.php | 12 +- tests/Metadata/Driver/DoctrineDriverTest.php | 16 +- .../Driver/DoctrinePHPCRDriverTest.php | 12 +- .../Driver/TypedPropertiesDriverTest.php | 7 - .../Driver/UnionTypedPropertiesDriverTest.php | 2 +- tests/Metadata/Driver/YamlDriverTest.php | 2 +- .../CustomPropertyOrderingStrategyTest.php | 2 +- tests/Serializer/ArrayTest.php | 2 +- .../Serializer/BaseSerializationTestCase.php | 130 +++++++-------- tests/Serializer/Doctrine/IntegrationTest.php | 4 +- .../Doctrine/ObjectConstructorTest.php | 27 ++-- ...ymfonyValidatorValidatorSubscriberTest.php | 2 +- tests/Serializer/JsonSerializationTest.php | 6 +- tests/Serializer/Type/ParserTest.php | 2 +- tests/Serializer/XmlSerializationTest.php | 42 ++--- tests/SerializerBuilderTest.php | 10 +- tests/Twig/SerializerExtensionTest.php | 8 +- 58 files changed, 282 insertions(+), 387 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 484b1ea99..4dd2b6f26 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -14,7 +14,7 @@ jobs: strategy: matrix: php-version: - - "7.2" + - "7.4" - "8.0" - "8.1" @@ -29,7 +29,7 @@ jobs: - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v1" - + - name: Run performance benchmarks run: | vendor/bin/phpbench run tests/Benchmark/Performance --report=aggregate diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4d7c7e1b1..4cc603b62 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,8 +15,6 @@ jobs: fail-fast: false matrix: php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" diff --git a/.github/workflows/coding-standards.yaml b/.github/workflows/coding-standards.yaml index af0b7c184..2a80321cd 100644 --- a/.github/workflows/coding-standards.yaml +++ b/.github/workflows/coding-standards.yaml @@ -14,7 +14,7 @@ jobs: strategy: matrix: php-version: - - "7.2" + - "7.4" steps: - name: "Checkout" diff --git a/composer.json b/composer.json index 33c326caa..857e77617 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "doctrine/annotations": "^1.14 || ^2.0", "doctrine/instantiator": "^1.3.1 || ^2.0", "doctrine/lexer": "^2.0 || ^3.0", @@ -39,16 +39,16 @@ "ocramius/proxy-manager": "^1.0 || ^2.0", "phpbench/phpbench": "^1.0", "phpstan/phpstan": "^1.0.2", - "phpunit/phpunit": "^8.5.21 || ^9.0 || ^10.0", + "phpunit/phpunit": "^9.0 || ^10.0", "psr/container": "^1.0 || ^2.0", - "symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "symfony/expression-language": "^3.2 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "symfony/filesystem": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/form": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "symfony/translation": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "symfony/uid": "^5.1 || ^6.0 || ^7.0", - "symfony/validator": "^3.1.9 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/expression-language": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/form": "^5.4 || ^6.0 || ^7.0", + "symfony/translation": "^5.4 || ^6.0 || ^7.0", + "symfony/uid": "^5.4 || ^6.0 || ^7.0", + "symfony/validator": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0", "twig/twig": "^1.34 || ^2.4 || ^3.0" }, "autoload": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 95a364845..e2ed35f0c 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -10,7 +10,7 @@ - + src/ tests/ diff --git a/src/Annotation/Type.php b/src/Annotation/Type.php index 0f499e9c5..ef4cf7173 100644 --- a/src/Annotation/Type.php +++ b/src/Annotation/Type.php @@ -23,7 +23,7 @@ public function __construct($values = [], $name = null) { if ((null !== $name) && !is_string($name) && !(is_object($name) && method_exists($name, '__toString'))) { throw new \RuntimeException( - 'Type must be either string, null or object implements __toString() method.' + 'Type must be either string, null or object implements __toString() method.', ); } @@ -34,7 +34,7 @@ public function __construct($values = [], $name = null) if (is_object($values)) { if (false === method_exists($values, '__toString')) { throw new \RuntimeException( - 'Type must be either string or object implements __toString() method.' + 'Type must be either string or object implements __toString() method.', ); } diff --git a/src/Builder/DefaultDriverFactory.php b/src/Builder/DefaultDriverFactory.php index 041ca4a71..afe2e4e30 100644 --- a/src/Builder/DefaultDriverFactory.php +++ b/src/Builder/DefaultDriverFactory.php @@ -84,9 +84,7 @@ public function createDriver(array $metadataDirs, Reader $annotationReader): Dri $driver = new EnumPropertiesDriver($driver); } - if (PHP_VERSION_ID >= 70400) { - $driver = new TypedPropertiesDriver($driver, $this->typeParser); - } + $driver = new TypedPropertiesDriver($driver, $this->typeParser); if (PHP_VERSION_ID >= 80000) { $driver = new DefaultValuePropertyDriver($driver); diff --git a/src/Exception/NonCastableTypeException.php b/src/Exception/NonCastableTypeException.php index 97d0be2a7..7aa297c20 100644 --- a/src/Exception/NonCastableTypeException.php +++ b/src/Exception/NonCastableTypeException.php @@ -22,8 +22,8 @@ public function __construct(string $expectedType, $value) sprintf( 'Cannot convert value of type "%s" to %s', gettype($value), - $expectedType - ) + $expectedType, + ), ); } diff --git a/src/Exception/NonVisitableTypeException.php b/src/Exception/NonVisitableTypeException.php index 53f05ecf0..ee011b728 100644 --- a/src/Exception/NonVisitableTypeException.php +++ b/src/Exception/NonVisitableTypeException.php @@ -20,7 +20,7 @@ public static function fromDataAndType($data, array $type, ?RuntimeException $pr return new self( sprintf('Type %s cannot be visited as %s', get_debug_type($data), $type['name']), 0, - $previous + $previous, ); } } diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index e71f661ce..a84f5416e 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -16,7 +16,7 @@ public static function noMetadataForProperty(string $class, string $prop): self return new RuntimeException(sprintf( 'You must define a type for %s::$%s.', $class, - $prop + $prop, )); } } diff --git a/src/GraphNavigator/DeserializationGraphNavigator.php b/src/GraphNavigator/DeserializationGraphNavigator.php index 495df3f1f..a29e43c12 100644 --- a/src/GraphNavigator/DeserializationGraphNavigator.php +++ b/src/GraphNavigator/DeserializationGraphNavigator.php @@ -243,7 +243,7 @@ private function resolveMetadata($data, ClassMetadata $metadata): ?ClassMetadata 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', $typeValue, $metadata->name, - implode(', ', array_keys($metadata->discriminatorMap)) + implode(', ', array_keys($metadata->discriminatorMap)), )); } diff --git a/src/Handler/DateHandler.php b/src/Handler/DateHandler.php index da187b28a..ada72f76b 100644 --- a/src/Handler/DateHandler.php +++ b/src/Handler/DateHandler.php @@ -256,7 +256,7 @@ private function parseDateTime($data, array $type, bool $immutable = false): \Da throw new RuntimeException(sprintf( 'Invalid datetime "%s", expected one of the format %s.', $data, - '"' . implode('", "', $formatTried) . '"' + '"' . implode('", "', $formatTried) . '"', )); } diff --git a/src/Handler/FormErrorHandler.php b/src/Handler/FormErrorHandler.php index 48a8d8a0a..6951f3292 100644 --- a/src/Handler/FormErrorHandler.php +++ b/src/Handler/FormErrorHandler.php @@ -63,7 +63,7 @@ public function __construct(?object $translator = null, string $translationDomai self::class, TranslatorInterface::class, TranslatorContract::class, - get_class($translator) + get_class($translator), )); } diff --git a/src/JsonDeserializationVisitor.php b/src/JsonDeserializationVisitor.php index 2437521e9..625c8c722 100644 --- a/src/JsonDeserializationVisitor.php +++ b/src/JsonDeserializationVisitor.php @@ -142,7 +142,7 @@ public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): s throw new LogicException(sprintf( 'The discriminator field name "%s" for base-class "%s" was not found in input data.', $metadata->discriminatorFieldName, - $metadata->name + $metadata->name, )); } diff --git a/src/Metadata/ClassMetadata.php b/src/Metadata/ClassMetadata.php index 805ec294b..660f1e456 100644 --- a/src/Metadata/ClassMetadata.php +++ b/src/Metadata/ClassMetadata.php @@ -240,7 +240,7 @@ public function merge(MergeableInterface $object): void 'The discriminator of class "%s" would overwrite the discriminator of the parent class "%s". Please define all possible sub-classes in the discriminator of %s.', $object->name, $this->discriminatorBaseClass, - $this->discriminatorBaseClass + $this->discriminatorBaseClass, )); } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { $this->discriminatorFieldName = $object->discriminatorFieldName; @@ -359,7 +359,7 @@ private function handleDiscriminatorProperty(): void throw new InvalidMetadataException(sprintf( 'The sub-class "%s" is not listed in the discriminator of the base class "%s".', $this->name, - $this->discriminatorBaseClass + $this->discriminatorBaseClass, )); } @@ -373,7 +373,7 @@ private function handleDiscriminatorProperty(): void 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', $this->discriminatorFieldName, $this->discriminatorBaseClass, - $this->name + $this->name, )); } @@ -381,7 +381,7 @@ private function handleDiscriminatorProperty(): void $this->name, $this->discriminatorFieldName, $typeValue, - $this->discriminatorGroups + $this->discriminatorGroups, ); $discriminatorProperty->serializedName = $this->discriminatorFieldName; $discriminatorProperty->xmlAttribute = $this->xmlDiscriminatorAttribute; diff --git a/src/Metadata/Driver/AnnotationOrAttributeDriver.php b/src/Metadata/Driver/AnnotationOrAttributeDriver.php index 5454f42ab..8e1b52343 100644 --- a/src/Metadata/Driver/AnnotationOrAttributeDriver.php +++ b/src/Metadata/Driver/AnnotationOrAttributeDriver.php @@ -132,7 +132,7 @@ public function loadMetadataForClass(\ReflectionClass $class): ?BaseClassMetadat $virtualPropertyMetadata = new ExpressionPropertyMetadata( $name, $annot->name, - $this->parseExpression($annot->exp) + $this->parseExpression($annot->exp), ); $propertiesMetadata[] = $virtualPropertyMetadata; $propertiesAnnotations[] = $annot->options; @@ -248,7 +248,7 @@ public function loadMetadataForClass(\ReflectionClass $class): ?BaseClassMetadat throw new InvalidMetadataException(sprintf( 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', implode(', ', $propertyMetadata->groups), - $propertyMetadata->class . '->' . $propertyMetadata->name + $propertyMetadata->class . '->' . $propertyMetadata->name, )); } } @@ -310,7 +310,7 @@ protected function getClassAnnotations(\ReflectionClass $class): array static function (\ReflectionAttribute $attribute): object { return $attribute->newInstance(); }, - $class->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF) + $class->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF), ); } @@ -333,7 +333,7 @@ protected function getMethodAnnotations(\ReflectionMethod $method): array static function (\ReflectionAttribute $attribute): object { return $attribute->newInstance(); }, - $method->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF) + $method->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF), ); } @@ -356,7 +356,7 @@ protected function getPropertyAnnotations(\ReflectionProperty $property): array static function (\ReflectionAttribute $attribute): object { return $attribute->newInstance(); }, - $property->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF) + $property->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF), ); } diff --git a/src/Metadata/Driver/AttributeDriver.php b/src/Metadata/Driver/AttributeDriver.php index d00615a13..e966791c2 100644 --- a/src/Metadata/Driver/AttributeDriver.php +++ b/src/Metadata/Driver/AttributeDriver.php @@ -17,7 +17,7 @@ protected function getClassAnnotations(\ReflectionClass $class): array static function (\ReflectionAttribute $attribute): object { return $attribute->newInstance(); }, - $class->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF) + $class->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF), ); } @@ -30,7 +30,7 @@ protected function getMethodAnnotations(\ReflectionMethod $method): array static function (\ReflectionAttribute $attribute): object { return $attribute->newInstance(); }, - $method->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF) + $method->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF), ); } @@ -43,7 +43,7 @@ protected function getPropertyAnnotations(\ReflectionProperty $property): array static function (\ReflectionAttribute $attribute): object { return $attribute->newInstance(); }, - $property->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF) + $property->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF), ); } } diff --git a/src/Metadata/Driver/AttributeDriver/AttributeReader.php b/src/Metadata/Driver/AttributeDriver/AttributeReader.php index add4432f2..91e8aa83a 100644 --- a/src/Metadata/Driver/AttributeDriver/AttributeReader.php +++ b/src/Metadata/Driver/AttributeDriver/AttributeReader.php @@ -67,7 +67,10 @@ public function getPropertyAnnotation(ReflectionProperty $property, $annotationN return $this->reader->getClassAnnotation($property, $annotationName) ?? $this->buildAnnotation($attributes); } - private function buildAnnotation(array $attributes): ?object + /** + * @param list<\ReflectionAttribute> $attributes + */ + private function buildAnnotation(array $attributes): ?SerializerAttribute { if (!isset($attributes[0])) { return null; @@ -85,7 +88,7 @@ private function buildAnnotations(array $attributes): array static function (\ReflectionAttribute $attribute): object { return $attribute->newInstance(); }, - $attributes + $attributes, ); } } diff --git a/src/Metadata/Driver/DocBlockDriver.php b/src/Metadata/Driver/DocBlockDriver.php index f7b1f97e3..b8ce046b3 100644 --- a/src/Metadata/Driver/DocBlockDriver.php +++ b/src/Metadata/Driver/DocBlockDriver.php @@ -70,11 +70,11 @@ public function loadMetadataForClass(ReflectionClass $class): ?ClassMetadata try { if ($propertyMetadata instanceof VirtualPropertyMetadata) { $type = $this->docBlockTypeResolver->getMethodDocblockTypeHint( - new ReflectionMethod($propertyMetadata->class, $propertyMetadata->getter) + new ReflectionMethod($propertyMetadata->class, $propertyMetadata->getter), ); } else { $type = $this->docBlockTypeResolver->getPropertyDocblockTypeHint( - new ReflectionProperty($propertyMetadata->class, $propertyMetadata->name) + new ReflectionProperty($propertyMetadata->class, $propertyMetadata->name), ); } diff --git a/src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php b/src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php index f3ff04645..4e43cf6e0 100644 --- a/src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php +++ b/src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php @@ -429,7 +429,7 @@ private function getPhpstanType(\ReflectionClass $declaringClass, string $typeHi ',', array_map(static function (string $type) use ($reflector, $self) { return $self->resolveType(trim($type), $reflector); - }, $types) + }, $types), )); } } diff --git a/src/Metadata/Driver/DoctrineTypeDriver.php b/src/Metadata/Driver/DoctrineTypeDriver.php index 63592e8be..e51f8d5c4 100644 --- a/src/Metadata/Driver/DoctrineTypeDriver.php +++ b/src/Metadata/Driver/DoctrineTypeDriver.php @@ -27,7 +27,7 @@ protected function setDiscriminator(DoctrineClassMetadata $doctrineMetadata, Cla ) { $classMetadata->setDiscriminator( $doctrineMetadata->discriminatorColumn['name'], - $doctrineMetadata->discriminatorMap + $doctrineMetadata->discriminatorMap, ); } } diff --git a/src/Metadata/Driver/TypedPropertiesDriver.php b/src/Metadata/Driver/TypedPropertiesDriver.php index c3ebbefe4..ed41807eb 100644 --- a/src/Metadata/Driver/TypedPropertiesDriver.php +++ b/src/Metadata/Driver/TypedPropertiesDriver.php @@ -74,10 +74,6 @@ public function loadMetadataForClass(ReflectionClass $class): ?ClassMetadata \assert($classMetadata instanceof SerializerClassMetadata); - if (PHP_VERSION_ID <= 70400) { - return $classMetadata; - } - // We base our scan on the internal driver's property list so that we // respect any internal allow/blocklist like in the AnnotationDriver foreach ($classMetadata->propertyMetadata as $propertyMetadata) { diff --git a/src/Metadata/Driver/XmlDriver.php b/src/Metadata/Driver/XmlDriver.php index dd5436709..a6ba580ec 100644 --- a/src/Metadata/Driver/XmlDriver.php +++ b/src/Metadata/Driver/XmlDriver.php @@ -155,7 +155,7 @@ protected function loadMetadataFromFile(\ReflectionClass $class, string $path): $virtualPropertyMetadata = new ExpressionPropertyMetadata( $name, (string) $method->attributes()->name, - $this->parseExpression((string) $method->attributes()->expression) + $this->parseExpression((string) $method->attributes()->expression), ); } else { if (!isset($method->attributes()->method)) { @@ -326,7 +326,7 @@ protected function loadMetadataFromFile(\ReflectionClass $class, string $path): $pMetadata->setAccessor( (string) ($pElem->attributes()->{'access-type'} ?: $classAccessType), $getter ? (string) $getter : null, - $setter ? (string) $setter : null + $setter ? (string) $setter : null, ); if (null !== $inline = $pElem->attributes()->inline) { diff --git a/src/Metadata/Driver/YamlDriver.php b/src/Metadata/Driver/YamlDriver.php index 60d52762d..8dd61f10e 100644 --- a/src/Metadata/Driver/YamlDriver.php +++ b/src/Metadata/Driver/YamlDriver.php @@ -74,8 +74,8 @@ public function getAllClassNames(): array throw new RuntimeException( sprintf( 'Locator "%s" must be an instance of "AdvancedFileLocatorInterface".', - get_class($this->locator) - ) + get_class($this->locator), + ), ); } @@ -95,7 +95,7 @@ protected function loadMetadataFromFile(ReflectionClass $class, string $file): ? if (!isset($config[$name = $class->name])) { throw new InvalidMetadataException( - sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file) + sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file), ); } @@ -126,13 +126,13 @@ protected function loadMetadataFromFile(ReflectionClass $class, string $file): ? $virtualPropertyMetadata = new ExpressionPropertyMetadata( $name, $methodName, - $this->parseExpression($propertySettings['exp']) + $this->parseExpression($propertySettings['exp']), ); unset($propertySettings['exp']); } else { if (!$class->hasMethod($methodName)) { throw new InvalidMetadataException( - 'The method ' . $methodName . ' not found in class ' . $class->name + 'The method ' . $methodName . ' not found in class ' . $class->name, ); } @@ -290,7 +290,7 @@ protected function loadMetadataFromFile(ReflectionClass $class, string $file): ? $pMetadata->setAccessor( $pConfig['access_type'] ?? $classAccessType, $pConfig['accessor']['getter'] ?? null, - $pConfig['accessor']['setter'] ?? null + $pConfig['accessor']['setter'] ?? null, ); if (isset($pConfig['inline'])) { @@ -397,7 +397,7 @@ private function addClassProperties(ClassMetadata $metadata, array $config): voi if (!isset($config['discriminator']['map']) || !is_array($config['discriminator']['map'])) { throw new InvalidMetadataException( - 'The "map" attribute must be set, and be an array for discriminators.' + 'The "map" attribute must be set, and be an array for discriminators.', ); } @@ -405,7 +405,7 @@ private function addClassProperties(ClassMetadata $metadata, array $config): voi $metadata->setDiscriminator( $config['discriminator']['field_name'], $config['discriminator']['map'], - $groups + $groups, ); if (isset($config['discriminator']['xml_attribute'])) { @@ -436,8 +436,8 @@ private function getCallbackMetadata(ReflectionClass $class, $config): array throw new InvalidMetadataException( sprintf( 'callback methods expects a string, or an array of strings that represent method names, but got %s.', - json_encode($config['pre_serialize']) - ) + json_encode($config['pre_serialize']), + ), ); } @@ -445,7 +445,7 @@ private function getCallbackMetadata(ReflectionClass $class, $config): array foreach ($config as $name) { if (!$class->hasMethod($name)) { throw new InvalidMetadataException( - sprintf('The method %s does not exist in class %s.', $name, $class->name) + sprintf('The method %s does not exist in class %s.', $name, $class->name), ); } diff --git a/src/Ordering/AlphabeticalPropertyOrderingStrategy.php b/src/Ordering/AlphabeticalPropertyOrderingStrategy.php index 09d8a65a5..a60d3cb09 100644 --- a/src/Ordering/AlphabeticalPropertyOrderingStrategy.php +++ b/src/Ordering/AlphabeticalPropertyOrderingStrategy.php @@ -17,7 +17,7 @@ public function order(array $properties): array $properties, static function (PropertyMetadata $a, PropertyMetadata $b): int { return strcmp($a->name, $b->name); - } + }, ); return $properties; diff --git a/src/Serializer.php b/src/Serializer.php index af0540596..1dc7e6ca8 100644 --- a/src/Serializer.php +++ b/src/Serializer.php @@ -119,8 +119,8 @@ private function getNavigator(int $direction): GraphNavigatorInterface throw new RuntimeException( sprintf( 'Can not find a graph navigator for the direction "%s".', - GraphNavigatorInterface::DIRECTION_SERIALIZATION === $direction ? 'serialization' : 'deserialization' - ) + GraphNavigatorInterface::DIRECTION_SERIALIZATION === $direction ? 'serialization' : 'deserialization', + ), ); } @@ -138,8 +138,8 @@ private function getVisitor(int $direction, string $format): VisitorInterface sprintf( 'The format "%s" is not supported for %s.', $format, - GraphNavigatorInterface::DIRECTION_SERIALIZATION === $direction ? 'serialization' : 'deserialization' - ) + GraphNavigatorInterface::DIRECTION_SERIALIZATION === $direction ? 'serialization' : 'deserialization', + ), ); } @@ -206,7 +206,7 @@ public function toArray($data, ?SerializationContext $context = null, ?string $t throw new RuntimeException(sprintf( 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', \is_object($data) ? \get_class($data) : \gettype($data), - \is_object($result) ? \get_class($result) : \gettype($result) + \is_object($result) ? \get_class($result) : \gettype($result), )); } @@ -239,7 +239,7 @@ private function visit(GraphNavigatorInterface $navigator, VisitorInterface $vis $format, $visitor, $navigator, - $this->factory + $this->factory, ); $visitor->setNavigator($navigator); diff --git a/src/SerializerBuilder.php b/src/SerializerBuilder.php index 47fa2d299..45f42f4a8 100644 --- a/src/SerializerBuilder.php +++ b/src/SerializerBuilder.php @@ -497,7 +497,7 @@ public function setSerializationContextFactory($serializationContextFactory): se $this->serializationContextFactory = $serializationContextFactory; } elseif (is_callable($serializationContextFactory)) { $this->serializationContextFactory = new CallableSerializationContextFactory( - $serializationContextFactory + $serializationContextFactory, ); } else { throw new InvalidArgumentException('expected SerializationContextFactoryInterface or callable.'); @@ -515,7 +515,7 @@ public function setDeserializationContextFactory($deserializationContextFactory) $this->deserializationContextFactory = $deserializationContextFactory; } elseif (is_callable($deserializationContextFactory)) { $this->deserializationContextFactory = new CallableDeserializationContextFactory( - $deserializationContextFactory + $deserializationContextFactory, ); } else { throw new InvalidArgumentException('expected DeserializationContextFactoryInterface or callable.'); @@ -562,7 +562,7 @@ public function build(): Serializer $this->driverFactory = new DefaultDriverFactory( $this->propertyNamingStrategy, $this->typeParser, - $this->expressionEvaluator instanceof CompilableExpressionEvaluatorInterface ? $this->expressionEvaluator : null + $this->expressionEvaluator instanceof CompilableExpressionEvaluatorInterface ? $this->expressionEvaluator : null, ); $this->driverFactory->enableEnumSupport($this->enableEnumSupport); } @@ -611,7 +611,7 @@ public function build(): Serializer $this->deserializationVisitors, $this->serializationContextFactory, $this->deserializationContextFactory, - $this->typeParser + $this->typeParser, ); } @@ -622,7 +622,7 @@ private function getSerializationNavigatorFactory(MetadataFactoryInterface $meta $this->handlerRegistry, $this->getAccessorStrategy(), $this->eventDispatcher, - $this->expressionEvaluator + $this->expressionEvaluator, ); } @@ -634,7 +634,7 @@ private function getDeserializationNavigatorFactory(MetadataFactoryInterface $me $this->objectConstructor ?: new UnserializeObjectConstructor(), $this->getAccessorStrategy(), $this->eventDispatcher, - $this->expressionEvaluator + $this->expressionEvaluator, ); } diff --git a/src/Type/Parser.php b/src/Type/Parser.php index ab7d361a7..560345c13 100644 --- a/src/Type/Parser.php +++ b/src/Type/Parser.php @@ -39,7 +39,7 @@ private function visit() if (!$this->lexer->token) { throw new SyntaxError( - 'Syntax error, unexpected end of stream' + 'Syntax error, unexpected end of stream', ); } @@ -66,7 +66,7 @@ private function visit() throw new SyntaxError(sprintf( 'Syntax error, unexpected "%s" (%s)', $this->lexer->token->value, - $this->getConstant($this->lexer->token->type) + $this->getConstant($this->lexer->token->type), )); } @@ -135,7 +135,7 @@ private function match(int $token): void { if (!$this->lexer->lookahead) { throw new SyntaxError( - sprintf('Syntax error, unexpected end of stream, expected %s', $this->getConstant($token)) + sprintf('Syntax error, unexpected end of stream, expected %s', $this->getConstant($token)), ); } @@ -149,7 +149,7 @@ private function match(int $token): void 'Syntax error, unexpected "%s" (%s), expected was %s', $this->lexer->lookahead->value, $this->getConstant($this->lexer->lookahead->type), - $this->getConstant($token) + $this->getConstant($token), )); } diff --git a/src/Visitor/Factory/XmlSerializationVisitorFactory.php b/src/Visitor/Factory/XmlSerializationVisitorFactory.php index 10541a457..be7f0eb05 100644 --- a/src/Visitor/Factory/XmlSerializationVisitorFactory.php +++ b/src/Visitor/Factory/XmlSerializationVisitorFactory.php @@ -44,7 +44,7 @@ public function getVisitor(): SerializationVisitorInterface $this->defaultEncoding, $this->defaultVersion, $this->defaultRootName, - $this->defaultRootNamespace + $this->defaultRootNamespace, ); } diff --git a/src/XmlDeserializationVisitor.php b/src/XmlDeserializationVisitor.php index a2ba33016..1efa3c90c 100644 --- a/src/XmlDeserializationVisitor.php +++ b/src/XmlDeserializationVisitor.php @@ -88,7 +88,7 @@ public function prepare($data) if (!in_array($internalSubset, $this->doctypeAllowList, true)) { throw new InvalidArgumentException(sprintf( 'The document type "%s" is not allowed. If it is safe, you may add it to the allowlist configuration.', - $internalSubset + $internalSubset, )); } } @@ -288,7 +288,7 @@ public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): s throw new LogicException(sprintf( 'The discriminator field name "%s" for base-class "%s" was not found in input data.', $metadata->discriminatorFieldName, - $metadata->name + $metadata->name, )); } } diff --git a/src/XmlSerializationVisitor.php b/src/XmlSerializationVisitor.php index ffa1e1419..ae150aa66 100644 --- a/src/XmlSerializationVisitor.php +++ b/src/XmlSerializationVisitor.php @@ -401,7 +401,7 @@ public function getResult($node) $this->document->documentElement->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:xsi', - 'http://www.w3.org/2001/XMLSchema-instance' + 'http://www.w3.org/2001/XMLSchema-instance', ); } diff --git a/tests/Benchmark/AbstractSerializationBench.php b/tests/Benchmark/AbstractSerializationBench.php index c0fd5dbf8..8925f5920 100644 --- a/tests/Benchmark/AbstractSerializationBench.php +++ b/tests/Benchmark/AbstractSerializationBench.php @@ -81,7 +81,7 @@ private function createPost() 'FooooooooooooooooooooooBAR', new Author('Foo'), new \DateTime(), - new Publisher('bar') + new Publisher('bar'), ); for ($i = 0; $i < $this->amountOfComments; $i++) { $post->addComment(new Comment(new Author('foo'), 'foobar')); diff --git a/tests/Fixtures/ObjectWithXmlKeyValuePairsWithObjectType.php b/tests/Fixtures/ObjectWithXmlKeyValuePairsWithObjectType.php index 548e4a85d..c625b1f69 100644 --- a/tests/Fixtures/ObjectWithXmlKeyValuePairsWithObjectType.php +++ b/tests/Fixtures/ObjectWithXmlKeyValuePairsWithObjectType.php @@ -29,7 +29,7 @@ public static function create1() [ 'key_first' => ObjectWithXmlKeyValuePairsWithType::create1(), 'key_second' => ObjectWithXmlKeyValuePairsWithType::create2(), - ] + ], ); } } diff --git a/tests/Fixtures/ObjectWithXmlKeyValuePairsWithType.php b/tests/Fixtures/ObjectWithXmlKeyValuePairsWithType.php index 77e5bd59d..d0bece018 100644 --- a/tests/Fixtures/ObjectWithXmlKeyValuePairsWithType.php +++ b/tests/Fixtures/ObjectWithXmlKeyValuePairsWithType.php @@ -37,7 +37,7 @@ public static function create1() [ 'key-one' => 'foo', 'key-two' => 'bar', - ] + ], ); } @@ -49,7 +49,7 @@ public static function create2() 'key_02' => 'Two', 'key_03' => 'Three', ], - ['Four'] + ['Four'], ); } } diff --git a/tests/Handler/DateHandlerTest.php b/tests/Handler/DateHandlerTest.php index 78c99061c..17b00c0ac 100644 --- a/tests/Handler/DateHandlerTest.php +++ b/tests/Handler/DateHandlerTest.php @@ -90,7 +90,7 @@ public function testTimePartGetsRemoved() $type = ['name' => 'DateTime', 'params' => ['Y-m-d', '', 'Y-m-d|']]; self::assertEquals( \DateTime::createFromFormat('Y-m-d|', '2017-06-18', $this->timezone), - $this->handler->deserializeDateTimeFromJson($visitor, '2017-06-18', $type) + $this->handler->deserializeDateTimeFromJson($visitor, '2017-06-18', $type), ); } @@ -101,7 +101,7 @@ public function testMultiFormatCase() $type = ['name' => 'DateTime', 'params' => ['Y-m-d', '', ['Y-m-d|', 'Y/m/d']]]; self::assertEquals( \DateTime::createFromFormat('Y/m/d', '2017/06/18', $this->timezone), - $this->handler->deserializeDateTimeFromJson($visitor, '2017/06/18', $type) + $this->handler->deserializeDateTimeFromJson($visitor, '2017/06/18', $type), ); } @@ -121,14 +121,14 @@ public function testTimePartGetsPreserved() $type = ['name' => 'DateTime', 'params' => ['Y-m-d']]; self::assertEquals( $expectedDateTime, - $this->handler->deserializeDateTimeFromJson($visitor, '2017-06-18', $type) + $this->handler->deserializeDateTimeFromJson($visitor, '2017-06-18', $type), ); // custom deserialization format specified $type = ['name' => 'DateTime', 'params' => ['Y-m-d', '', 'Y-m-d']]; self::assertEquals( $expectedDateTime, - $this->handler->deserializeDateTimeFromJson($visitor, '2017-06-18', $type) + $this->handler->deserializeDateTimeFromJson($visitor, '2017-06-18', $type), ); } @@ -147,7 +147,7 @@ public function testTimeZoneGetsPreservedWithUnixTimestamp() self::assertEquals( $expectedDateTime->format(\DateTime::RFC3339), - $actualDateTime->format(\DateTime::RFC3339) + $actualDateTime->format(\DateTime::RFC3339), ); } @@ -166,7 +166,7 @@ public function testImmutableTimeZoneGetsPreservedWithUnixTimestamp() self::assertEquals( $expectedDateTime->format(\DateTime::RFC3339), - $actualDateTime->format(\DateTime::RFC3339) + $actualDateTime->format(\DateTime::RFC3339), ); } } diff --git a/tests/Handler/FormErrorHandlerTest.php b/tests/Handler/FormErrorHandlerTest.php index 5f15f92da..353b6c20a 100644 --- a/tests/Handler/FormErrorHandlerTest.php +++ b/tests/Handler/FormErrorHandlerTest.php @@ -150,7 +150,7 @@ public function testDefaultTranslationDomain() ->with( $this->equalTo('error!'), $this->equalTo([]), - $this->equalTo('validators') + $this->equalTo('validators'), ); $formError = $this->getMockBuilder('Symfony\Component\Form\FormError')->disableOriginalConstructor()->getMock(); @@ -177,7 +177,7 @@ public function testDefaultTranslationDomainWithPluralTranslation() ->with( $this->equalTo('error!'), $this->equalTo(['%count%' => 0]), - $this->equalTo('validators') + $this->equalTo('validators'), ); } else { $translator->expects($this->once()) @@ -186,7 +186,7 @@ public function testDefaultTranslationDomainWithPluralTranslation() $this->equalTo('error!'), $this->equalTo(0), $this->equalTo([]), - $this->equalTo('validators') + $this->equalTo('validators'), ); } @@ -213,7 +213,7 @@ public function testCustomTranslationDomain() ->with( $this->equalTo('error!'), $this->equalTo([]), - $this->equalTo('custom_domain') + $this->equalTo('custom_domain'), ); $formError = $this->getMockBuilder('Symfony\Component\Form\FormError')->disableOriginalConstructor()->getMock(); @@ -241,7 +241,7 @@ public function testCustomTranslationDomainWithPluralTranslation() ->with( $this->equalTo('error!'), $this->equalTo(['%count%' => 0]), - $this->equalTo('custom_domain') + $this->equalTo('custom_domain'), ); } else { $translator->expects($this->once()) @@ -250,7 +250,7 @@ public function testCustomTranslationDomainWithPluralTranslation() $this->equalTo('error!'), $this->equalTo(0), $this->equalTo([]), - $this->equalTo('custom_domain') + $this->equalTo('custom_domain'), ); } diff --git a/tests/Handler/IteratorHandlerTest.php b/tests/Handler/IteratorHandlerTest.php index ec40747b4..bc2affafd 100644 --- a/tests/Handler/IteratorHandlerTest.php +++ b/tests/Handler/IteratorHandlerTest.php @@ -46,7 +46,7 @@ public function testSerialize(\Iterator $iterator): void $serializationHandler = $this->handlerRegistry->getHandler( GraphNavigatorInterface::DIRECTION_SERIALIZATION, $type, - 'json' + 'json', ); self::assertIsCallable($serializationHandler); @@ -54,14 +54,14 @@ public function testSerialize(\Iterator $iterator): void $this->createSerializationVisitor(), $iterator, ['name' => $type, 'params' => []], - $this->getMockBuilder(SerializationContext::class)->getMock() + $this->getMockBuilder(SerializationContext::class)->getMock(), ); self::assertSame(self::DATA, $serialized); $deserializationHandler = $this->handlerRegistry->getHandler( GraphNavigatorInterface::DIRECTION_DESERIALIZATION, $type, - 'json' + 'json', ); self::assertIsCallable($deserializationHandler); @@ -69,7 +69,7 @@ public function testSerialize(\Iterator $iterator): void $this->createDeserializationVisitor(), $serialized, ['name' => $type, 'params' => []], - $this->getMockBuilder(DeserializationContext::class)->getMock() + $this->getMockBuilder(DeserializationContext::class)->getMock(), ); self::assertEquals($iterator, $deserialized); } diff --git a/tests/Handler/SymfonyUidHandlerTest.php b/tests/Handler/SymfonyUidHandlerTest.php index 7f0dbf956..1a5a2f41a 100644 --- a/tests/Handler/SymfonyUidHandlerTest.php +++ b/tests/Handler/SymfonyUidHandlerTest.php @@ -50,7 +50,7 @@ public function testSerializeUidToJson(AbstractUid $uid): void { self::assertJsonStringEqualsJsonString( sprintf('"%s"', (string) $uid), - $this->createSerializer()->serialize($uid, 'json', null, AbstractUid::class) + $this->createSerializer()->serialize($uid, 'json', null, AbstractUid::class), ); } @@ -61,7 +61,7 @@ public function testSerializeUidToXmlWithCData(AbstractUid $uid): void { self::assertXmlStringEqualsXmlString( sprintf('%s', (string) $uid), - $this->createSerializer()->serialize($uid, 'xml', null, AbstractUid::class) + $this->createSerializer()->serialize($uid, 'xml', null, AbstractUid::class), ); } @@ -72,7 +72,7 @@ public function testSerializeUidToXmlWithoutCData(AbstractUid $uid): void { self::assertXmlStringEqualsXmlString( sprintf('%s', (string) $uid), - $this->createSerializer(false)->serialize($uid, 'xml', null, AbstractUid::class) + $this->createSerializer(false)->serialize($uid, 'xml', null, AbstractUid::class), ); } @@ -82,7 +82,7 @@ public function testSerializeUidToBase32(): void self::assertJsonStringEqualsJsonString( sprintf('"%s"', $uid->toBase32()), - $this->createSerializer()->serialize($uid, 'json', null, sprintf('%s<%s>', AbstractUid::class, SymfonyUidHandler::FORMAT_BASE32)) + $this->createSerializer()->serialize($uid, 'json', null, sprintf('%s<%s>', AbstractUid::class, SymfonyUidHandler::FORMAT_BASE32)), ); } @@ -92,7 +92,7 @@ public function testSerializeUidToBase58(): void self::assertJsonStringEqualsJsonString( sprintf('"%s"', $uid->toBase58()), - $this->createSerializer()->serialize($uid, 'json', null, sprintf('%s<%s>', AbstractUid::class, SymfonyUidHandler::FORMAT_BASE58)) + $this->createSerializer()->serialize($uid, 'json', null, sprintf('%s<%s>', AbstractUid::class, SymfonyUidHandler::FORMAT_BASE58)), ); } @@ -102,7 +102,7 @@ public function testSerializeUidToRfc4122(): void self::assertJsonStringEqualsJsonString( sprintf('"%s"', $uid->toRfc4122()), - $this->createSerializer()->serialize($uid, 'json', null, sprintf('%s<%s>', AbstractUid::class, SymfonyUidHandler::FORMAT_RFC4122)) + $this->createSerializer()->serialize($uid, 'json', null, sprintf('%s<%s>', AbstractUid::class, SymfonyUidHandler::FORMAT_RFC4122)), ); } diff --git a/tests/Metadata/Driver/BaseDriverTestCase.php b/tests/Metadata/Driver/BaseDriverTestCase.php index 8236d84b8..656adca7a 100644 --- a/tests/Metadata/Driver/BaseDriverTestCase.php +++ b/tests/Metadata/Driver/BaseDriverTestCase.php @@ -240,7 +240,7 @@ public function testLoadDiscriminator() 'car' => 'JMS\Serializer\Tests\Fixtures\Discriminator\Car', 'moped' => 'JMS\Serializer\Tests\Fixtures\Discriminator\Moped', ], - $m->discriminatorMap + $m->discriminatorMap, ); } @@ -257,7 +257,7 @@ public function testLoadDiscriminatorWhenParentIsInDiscriminatorMap() 'post' => 'JMS\Serializer\Tests\Fixtures\Discriminator\Post', 'image_post' => 'JMS\Serializer\Tests\Fixtures\Discriminator\ImagePost', ], - $m->discriminatorMap + $m->discriminatorMap, ); } @@ -273,7 +273,7 @@ public function testLoadXmlDiscriminator() [ 'child' => ObjectWithXmlAttributeDiscriminatorChild::class, ], - $m->discriminatorMap + $m->discriminatorMap, ); self::assertTrue($m->xmlDiscriminatorAttribute); self::assertFalse($m->xmlDiscriminatorCData); @@ -291,7 +291,7 @@ public function testLoadXmlDiscriminatorWithNamespaces() [ 'child' => ObjectWithXmlNamespaceDiscriminatorChild::class, ], - $m->discriminatorMap + $m->discriminatorMap, ); self::assertEquals('http://example.com/', $m->xmlDiscriminatorNamespace); self::assertFalse($m->xmlDiscriminatorAttribute); @@ -320,7 +320,7 @@ public function testLoadXmlDiscriminatorWithAttributeNamespaces() [ 'child' => ObjectWithXmlNamespaceAttributeDiscriminatorChild::class, ], - $m->discriminatorMap + $m->discriminatorMap, ); self::assertEquals('http://example.com/', $m->xmlDiscriminatorNamespace); self::assertTrue($m->xmlDiscriminatorAttribute); @@ -337,7 +337,7 @@ public function testLoadDiscriminatorWithGroup() self::assertEquals($m->name, $m->discriminatorBaseClass); self::assertEquals( ['car' => 'JMS\Serializer\Tests\Fixtures\DiscriminatorGroup\Car'], - $m->discriminatorMap + $m->discriminatorMap, ); } diff --git a/tests/Metadata/Driver/DefaultDriverFactoryTest.php b/tests/Metadata/Driver/DefaultDriverFactoryTest.php index cd9258871..6f068c875 100644 --- a/tests/Metadata/Driver/DefaultDriverFactoryTest.php +++ b/tests/Metadata/Driver/DefaultDriverFactoryTest.php @@ -15,10 +15,6 @@ class DefaultDriverFactoryTest extends TestCase { public function testDefaultDriverFactoryLoadsTypedPropertiesDriver() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', __METHOD__)); - } - $factory = new DefaultDriverFactory(new IdenticalPropertyNamingStrategy()); $driver = $factory->createDriver([], new AnnotationReader()); diff --git a/tests/Metadata/Driver/DocBlockDriverTest.php b/tests/Metadata/Driver/DocBlockDriverTest.php index 74ada8afa..414aa4a78 100644 --- a/tests/Metadata/Driver/DocBlockDriverTest.php +++ b/tests/Metadata/Driver/DocBlockDriverTest.php @@ -62,9 +62,7 @@ private function resolve(string $classToResolve): ClassMetadata new NullDriver($namingStrategy), ]); - if (PHP_VERSION_ID > 70400) { - $driver = new TypedPropertiesDriver($driver); - } + $driver = new TypedPropertiesDriver($driver); $driver = new DocBlockDriver($driver); @@ -76,122 +74,86 @@ private function resolve(string $classToResolve): ClassMetadata public function testInferDocBlockCollectionOfScalars() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfScalars::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => 'string', 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testInferDocBlockCollectionAsList(): void { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionAsList::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => 'int', 'params' => []], ['name' => 'string', 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testInferDocBlockCollectionOfClassesFromSameNamespace() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesFromSameNamespace::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => Product::class, 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testInferDocBlockCollectionOfClassesFromUsingFullNamespacePath() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesWithFullNamespacePath::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => Product::class, 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testInferDocBlockCollectionFromGenericLikeClass() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionTypedAsGenericClass::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => Product::class, 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testInferDocBlockMapFromGenericLikeClass() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(MapTypedAsGenericClass::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => 'int', 'params' => []], ['name' => Product::class, 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testInferDocBlockCollectionOfClassesIgnoringNullTypeHint() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesWithNull::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => Product::class, 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testInferDocBlockCollectionOfClassesIgnoringNullTypeHintWithSingleLinePhpDoc() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesWithNullSingleLinePhpDoc::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => Product::class, 'params' => []]]], - $m->propertyMetadata['productIds']->type + $m->propertyMetadata['productIds']->type, ); } public function testThrowingExceptionWhenNotExistingClassWasGiven() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $this->expectException(\InvalidArgumentException::class); $this->resolve(CollectionOfNotExistingClasses::class); @@ -199,149 +161,109 @@ public function testThrowingExceptionWhenNotExistingClassWasGiven() public function testInferDocBlockCollectionOfClassesFromDifferentNamespace() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesFromDifferentNamespace::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductDescription::class, 'params' => []]]], - $m->propertyMetadata['productDescriptions']->type + $m->propertyMetadata['productDescriptions']->type, ); } public function testInferDocBlockCollectionOfClassesFromGlobalNamespace() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesFromGlobalNamespace::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => \stdClass::class, 'params' => []]]], - $m->propertyMetadata['products']->type + $m->propertyMetadata['products']->type, ); } public function testInferDocBlockCollectionOfClassesFromDifferentNamespaceUsingSingleAlias() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesFromDifferentNamespaceUsingSingleAlias::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductDescription::class, 'params' => []]]], - $m->propertyMetadata['productDescriptions']->type + $m->propertyMetadata['productDescriptions']->type, ); } public function testInferDocBlockCollectionOfClassesFromDifferentNamespaceUsingGroupAlias() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesFromDifferentNamespaceUsingGroupAlias::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductDescription::class, 'params' => []]]], - $m->propertyMetadata['productDescriptions']->type + $m->propertyMetadata['productDescriptions']->type, ); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductName::class, 'params' => []]]], - $m->propertyMetadata['productNames']->type + $m->propertyMetadata['productNames']->type, ); } public function testInferDocBlockCollectionOfClassesFromTraits() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesFromTrait::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductDescription::class, 'params' => []]]], - $m->propertyMetadata['productDescriptions']->type + $m->propertyMetadata['productDescriptions']->type, ); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductName::class, 'params' => []]]], - $m->propertyMetadata['productNames']->type + $m->propertyMetadata['productNames']->type, ); } public function testInferDocBlockCollectionOfClassesFromTraitInsideTrait() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfClassesFromTraitInsideTrait::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductDescription::class, 'params' => []]]], - $m->propertyMetadata['productDescriptions']->type + $m->propertyMetadata['productDescriptions']->type, ); } public function testInferDocBlockCollectionOfInterfacesFromDifferentNamespace() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfInterfacesFromDifferentNamespace::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductColor::class, 'params' => []]]], - $m->propertyMetadata['productColors']->type + $m->propertyMetadata['productColors']->type, ); } public function testInferDocBlockCollectionOfInterfacesFromGlobalNamespace() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfInterfacesFromGlobalNamespace::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductColor::class, 'params' => []]]], - $m->propertyMetadata['productColors']->type + $m->propertyMetadata['productColors']->type, ); } public function testInferDocBlockCollectionOfInterfacesFromSameNamespace() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfInterfacesFromSameNamespace::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => Vehicle::class, 'params' => []]]], - $m->propertyMetadata['vehicles']->type + $m->propertyMetadata['vehicles']->type, ); } public function testInferDocBlockCollectionOfInterfacesWithFullNamespacePath() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - $m = $this->resolve(CollectionOfInterfacesWithFullNamespacePath::class); self::assertEquals( ['name' => 'array', 'params' => [['name' => ProductColor::class, 'params' => []]]], - $m->propertyMetadata['productColors']->type + $m->propertyMetadata['productColors']->type, ); } @@ -351,7 +273,7 @@ public function testInferTypeForNonCollectionFromSameNamespaceType() self::assertEquals( ['name' => \stdClass::class, 'params' => []], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -361,7 +283,7 @@ public function testInferTypeForNonCollectionFromDifferentNamespaceType() self::assertEquals( ['name' => ProductDescription::class, 'params' => []], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -371,7 +293,7 @@ public function testInferTypeForNonUnionDocblockType() self::assertEquals( null, - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -385,7 +307,7 @@ public function testInferTypeForConstructorPropertyPromotion() self::assertEquals( ['name' => 'array', 'params' => [['name' => 'string', 'params' => []]]], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -399,7 +321,7 @@ public function testInferTypeForConstructorPropertyPromotionWithoutDocblock() self::assertEquals( null, - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -413,7 +335,7 @@ public function testInferTypeForConstructorPropertyPromotionWithScalar() self::assertEquals( ['name' => 'string', 'params' => []], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -423,7 +345,7 @@ public function testInferTypeForPhpstanArray() self::assertEquals( ['name' => 'array', 'params' => []], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -433,7 +355,7 @@ public function testInferTypeForPhpstanNestedArrayShape() self::assertEquals( ['name' => 'array', 'params' => []], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -443,11 +365,11 @@ public function testInferTypeForMultiplePhpstanArray() self::assertEquals( ['name' => 'array', 'params' => []], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); self::assertEquals( ['name' => 'array', 'params' => []], - $m->propertyMetadata['details']->type + $m->propertyMetadata['details']->type, ); } @@ -457,7 +379,7 @@ public function testInferTypeForPhpstanArrayCollection() self::assertEquals( ['name' => 'array', 'params' => [['name' => 'int', 'params' => []], ['name' => ProductType::class, 'params' => []]]], - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } @@ -467,7 +389,7 @@ public function testInferTypeForVirtualPropertyGetter() self::assertEquals( ['name' => 'array', 'params' => [['name' => 'string', 'params' => []]]], - $m->propertyMetadata['arrayOfStrings']->type + $m->propertyMetadata['arrayOfStrings']->type, ); } @@ -477,17 +399,17 @@ public function testAlternativeNames() self::assertEquals( ['name' => 'integer', 'params' => []], - $m->propertyMetadata['integer']->type + $m->propertyMetadata['integer']->type, ); self::assertEquals( ['name' => 'double', 'params' => []], - $m->propertyMetadata['double']->type + $m->propertyMetadata['double']->type, ); self::assertEquals( ['name' => 'boolean', 'params' => []], - $m->propertyMetadata['boolean']->type + $m->propertyMetadata['boolean']->type, ); } } diff --git a/tests/Metadata/Driver/DocBlockTypeResolverTest.php b/tests/Metadata/Driver/DocBlockTypeResolverTest.php index 2ad9372da..827a8c622 100644 --- a/tests/Metadata/Driver/DocBlockTypeResolverTest.php +++ b/tests/Metadata/Driver/DocBlockTypeResolverTest.php @@ -18,8 +18,8 @@ public function testGetPropertyDocblockTypeHintDoesNotCrash(): void $resolver = new DocBlockTypeResolver(); self::assertNull( $resolver->getPropertyDocblockTypeHint( - new ReflectionProperty(ObjectWithPhpDocProperty::class, 'emptyBlock') - ) + new ReflectionProperty(ObjectWithPhpDocProperty::class, 'emptyBlock'), + ), ); } @@ -29,14 +29,14 @@ public function testGetPropertyDocblockTypeHintDoesNotCrashWhenUnionType(): void self::assertSame( 'string', $resolver->getPropertyDocblockTypeHint( - new ReflectionProperty(ObjectWithPhpDocProperty::class, 'firstname') - ) + new ReflectionProperty(ObjectWithPhpDocProperty::class, 'firstname'), + ), ); self::assertSame( 'string', $resolver->getPropertyDocblockTypeHint( - new ReflectionProperty(ObjectWithPhpDocProperty::class, 'lastname') - ) + new ReflectionProperty(ObjectWithPhpDocProperty::class, 'lastname'), + ), ); } } diff --git a/tests/Metadata/Driver/DoctrineDriverTest.php b/tests/Metadata/Driver/DoctrineDriverTest.php index 1dc3565a4..976f02b91 100644 --- a/tests/Metadata/Driver/DoctrineDriverTest.php +++ b/tests/Metadata/Driver/DoctrineDriverTest.php @@ -42,7 +42,7 @@ public function testTypelessPropertyIsGivenTypeFromDoctrineMetadata() self::assertEquals( ['name' => 'DateTime', 'params' => []], - $metadata->propertyMetadata['createdAt']->type + $metadata->propertyMetadata['createdAt']->type, ); } @@ -51,7 +51,7 @@ public function testSingleValuedAssociationIsProperlyHinted() $metadata = $this->getMetadata(); self::assertEquals( ['name' => 'JMS\Serializer\Tests\Fixtures\Doctrine\Entity\Author', 'params' => []], - $metadata->propertyMetadata['author']->type + $metadata->propertyMetadata['author']->type, ); } @@ -66,7 +66,7 @@ public function testMultiValuedAssociationIsProperlyHinted() ['name' => 'JMS\Serializer\Tests\Fixtures\Doctrine\Entity\Comment', 'params' => []], ], ], - $metadata->propertyMetadata['comments']->type + $metadata->propertyMetadata['comments']->type, ); } @@ -77,7 +77,7 @@ public function testTypeGuessByDoctrineIsOverwrittenByDelegateDriver() // This would be guessed as boolean but we've overriden it to integer self::assertEquals( ['name' => 'integer', 'params' => []], - $metadata->propertyMetadata['published']->type + $metadata->propertyMetadata['published']->type, ); } @@ -125,7 +125,7 @@ public function testGuidPropertyIsGivenStringType() self::assertEquals( ['name' => 'string', 'params' => []], - $metadata->propertyMetadata['guid']->type + $metadata->propertyMetadata['guid']->type, ); } @@ -137,11 +137,11 @@ protected function getEntityManager() if (PHP_VERSION_ID >= 80000 && class_exists(DoctrineAttributeDriver::class)) { $config->setMetadataDriverImpl( - new DoctrineAttributeDriver([__DIR__ . '/../../Fixtures/Doctrine'], true) + new DoctrineAttributeDriver([__DIR__ . '/../../Fixtures/Doctrine'], true), ); } else { $config->setMetadataDriverImpl( - new DoctrineAnnotationDriver(new AnnotationReader(), __DIR__ . '/../../Fixtures/Doctrine') + new DoctrineAnnotationDriver(new AnnotationReader(), __DIR__ . '/../../Fixtures/Doctrine'), ); } @@ -178,7 +178,7 @@ protected function getDoctrineDriver() return new DoctrineTypeDriver( $this->getMetadataDriver(), - $registry + $registry, ); } } diff --git a/tests/Metadata/Driver/DoctrinePHPCRDriverTest.php b/tests/Metadata/Driver/DoctrinePHPCRDriverTest.php index ea1e5980a..b05ac295d 100644 --- a/tests/Metadata/Driver/DoctrinePHPCRDriverTest.php +++ b/tests/Metadata/Driver/DoctrinePHPCRDriverTest.php @@ -35,7 +35,7 @@ public function testTypelessPropertyIsGivenTypeFromDoctrineMetadata() $metadata = $this->getMetadata(); self::assertEquals( ['name' => 'DateTime', 'params' => []], - $metadata->propertyMetadata['createdAt']->type + $metadata->propertyMetadata['createdAt']->type, ); } @@ -44,7 +44,7 @@ public function testSingleValuedAssociationIsProperlyHinted() $metadata = $this->getMetadata(); self::assertEquals( ['name' => 'JMS\Serializer\Tests\Fixtures\DoctrinePHPCR\Author', 'params' => []], - $metadata->propertyMetadata['author']->type + $metadata->propertyMetadata['author']->type, ); } @@ -59,7 +59,7 @@ public function testMultiValuedAssociationIsProperlyHinted() ['name' => 'JMS\Serializer\Tests\Fixtures\DoctrinePHPCR\Comment', 'params' => []], ], ], - $metadata->propertyMetadata['comments']->type + $metadata->propertyMetadata['comments']->type, ); } @@ -70,7 +70,7 @@ public function testTypeGuessByDoctrineIsOverwrittenByDelegateDriver() // This would be guessed as boolean but we've overridden it to integer self::assertEquals( ['name' => 'integer', 'params' => []], - $metadata->propertyMetadata['published']->type + $metadata->propertyMetadata['published']->type, ); } @@ -97,7 +97,7 @@ protected function getDocumentManager() $config->setProxyDir(sys_get_temp_dir() . '/JMSDoctrineTestProxies'); $config->setProxyNamespace('JMS\Tests\Proxies'); $config->setMetadataDriverImpl( - new DoctrinePHPCRDriver(new AnnotationReader(), __DIR__ . '/../../Fixtures/DoctrinePHPCR') + new DoctrinePHPCRDriver(new AnnotationReader(), __DIR__ . '/../../Fixtures/DoctrinePHPCR'), ); $session = $this->getMockBuilder('PHPCR\SessionInterface')->getMock(); @@ -119,7 +119,7 @@ protected function getDoctrinePHPCRDriver() return new DoctrinePHPCRTypeDriver( $this->getAnnotationDriver(), - $registry + $registry, ); } } diff --git a/tests/Metadata/Driver/TypedPropertiesDriverTest.php b/tests/Metadata/Driver/TypedPropertiesDriverTest.php index 618197523..70540d2f1 100644 --- a/tests/Metadata/Driver/TypedPropertiesDriverTest.php +++ b/tests/Metadata/Driver/TypedPropertiesDriverTest.php @@ -15,13 +15,6 @@ class TypedPropertiesDriverTest extends TestCase { - protected function setUp(): void - { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', TypedPropertiesDriver::class)); - } - } - public function testInferPropertiesFromTypes() { $m = $this->resolve(User::class); diff --git a/tests/Metadata/Driver/UnionTypedPropertiesDriverTest.php b/tests/Metadata/Driver/UnionTypedPropertiesDriverTest.php index c3a6357e3..cd3257aa4 100644 --- a/tests/Metadata/Driver/UnionTypedPropertiesDriverTest.php +++ b/tests/Metadata/Driver/UnionTypedPropertiesDriverTest.php @@ -30,7 +30,7 @@ public function testInferUnionTypesShouldResultInNoType() self::assertEquals( null, - $m->propertyMetadata['data']->type + $m->propertyMetadata['data']->type, ); } diff --git a/tests/Metadata/Driver/YamlDriverTest.php b/tests/Metadata/Driver/YamlDriverTest.php index f2a31cc6b..4b528bc94 100644 --- a/tests/Metadata/Driver/YamlDriverTest.php +++ b/tests/Metadata/Driver/YamlDriverTest.php @@ -108,7 +108,7 @@ public function testLoadingMultipleMetadataExtensions(): void BlogPost::class, Person::class, ], - $classNames + $classNames, ); } diff --git a/tests/Ordering/CustomPropertyOrderingStrategyTest.php b/tests/Ordering/CustomPropertyOrderingStrategyTest.php index 065b07beb..73d5be866 100644 --- a/tests/Ordering/CustomPropertyOrderingStrategyTest.php +++ b/tests/Ordering/CustomPropertyOrderingStrategyTest.php @@ -19,7 +19,7 @@ public function testOrder(array $ordering, array $keysToSort, array $expectedRes $properties = array_combine( $keysToSort, - array_pad([], count($keysToSort), $this->createMock(PropertyMetadata::class)) + array_pad([], count($keysToSort), $this->createMock(PropertyMetadata::class)), ); $sortedProperties = $strategy->order($properties); self::assertEquals($expectedResult, array_keys($sortedProperties)); diff --git a/tests/Serializer/ArrayTest.php b/tests/Serializer/ArrayTest.php index a74418438..d548ac96f 100644 --- a/tests/Serializer/ArrayTest.php +++ b/tests/Serializer/ArrayTest.php @@ -44,7 +44,7 @@ public function testToArrayWithScalar($input) $this->expectExceptionMessage(sprintf( 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', gettype($input), - gettype($input) + gettype($input), )); $result = $this->serializer->toArray($input); diff --git a/tests/Serializer/BaseSerializationTestCase.php b/tests/Serializer/BaseSerializationTestCase.php index c30ba90af..7400151ff 100644 --- a/tests/Serializer/BaseSerializationTestCase.php +++ b/tests/Serializer/BaseSerializationTestCase.php @@ -178,7 +178,7 @@ public function testSerializeNullArray() self::assertEquals( static::getContent('nullable'), - $this->serializer->serialize($arr, $this->getFormat(), SerializationContext::create()->setSerializeNull(true)) + $this->serializer->serialize($arr, $this->getFormat(), SerializationContext::create()->setSerializeNull(true)), ); } @@ -189,7 +189,7 @@ public function testSerializeNullRoot() self::assertEquals( static::getContent('nullable_root'), - $this->serializer->serialize(null, $this->getFormat(), $context) + $this->serializer->serialize(null, $this->getFormat(), $context), ); } @@ -207,7 +207,7 @@ public function testDeserializeObjectWithMissingTypedArrayProp() $dObj = $this->serializer->deserialize( static::getContent('empty_object'), ObjectWithTypedArraySetter::class, - $this->getFormat() + $this->getFormat(), ); assert($dObj instanceof ObjectWithTypedArraySetter); @@ -222,7 +222,7 @@ public function testSerializeNullArrayExcludingNulls() self::assertEquals( static::getContent('nullable_skip'), - $this->serializer->serialize($arr, $this->getFormat(), SerializationContext::create()->setSerializeNull(false)) + $this->serializer->serialize($arr, $this->getFormat(), SerializationContext::create()->setSerializeNull(false)), ); } @@ -233,7 +233,7 @@ public function testObjectUsingTypeCasting() self::assertEquals( static::getContent('type_casting'), - $this->serialize($typeAliasing) + $this->serialize($typeAliasing), ); } @@ -243,7 +243,7 @@ public function testSerializeNullObject() self::assertEquals( static::getContent('simple_object_nullable'), - $this->serializer->serialize($obj, $this->getFormat(), SerializationContext::create()->setSerializeNull(true)) + $this->serializer->serialize($obj, $this->getFormat(), SerializationContext::create()->setSerializeNull(true)), ); } @@ -258,7 +258,7 @@ public function testDeserializeNullObject() $dObj = $this->serializer->deserialize( static::getContent('simple_object_nullable'), ObjectWithNullProperty::class, - $this->getFormat() + $this->getFormat(), ); assert($dObj instanceof ObjectWithNullProperty); @@ -1275,10 +1275,6 @@ public function testNestedFormErrors($type) */ public function testFormErrorsWithNonFormComponents($type) { - if (!class_exists('Symfony\Component\Form\Extension\Core\Type\SubmitType')) { - $this->markTestSkipped('Not using Symfony Form >= 2.3 with submit type'); - } - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); $factoryBuilder = new FormFactoryBuilder(); @@ -1388,27 +1384,27 @@ public function testGroups() self::assertEquals( static::getContent('groups_foo'), - $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups(['foo'])) + $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups(['foo'])), ); self::assertEquals( static::getContent('groups_foobar'), - $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups(['foo', 'bar'])) + $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups(['foo', 'bar'])), ); self::assertEquals( static::getContent('groups_all'), - $this->serializer->serialize($groupsObject, $this->getFormat()) + $this->serializer->serialize($groupsObject, $this->getFormat()), ); self::assertEquals( static::getContent('groups_default'), - $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups([GroupsExclusionStrategy::DEFAULT_GROUP])) + $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups([GroupsExclusionStrategy::DEFAULT_GROUP])), ); self::assertEquals( static::getContent('groups_default'), - $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups([GroupsExclusionStrategy::DEFAULT_GROUP])) + $this->serializer->serialize($groupsObject, $this->getFormat(), SerializationContext::create()->setGroups([GroupsExclusionStrategy::DEFAULT_GROUP])), ); } @@ -1422,21 +1418,21 @@ public function testAdvancedGroups() [ new GroupsUser( 'John Manager friend 1', - new GroupsUser('John Manager friend 1 manager') + new GroupsUser('John Manager friend 1 manager'), ), new GroupsUser('John Manager friend 2'), - ] + ], ), [ new GroupsUser( 'John friend 1', - new GroupsUser('John friend 1 manager') + new GroupsUser('John friend 1 manager'), ), new GroupsUser( 'John friend 2', - new GroupsUser('John friend 2 manager') + new GroupsUser('John friend 2 manager'), ), - ] + ], ); self::assertEquals( @@ -1459,8 +1455,8 @@ public function testAdvancedGroups() 'manager_group', 'nickname_group', ], - ]) - ) + ]), + ), ); } @@ -1489,17 +1485,17 @@ public function testVirtualVersions() self::assertEquals( static::getContent('virtual_properties_low'), - $serializer->serialize(new ObjectWithVersionedVirtualProperties(), $this->getFormat(), SerializationContext::create()->setVersion('2')) + $serializer->serialize(new ObjectWithVersionedVirtualProperties(), $this->getFormat(), SerializationContext::create()->setVersion('2')), ); self::assertEquals( static::getContent('virtual_properties_all'), - $serializer->serialize(new ObjectWithVersionedVirtualProperties(), $this->getFormat(), SerializationContext::create()->setVersion('7')) + $serializer->serialize(new ObjectWithVersionedVirtualProperties(), $this->getFormat(), SerializationContext::create()->setVersion('7')), ); self::assertEquals( static::getContent('virtual_properties_high'), - $serializer->serialize(new ObjectWithVersionedVirtualProperties(), $this->getFormat(), SerializationContext::create()->setVersion('9')) + $serializer->serialize(new ObjectWithVersionedVirtualProperties(), $this->getFormat(), SerializationContext::create()->setVersion('9')), ); } @@ -1522,10 +1518,6 @@ public function testCustomHandler() public function testTypedProperties() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', __METHOD__)); - } - $builder = SerializerBuilder::create($this->handlerRegistry, $this->dispatcher); $builder->includeInterfaceMetadata(true); $this->serializer = $builder->build(); @@ -1579,10 +1571,6 @@ public function testConstructorPromotionWithDefaultValues() public function testUninitializedTypedProperties() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped(sprintf('%s requires PHP 7.4', __METHOD__)); - } - $builder = SerializerBuilder::create($this->handlerRegistry, $this->dispatcher); $builder->includeInterfaceMetadata(true); $this->serializer = $builder->build(); @@ -1634,12 +1622,12 @@ public function testSerializeObjectWhenNull() { self::assertEquals( static::getContent('object_when_null'), - $this->serialize(new Comment(null, 'foo'), SerializationContext::create()->setSerializeNull(false)) + $this->serialize(new Comment(null, 'foo'), SerializationContext::create()->setSerializeNull(false)), ); self::assertEquals( static::getContent('object_when_null_and_serialized'), - $this->serialize(new Comment(null, 'foo'), SerializationContext::create()->setSerializeNull(true)) + $this->serialize(new Comment(null, 'foo'), SerializationContext::create()->setSerializeNull(true)), ); } @@ -1653,7 +1641,7 @@ public function testPolymorphicObjectsWithGroup() self::assertEquals( static::getContent('car'), - $this->serialize(new DiscriminatorGroupCar(5), $context) + $this->serialize(new DiscriminatorGroupCar(5), $context), ); } @@ -1680,7 +1668,7 @@ public function testDiscrimatorObjects($data, $contentId) $context = SerializationContext::create()->setGroups(['entity.identification']); self::assertEquals( static::getContent($contentId), - $this->serialize($data, $context) + $this->serialize($data, $context), ); } @@ -1691,15 +1679,15 @@ public function testPolymorphicObjects() { self::assertEquals( static::getContent('car'), - $this->serialize(new Car(5)) + $this->serialize(new Car(5)), ); self::assertEquals( static::getContent('post'), - $this->serialize(new Post('Post Title')) + $this->serialize(new Post('Post Title')), ); self::assertEquals( static::getContent('image_post'), - $this->serialize(new ImagePost('Image Post Title')) + $this->serialize(new ImagePost('Image Post Title')), ); if ($this->hasDeserializer()) { @@ -1707,54 +1695,54 @@ public function testPolymorphicObjects() new Car(5), $this->deserialize( static::getContent('car'), - 'JMS\Serializer\Tests\Fixtures\Discriminator\Car' + 'JMS\Serializer\Tests\Fixtures\Discriminator\Car', ), - 'Class is resolved correctly when concrete sub-class is used.' + 'Class is resolved correctly when concrete sub-class is used.', ); self::assertEquals( new Car(5), $this->deserialize( static::getContent('car'), - 'JMS\Serializer\Tests\Fixtures\Discriminator\Vehicle' + 'JMS\Serializer\Tests\Fixtures\Discriminator\Vehicle', ), - 'Class is resolved correctly when least supertype is used.' + 'Class is resolved correctly when least supertype is used.', ); self::assertEquals( new Car(5), $this->deserialize( static::getContent('car_without_type'), - 'JMS\Serializer\Tests\Fixtures\Discriminator\Car' + 'JMS\Serializer\Tests\Fixtures\Discriminator\Car', ), - 'Class is resolved correctly when concrete sub-class is used and no type is defined.' + 'Class is resolved correctly when concrete sub-class is used and no type is defined.', ); self::assertEquals( new Post('Post Title'), $this->deserialize( static::getContent('post'), - 'JMS\Serializer\Tests\Fixtures\Discriminator\Post' + 'JMS\Serializer\Tests\Fixtures\Discriminator\Post', ), - 'Class is resolved correctly when parent class is used and type is set.' + 'Class is resolved correctly when parent class is used and type is set.', ); self::assertEquals( new ImagePost('Image Post Title'), $this->deserialize( static::getContent('image_post'), - 'JMS\Serializer\Tests\Fixtures\Discriminator\Post' + 'JMS\Serializer\Tests\Fixtures\Discriminator\Post', ), - 'Class is resolved correctly when least supertype is used.' + 'Class is resolved correctly when least supertype is used.', ); self::assertEquals( new ImagePost('Image Post Title'), $this->deserialize( static::getContent('image_post'), - 'JMS\Serializer\Tests\Fixtures\Discriminator\ImagePost' + 'JMS\Serializer\Tests\Fixtures\Discriminator\ImagePost', ), - 'Class is resolved correctly when concrete sub-class is used and no type is defined.' + 'Class is resolved correctly when concrete sub-class is used and no type is defined.', ); } } @@ -1767,7 +1755,7 @@ public function testNestedPolymorphicObjects() $garage = new Garage([new Car(3), new Moped(1)]); self::assertEquals( static::getContent('garage'), - $this->serialize($garage) + $this->serialize($garage), ); if ($this->hasDeserializer()) { @@ -1775,8 +1763,8 @@ public function testNestedPolymorphicObjects() $garage, $this->deserialize( static::getContent('garage'), - 'JMS\Serializer\Tests\Fixtures\Garage' - ) + 'JMS\Serializer\Tests\Fixtures\Garage', + ), ); } } @@ -1789,7 +1777,7 @@ public function testNestedPolymorphicInterfaces() $garage = new VehicleInterfaceGarage([new Car(3), new Moped(1)]); self::assertEquals( static::getContent('garage'), - $this->serialize($garage) + $this->serialize($garage), ); if ($this->hasDeserializer()) { @@ -1797,8 +1785,8 @@ public function testNestedPolymorphicInterfaces() $garage, $this->deserialize( static::getContent('garage'), - 'JMS\Serializer\Tests\Fixtures\VehicleInterfaceGarage' - ) + 'JMS\Serializer\Tests\Fixtures\VehicleInterfaceGarage', + ), ); } } @@ -1816,7 +1804,7 @@ public function testPolymorphicObjectsInvalidDeserialization() $this->deserialize( static::getContent('car_without_type'), - 'JMS\Serializer\Tests\Fixtures\Discriminator\Vehicle' + 'JMS\Serializer\Tests\Fixtures\Discriminator\Vehicle', ); } @@ -1834,7 +1822,7 @@ public function testDepthExclusionStrategy() ]), ]), ]), - ]) + ]), ); self::assertEquals(static::getContent('tree'), $this->serializer->serialize($data, $this->getFormat(), $context)); @@ -1891,7 +1879,7 @@ public function testDeserializingIntoExistingObject() static::getContent('order'), get_class($order), $this->getFormat(), - $context + $context, ); self::assertSame($order, $deseralizedOrder); @@ -1920,7 +1908,7 @@ public function testSerializeNullArrayObjectWithExclusionStrategy(bool $serializ $serializationContext->addExclusionStrategy(new AlwaysExcludeExclusionStrategy()); self::assertEquals( static::getContent('array_objects_nullable'), - $this->serializer->serialize($arr, $this->getFormat(), $serializationContext) + $this->serializer->serialize($arr, $this->getFormat(), $serializationContext), ); } @@ -1936,7 +1924,7 @@ static function ($visitor, $data) use (&$invoked) { self::assertEquals('foo', $data); return null; - } + }, ); $this->serializer->serialize('foo', $this->getFormat(), null, 'Virtual'); @@ -1967,7 +1955,7 @@ public function testFirstClassListCollections($items, $expected, ?FirstClassList self::assertSame($expected, $this->serialize($collection)); self::assertEquals( $expectedDeserializatrion ?: $collection, - $this->deserialize($expected, get_class($collection)) + $this->deserialize($expected, get_class($collection)), ); } @@ -2039,7 +2027,7 @@ public function testIterable(): void self::assertEquals( new ObjectWithIterable(Functions::iterableToArray($generator())), - $this->deserialize(static::getContent('iterable'), get_class($withIterable)) + $this->deserialize(static::getContent('iterable'), get_class($withIterable)), ); } @@ -2058,7 +2046,7 @@ public function testGenerator(): void self::assertEquals( $withGenerator, - $this->deserialize(static::getContent('generator'), get_class($withGenerator)) + $this->deserialize(static::getContent('generator'), get_class($withGenerator)), ); } @@ -2077,7 +2065,7 @@ public function testIterator(): void self::assertEquals( $withIterator, - $this->deserialize(static::getContent('iterator'), get_class($withIterator)) + $this->deserialize(static::getContent('iterator'), get_class($withIterator)), ); } @@ -2096,7 +2084,7 @@ public function testArrayIterator(): void self::assertEquals( $withArrayIterator, - $this->deserialize(static::getContent('iterator'), get_class($withArrayIterator)) + $this->deserialize(static::getContent('iterator'), get_class($withArrayIterator)), ); } @@ -2144,7 +2132,7 @@ protected function setUp(): void $this->getFormat(), static function (SerializationVisitorInterface $visitor, $object, array $type, Context $context) { return $visitor->visitArray(iterator_to_array($object), $type); - } + }, ); $this->handlerRegistry->registerHandler( GraphNavigatorInterface::DIRECTION_DESERIALIZATION, @@ -2166,7 +2154,7 @@ static function (DeserializationVisitorInterface $visitor, $data, $type, Context } return $list; - } + }, ); $this->dispatcher = new EventDispatcher(); diff --git a/tests/Serializer/Doctrine/IntegrationTest.php b/tests/Serializer/Doctrine/IntegrationTest.php index ca17e247d..fcee0228a 100644 --- a/tests/Serializer/Doctrine/IntegrationTest.php +++ b/tests/Serializer/Doctrine/IntegrationTest.php @@ -100,7 +100,7 @@ static function ($id) use ($connection, $entityManager) { default: throw new \RuntimeException(sprintf('Unknown service id "%s".', $id)); } - } + }, ); $this->serializer = SerializerBuilder::create() @@ -109,7 +109,7 @@ static function (array $metadataDirs, Reader $annotationReader) use ($registry) $defaultFactory = new DefaultDriverFactory(new IdenticalPropertyNamingStrategy()); return new DoctrineTypeDriver($defaultFactory->createDriver($metadataDirs, $annotationReader), $registry); - } + }, )) ->build(); diff --git a/tests/Serializer/Doctrine/ObjectConstructorTest.php b/tests/Serializer/Doctrine/ObjectConstructorTest.php index f6725d928..6faf53ead 100644 --- a/tests/Serializer/Doctrine/ObjectConstructorTest.php +++ b/tests/Serializer/Doctrine/ObjectConstructorTest.php @@ -58,6 +58,7 @@ use ReflectionClass; use RuntimeException; use SimpleXMLElement; + use function assert; class ObjectConstructorTest extends TestCase @@ -271,7 +272,7 @@ public function testNamingForIdentifierColumnIsConsidered() self::assertSame( $em->getUnitOfWork()->getEntityState($serverDeserialized), - UnitOfWork::STATE_MANAGED + UnitOfWork::STATE_MANAGED, ); } @@ -326,7 +327,7 @@ public function testPersistendCollectionIsNotReplaced(string $data, string $type self::assertSame( $em->getUnitOfWork()->getEntityState($smartPhoneDeserialized), - UnitOfWork::STATE_MANAGED + UnitOfWork::STATE_MANAGED, ); self::assertInstanceOf(PersistentCollection::class, $smartPhoneDeserialized->getAppsRaw()); @@ -336,14 +337,14 @@ public function testPersistendCollectionIsNotReplaced(string $data, string $type self::assertCount( 1, $smartPhoneDeserialized->getApps( - $criteria - ) + $criteria, + ), ); $firstApp = $smartPhoneDeserialized->getApps()->first(); self::assertSame( $em->getUnitOfWork()->getEntityState($firstApp), - UnitOfWork::STATE_MANAGED + UnitOfWork::STATE_MANAGED, ); $em->flush(); @@ -375,7 +376,7 @@ static function ($id) use ($connection, $entityManager) { default: throw new RuntimeException(sprintf('Unknown service id "%s".', $id)); } - } + }, ); $type = ['name' => BlogPostSeo::class, 'params' => []]; @@ -405,7 +406,7 @@ static function ($id) use ($connection, $entityManager) { default: throw new RuntimeException(sprintf('Unknown service id "%s".', $id)); } - } + }, ); $type = ['name' => BlogPostSeo::class, 'params' => []]; @@ -486,7 +487,7 @@ static function ($id) use ($connection, $entityManager) { default: throw new RuntimeException(sprintf('Unknown service id "%s".', $id)); } - } + }, ); $this->driver = &$driver; @@ -496,7 +497,7 @@ static function (array $metadataDirs, Reader $annotationReader) use ($registry, $defaultFactory = new DefaultDriverFactory(new IdenticalPropertyNamingStrategy()); return $driver = new DoctrineTypeDriver($defaultFactory->createDriver($metadataDirs, $annotationReader), $registry); - } + }, )) ->build(); @@ -573,16 +574,16 @@ private function createSerializerWithDoctrineObjectConstructor() new DoctrineObjectConstructor( $this->registry, new UnserializeObjectConstructor(), - DoctrineObjectConstructor::ON_MISSING_FALLBACK - ) + DoctrineObjectConstructor::ON_MISSING_FALLBACK, + ), ) ->addDefaultHandlers() ->configureHandlers(function (HandlerRegistryInterface $handlerRegistry) { $handlerRegistry->registerSubscribingHandler( new ArrayCollectionHandler( true, - $this->registry - ) + $this->registry, + ), ); }) ->build(); diff --git a/tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorValidatorSubscriberTest.php b/tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorValidatorSubscriberTest.php index d318a421b..68f9cf020 100644 --- a/tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorValidatorSubscriberTest.php +++ b/tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorValidatorSubscriberTest.php @@ -80,7 +80,7 @@ public function testValidationIsOnlyPerformedOnRootObject(): void '{"authors":[{"full_name":"foo"},{"full_name":"bar"}]}', AuthorList::class, 'json', - DeserializationContext::create()->setAttribute('validation_groups', ['Foo']) + DeserializationContext::create()->setAttribute('validation_groups', ['Foo']), ); self::assertCount(2, $list); diff --git a/tests/Serializer/JsonSerializationTest.php b/tests/Serializer/JsonSerializationTest.php index af8c57996..0c6800e89 100644 --- a/tests/Serializer/JsonSerializationTest.php +++ b/tests/Serializer/JsonSerializationTest.php @@ -182,7 +182,7 @@ public function testFirstClassMapCollections($items, $expected): void self::assertSame($expected, $this->serialize($collection)); self::assertEquals( $collection, - $this->deserialize($expected, get_class($collection)) + $this->deserialize($expected, get_class($collection)), ); } @@ -204,7 +204,7 @@ public function testAddLinksToOutput() 'json', static function (SerializationVisitorInterface $visitor, AuthorList $data, array $type, Context $context) { return $visitor->visitArray(iterator_to_array($data), $type); - } + }, ); $list = new AuthorList(); @@ -223,7 +223,7 @@ public function testReplaceNameInOutput() 'json', static function (SerializationVisitorInterface $visitor, AuthorList $data, array $type, Context $context) { return $visitor->visitArray(iterator_to_array($data), $type); - } + }, ); $list = new AuthorList(); diff --git a/tests/Serializer/Type/ParserTest.php b/tests/Serializer/Type/ParserTest.php index 6fd9f0551..eecdab5ab 100644 --- a/tests/Serializer/Type/ParserTest.php +++ b/tests/Serializer/Type/ParserTest.php @@ -26,7 +26,7 @@ public function testParse(string $sourceType, array $expectedType): void { self::assertSame( $expectedType, - $this->parser->parse($sourceType) + $this->parser->parse($sourceType), ); } diff --git a/tests/Serializer/XmlSerializationTest.php b/tests/Serializer/XmlSerializationTest.php index 3701d95e3..6fcb01c77 100644 --- a/tests/Serializer/XmlSerializationTest.php +++ b/tests/Serializer/XmlSerializationTest.php @@ -83,7 +83,7 @@ public function testAccessorSetterDeserialization() collectionEntry ', - 'JMS\Serializer\Tests\Fixtures\AccessorSetter' + 'JMS\Serializer\Tests\Fixtures\AccessorSetter', ); \assert($object instanceof AccessorSetter); @@ -171,7 +171,7 @@ public function testVirtualAttributes() { self::assertEquals( self::getContent('virtual_attributes'), - $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['attributes'])) + $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['attributes'])), ); } @@ -179,7 +179,7 @@ public function testVirtualValues() { self::assertEquals( self::getContent('virtual_values'), - $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['values'])) + $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['values'])), ); } @@ -187,7 +187,7 @@ public function testVirtualXmlList() { self::assertEquals( self::getContent('virtual_properties_list'), - $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['list'])) + $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['list'])), ); } @@ -195,7 +195,7 @@ public function testVirtualXmlMap() { self::assertEquals( self::getContent('virtual_properties_map'), - $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['map'])) + $this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(['map'])), ); } @@ -234,11 +234,11 @@ public function testObjectWithNamespacesAndList() self::assertEquals( self::getContent('object_with_namespaces_and_list'), - $this->serialize($object, SerializationContext::create()) + $this->serialize($object, SerializationContext::create()), ); self::assertEquals( $object, - $this->deserialize(self::getContent('object_with_namespaces_and_list'), get_class($object)) + $this->deserialize(self::getContent('object_with_namespaces_and_list'), get_class($object)), ); } @@ -261,11 +261,11 @@ public function testObjectWithNamespaceAndNestedList() self::assertEquals( self::getContent('object_with_namespaces_and_nested_list'), - $this->serialize($object, SerializationContext::create()) + $this->serialize($object, SerializationContext::create()), ); self::assertEquals( $object, - $this->deserialize(self::getContent('object_with_namespaces_and_nested_list'), get_class($object)) + $this->deserialize(self::getContent('object_with_namespaces_and_nested_list'), get_class($object)), ); } @@ -356,7 +356,7 @@ public function testObjectWithOnlyNamespacesAndList() self::assertEquals( self::getContent('object_with_only_namespaces_and_list'), - $this->serialize($object, SerializationContext::create()) + $this->serialize($object, SerializationContext::create()), ); $deserialized = $this->deserialize(self::getContent('object_with_only_namespaces_and_list'), get_class($object)); @@ -423,7 +423,7 @@ static function (XmlSerializationVisitor $visitor, $data, $type, Context $contex $metadata->xmlNamespace = $classMetadata->xmlRootNamespace; $visitor->visitProperty($metadata, $author); - } + }, ); $serialized = $this->serialize($object); @@ -481,8 +481,8 @@ public function testDiscriminatorAsXmlAttribute() ObjectWithXmlAttributeDiscriminatorChild::class, $this->deserialize( $xml, - ObjectWithXmlAttributeDiscriminatorParent::class - ) + ObjectWithXmlAttributeDiscriminatorParent::class, + ), ); } @@ -494,8 +494,8 @@ public function testDiscriminatorAsNotCData() ObjectWithXmlNotCDataDiscriminatorChild::class, $this->deserialize( $xml, - ObjectWithXmlNotCDataDiscriminatorParent::class - ) + ObjectWithXmlNotCDataDiscriminatorParent::class, + ), ); } @@ -508,8 +508,8 @@ public function testDiscriminatorWithNamespace() ObjectWithXmlNamespaceDiscriminatorChild::class, $this->deserialize( $xml, - ObjectWithXmlNamespaceDiscriminatorParent::class - ) + ObjectWithXmlNamespaceDiscriminatorParent::class, + ), ); } @@ -522,8 +522,8 @@ public function testDiscriminatorAsXmlAttributeWithNamespace() ObjectWithXmlNamespaceAttributeDiscriminatorChild::class, $this->deserialize( $xml, - ObjectWithXmlNamespaceAttributeDiscriminatorParent::class - ) + ObjectWithXmlNamespaceAttributeDiscriminatorParent::class, + ), ); } @@ -575,7 +575,7 @@ public function testSerialisationWithPrecisionForFloat(): void 1.555, 1.5, 1.555, - 1.555 + 1.555, ); $result = $this->serialize($objectWithFloat, SerializationContext::create()); @@ -593,7 +593,7 @@ public function testSerialisationWithPrecisionForFloat(): void 1.6 1.560 ', - $result + $result, ); } diff --git a/tests/SerializerBuilderTest.php b/tests/SerializerBuilderTest.php index 8551ae2c5..232bcfdd3 100644 --- a/tests/SerializerBuilderTest.php +++ b/tests/SerializerBuilderTest.php @@ -102,7 +102,7 @@ public function testDoesNotAddOtherVisitorsWhenConfiguredExplicitly() { self::assertSame( $this->builder, - $this->builder->setSerializationVisitor('json', new JsonSerializationVisitorFactory()) + $this->builder->setSerializationVisitor('json', new JsonSerializationVisitorFactory()), ); $this->expectException(UnsupportedFormatException::class); @@ -115,22 +115,22 @@ public function testIncludeInterfaceMetadata() { self::assertFalse( $this->getIncludeInterfaces($this->builder), - 'Interface metadata are not included by default' + 'Interface metadata are not included by default', ); self::assertTrue( $this->getIncludeInterfaces($this->builder->includeInterfaceMetadata(true)), - 'Force including interface metadata' + 'Force including interface metadata', ); self::assertFalse( $this->getIncludeInterfaces($this->builder->includeInterfaceMetadata(false)), - 'Force not including interface metadata' + 'Force not including interface metadata', ); self::assertSame( $this->builder, - $this->builder->includeInterfaceMetadata(true) + $this->builder->includeInterfaceMetadata(true), ); } diff --git a/tests/Twig/SerializerExtensionTest.php b/tests/Twig/SerializerExtensionTest.php index 2ef2b14af..79c729f4a 100644 --- a/tests/Twig/SerializerExtensionTest.php +++ b/tests/Twig/SerializerExtensionTest.php @@ -32,7 +32,7 @@ public function testSerialize() self::assertEquals( [new TwigFunction('serialization_context', '\JMS\Serializer\SerializationContext::create')], - $serializerExtension->getFunctions() + $serializerExtension->getFunctions(), ); } @@ -55,7 +55,7 @@ public function testSerializeWithPrefix() self::assertEquals( [new TwigFunction('foo_serialization_context', '\JMS\Serializer\SerializationContext::create')], - $serializerExtension->getFunctions() + $serializerExtension->getFunctions(), ); } @@ -80,11 +80,11 @@ public function testRuntimeSerializerExtension() self::assertEquals('jms_serializer', $serializerExtension->getName()); self::assertEquals( [new TwigFilter('serialize', [SerializerRuntimeHelper::class, 'serialize'])], - $serializerExtension->getFilters() + $serializerExtension->getFilters(), ); self::assertEquals( [new TwigFunction('serialization_context', '\JMS\Serializer\SerializationContext::create')], - $serializerExtension->getFunctions() + $serializerExtension->getFunctions(), ); } } From 90a077d5045a917411f7cc233ce957ec8e0c7272 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sun, 10 Dec 2023 10:41:06 -0600 Subject: [PATCH 2/2] Update .github/workflows/benchmark.yaml Co-authored-by: Marcin Czarnecki --- .github/workflows/benchmark.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 4dd2b6f26..596977094 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -15,8 +15,7 @@ jobs: matrix: php-version: - "7.4" - - "8.0" - - "8.1" + - "8.2" steps: - name: Checkout code