diff --git a/.travis.yml b/.travis.yml index 6a3ea0e..abcda6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,8 @@ env: - DEPENDENCIES='beta' php: - - 7.0 - - 7.1 - 7.2 + - 7.4 install: - if [[ $DEPENDENCIES = 'beta' ]]; then composer config minimum-stability beta; fi diff --git a/src/Context/ApiContext.php b/src/Context/ApiContext.php index 8b01d04..6f99e30 100644 --- a/src/Context/ApiContext.php +++ b/src/Context/ApiContext.php @@ -364,7 +364,7 @@ public function validateCollectionIsEmpty(string $name) */ public function printCollectionJsonSchema(string $name) { - echo json_encode($this->schemaGenerator->generate($this->helper->getReflectionClass($name), ['collection' => true, 'root' => true]), JSON_PRETTY_PRINT); + echo json_encode($this->schemaGenerator->generate($this->helper->getReflectionClass($name), ['collection' => true, 'root' => true]), \JSON_PRETTY_PRINT); } /** @@ -372,7 +372,7 @@ public function printCollectionJsonSchema(string $name) */ public function printItemJsonSchema(string $name) { - echo json_encode($this->schemaGenerator->generate($this->helper->getReflectionClass($name), ['collection' => false, 'root' => true]), JSON_PRETTY_PRINT); + echo json_encode($this->schemaGenerator->generate($this->helper->getReflectionClass($name), ['collection' => false, 'root' => true]), \JSON_PRETTY_PRINT); } /** @@ -380,7 +380,7 @@ public function printItemJsonSchema(string $name) */ public function printJsonData() { - echo json_encode($this->lastRequestJson, JSON_PRETTY_PRINT); + echo json_encode($this->lastRequestJson, \JSON_PRETTY_PRINT); } private function findObject(string $name, $value) diff --git a/src/Populator/Populator.php b/src/Populator/Populator.php index bf7e553..8216893 100644 --- a/src/Populator/Populator.php +++ b/src/Populator/Populator.php @@ -92,7 +92,7 @@ public function getObject(\ReflectionClass $reflectionClass, array $values = []) foreach (array_merge($classMetadata->getFieldNames(), $classMetadata->getAssociationNames()) as $property) { $mapping = $this->getMapping($classMetadata, $property); // Property is already filled, or is not required, or a primary key (except for association primary key) - if (array_key_exists($property, $values) || $mapping['nullable'] || ($classMetadata->isIdentifier($property) && $classMetadata->hasField($property))) { + if (\array_key_exists($property, $values) || $mapping['nullable'] || ($classMetadata->isIdentifier($property) && $classMetadata->hasField($property))) { continue; } if ($reflectionClass->hasProperty($property)) { @@ -147,7 +147,7 @@ public function getRequestData(\ReflectionClass $reflectionClass, string $operat /** @var ClassMetadataInfo $classMetadata */ $classMetadata = $this->registry->getManagerForClass($className)->getClassMetadata($className); foreach ($this->propertyInfo->getProperties($className, $groups ? ['serializer_groups' => $groups] : []) as $property) { - if (!$reflectionClass->hasProperty($property) || !$this->isRequired($reflectionClass->getProperty($property), $validationGroups) || array_key_exists($property, $values) || ('put' === $operation && 0 < \count($originalValues))) { + if (!$reflectionClass->hasProperty($property) || !$this->isRequired($reflectionClass->getProperty($property), $validationGroups) || \array_key_exists($property, $values) || ('put' === $operation && 0 < \count($originalValues))) { continue; } $values[$property] = $this->guesser->getValue($this->getMapping($classMetadata, $property)); @@ -182,7 +182,7 @@ public function getMapping(ClassMetadataInfo $classMetadata, string $property): $this->mapping[$className][$fieldName] = $classMetadata->getFieldMapping($fieldName); } foreach ($this->propertyInfo->getProperties($className) as $fieldName) { - if (array_key_exists($fieldName, $this->mapping[$className])) { + if (\array_key_exists($fieldName, $this->mapping[$className])) { continue; } @@ -246,6 +246,6 @@ private function filterOperations(array $operations, string $operation): array { return array_filter($operations, function ($value, $key) use ($operation) { return $operation === (\is_int($key) ? $value : $key); - }, ARRAY_FILTER_USE_BOTH); + }, \ARRAY_FILTER_USE_BOTH); } } diff --git a/src/SchemaGenerator/ObjectSchemaGenerator.php b/src/SchemaGenerator/ObjectSchemaGenerator.php index be30f88..875d787 100644 --- a/src/SchemaGenerator/ObjectSchemaGenerator.php +++ b/src/SchemaGenerator/ObjectSchemaGenerator.php @@ -94,7 +94,7 @@ public function generate(\ReflectionClass $reflectionClass, array $context = []) $context['depth'] = 0; } if ($context['depth'] > self::MAX_DEPTH) { - throw new MaxDepthException(sprintf('Maximum depth of %d has been reached. This could be caused by a circular reference due to serialization groups.%sPath: %s', self::MAX_DEPTH, PHP_EOL, implode('->', $this->path))); + throw new MaxDepthException(sprintf('Maximum depth of %d has been reached. This could be caused by a circular reference due to serialization groups.%sPath: %s', self::MAX_DEPTH, \PHP_EOL, implode('->', $this->path))); } ++$context['depth']; $className = $reflectionClass->name; diff --git a/src/Transformer/EntityTransformer.php b/src/Transformer/EntityTransformer.php index 60583d8..c5b2bf7 100644 --- a/src/Transformer/EntityTransformer.php +++ b/src/Transformer/EntityTransformer.php @@ -76,7 +76,7 @@ public function toObject(array $mapping, $value) break; case Type::GUID: // Support for PostgreSQL native type - if (!\preg_match('/^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$/', (string) $value)) { + if (!preg_match('/^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$/', (string) $value)) { $type = 'invalid'; } break; @@ -84,7 +84,7 @@ public function toObject(array $mapping, $value) case Type::DATETIME: case Type::DATETIMETZ: // Support for PostgreSQL native type - if (!\preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/', (string) $value)) { + if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/', (string) $value)) { $type = 'invalid'; } break;