From 4476805d42ddc040aa1a1b4fe512ea2e100757be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Wed, 17 Feb 2021 14:12:07 +0100 Subject: [PATCH] PHP CS. --- .php_cs.dist | 7 ++++--- src/php/Command/NgModelGenerateCommand.php | 13 +++++++------ src/php/Command/NgModelMetadataCommand.php | 11 ++++++----- .../NgModelGeneratorExtension.php | 7 ++++--- src/php/Exceptions/BadMethodCallException.php | 5 +++-- src/php/Exceptions/DomainException.php | 5 +++-- src/php/Exceptions/Exception.php | 5 +++-- src/php/Exceptions/InvalidArgumentException.php | 5 +++-- src/php/Exceptions/TypeAlreadyExistsException.php | 5 +++-- src/php/Exceptions/TypeError.php | 5 +++-- src/php/Exceptions/TypeNotFoundException.php | 5 +++-- .../Iterators/CallbackFilterRecursorIterator.php | 7 ++++--- src/php/Iterators/IteratorBuilder.php | 5 +++-- src/php/Iterators/RecursiveUniqueIterator.php | 5 +++-- src/php/Iterators/RecursorIterator.php | 5 +++-- src/php/Iterators/UniqueFilter.php | 7 ++++--- src/php/Iterators/UniqueIterator.php | 5 +++-- src/php/Iterators/UniqueIteratorTrait.php | 5 +++-- src/php/Metadata/CachingMetadataFactory.php | 5 +++-- src/php/Metadata/ClassHierarchy.php | 5 +++-- src/php/Metadata/MetadataFactory.php | 11 ++++++----- src/php/Metadata/MetadataFactoryInterface.php | 5 +++-- src/php/Metadata/OperationDef.php | 11 ++++++----- src/php/Metadata/OperationMetadata.php | 7 ++++--- src/php/Metadata/PaginationMetadata.php | 7 ++++--- src/php/Metadata/PropertyMetadata.php | 7 ++++--- src/php/Metadata/PropertyMetadataFactory.php | 5 +++-- src/php/Metadata/RepresentationMetadata.php | 7 ++++--- src/php/Metadata/ResourceClassHierarchy.php | 5 +++-- src/php/Metadata/ResourceMetadata.php | 7 ++++--- src/php/Metadata/SerializationMetadata.php | 9 +++++---- src/php/ModelGenerator.php | 5 +++-- src/php/Models/ClassInfo.php | 13 +++++++------ src/php/Models/ClassName.php | 5 +++-- src/php/Models/Declaration.php | 5 +++-- src/php/Models/DeclarationTrait.php | 5 +++-- src/php/Models/HasName.php | 5 +++-- src/php/Models/MultitonTrait.php | 5 +++-- src/php/Models/NamedTrait.php | 5 +++-- src/php/Models/PHPClass.php | 9 +++++---- src/php/Models/Types/AbstractCollection.php | 5 +++-- src/php/Models/Types/AbstractType.php | 11 ++++++----- src/php/Models/Types/Alias.php | 5 +++-- src/php/Models/Types/ArrayType.php | 5 +++-- src/php/Models/Types/BuiltinType.php | 7 ++++--- src/php/Models/Types/Deferred.php | 5 +++-- .../Types/Objects/AbstractHierarchicalObject.php | 5 +++-- src/php/Models/Types/Objects/AnonymousObject.php | 7 ++++--- src/php/Models/Types/Objects/ClassType.php | 5 +++-- src/php/Models/Types/Objects/InterfaceType.php | 5 +++-- src/php/Models/Types/Objects/Property.php | 7 ++++--- src/php/Models/Types/Objects/Repository.php | 5 +++-- src/php/Models/Types/Operations/AnyPathPart.php | 5 +++-- src/php/Models/Types/Operations/FixedPathPart.php | 9 +++++---- src/php/Models/Types/Operations/Operation.php | 7 ++++--- src/php/Models/Types/Operations/Parameter.php | 5 +++-- .../Models/Types/Operations/ParameterPathPart.php | 7 ++++--- src/php/Models/Types/Operations/Path.php | 15 ++++++++------- src/php/Models/Types/Operations/PathPart.php | 7 ++++--- src/php/Models/Types/Placeholder.php | 7 ++++--- src/php/Models/Types/Reference.php | 9 +++++---- src/php/Models/Types/Resources/Collection.php | 5 +++-- src/php/Models/Types/Resources/IRI.php | 5 +++-- src/php/Models/Types/Resources/Representation.php | 5 +++-- src/php/Models/Types/Resources/UUID.php | 5 +++-- src/php/Models/Types/StringConst.php | 7 ++++--- src/php/Models/Types/Type.php | 9 +++++---- src/php/Models/Types/Union.php | 7 ++++--- src/php/Models/Types/Unresolved.php | 9 +++++---- src/php/NgModelGeneratorBundle.php | 5 +++-- src/php/OperationMapper.php | 13 +++++++------ src/php/PathParser.php | 7 ++++--- src/php/PathParserInterface.php | 5 +++-- src/php/SerializationMapper.php | 7 ++++--- src/php/SerializationMapperFactory.php | 5 +++-- src/php/SerializationMapperFactoryInterface.php | 5 +++-- src/php/Twig/GeneratorExtension.php | 5 +++-- src/php/TypeFactory.php | 5 +++-- src/php/TypeFactoryInterface.php | 5 +++-- src/php/TypescriptHelper.php | 5 +++-- src/php/Writers/ConsoleWriter.php | 5 +++-- src/php/Writers/DirectoryWriter.php | 7 ++++--- src/php/Writers/FilteringFileWriter.php | 5 +++-- src/php/Writers/MultiFileWriter.php | 5 +++-- src/php/Writers/NullWriter.php | 5 +++-- src/php/Writers/PhonyFileWriter.php | 5 +++-- src/php/Writers/StreamWriter.php | 5 +++-- src/php/Writers/Writer.php | 5 +++-- src/php/Writers/ZipFileWriter.php | 5 +++-- src/php/Writers/ZipWriter.php | 5 +++-- tests/Fixtures/Controller/CustomController.php | 5 +++-- tests/Fixtures/Entity/EntityWithAccessors.php | 5 +++-- tests/Fixtures/Entity/EntityWithCustomMethods.php | 5 +++-- tests/Fixtures/Entity/EntityWithDTO.php | 5 +++-- .../Entity/EntityWithIntegerIdentifier.php | 5 +++-- tests/Fixtures/Entity/EntityWithNullable.php | 13 +++++++------ tests/Fixtures/Entity/EntityWithRelations.php | 5 +++-- tests/Fixtures/Entity/Person.php | 5 +++-- tests/Fixtures/Entity/Project.php | 5 +++-- tests/Fixtures/TestKernel.php | 9 +++++---- tests/Fixtures/ValueObject/InputDTO.php | 5 +++-- tests/Fixtures/ValueObject/OutputDTO.php | 5 +++-- tests/Functional/AccessorTest.php | 8 ++++---- tests/Functional/CustomMethodTest.php | 8 ++++---- tests/Functional/DTOTest.php | 8 ++++---- tests/Functional/GenerationTestCase.php | 7 ++++--- tests/Functional/IntegerIdentifierTest.php | 8 ++++---- tests/Functional/NullableTest.php | 8 ++++---- tests/Functional/ProjectResourceTest.php | 10 +++++----- tests/Functional/RelationTest.php | 8 ++++---- tests/Iterators/IteratorBuilderTest.php | 5 +++-- tests/Iterators/RecursorIteratorTest.php | 11 ++++++----- tests/Iterators/UniqueFilterTest.php | 13 +++++++------ tests/Models/ClassInfoTest.php | 5 +++-- tests/Models/PHPClassTest.php | 11 ++++++----- tests/TypescriptHelperTest.php | 7 ++++--- tests/bootstrap.php | 5 +++-- 117 files changed, 439 insertions(+), 329 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index cadc9a9..c4034c7 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -10,9 +10,10 @@ $finder = PhpCsFixer\Finder::create() $loader = require __DIR__ . '/vendor/autoload.php'; try { return Irstea\CS\Config::create() - ->setIndent(' ') - ->setLineEnding("\n") - ->setFinder($finder); + ->setIndent(' ') + ->SetRiskyAllowed(true) + ->setLineEnding("\n") + ->setFinder($finder); } finally { $loader->unregister(); } diff --git a/src/php/Command/NgModelGenerateCommand.php b/src/php/Command/NgModelGenerateCommand.php index da94570..06ce38d 100644 --- a/src/php/Command/NgModelGenerateCommand.php +++ b/src/php/Command/NgModelGenerateCommand.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -38,7 +39,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * Class NgModelGenerateCommand. */ -/* final */class NgModelGenerateCommand extends Command +/* final */ class NgModelGenerateCommand extends Command { /** * @var ModelGenerator @@ -66,7 +67,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setName('ng-model:generate') @@ -80,7 +81,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $writer = new PhonyFileWriter( $this->openWriter($input, $output), @@ -94,7 +95,7 @@ use Symfony\Component\Console\Output\OutputInterface; $writer = new FilteringFileWriter($writer, function (string $path) use ($globs): bool { foreach ($globs as $glob) { - if (fnmatch($glob, $path, FNM_PATHNAME)) { + if (fnmatch($glob, $path, \FNM_PATHNAME)) { return true; } } diff --git a/src/php/Command/NgModelMetadataCommand.php b/src/php/Command/NgModelMetadataCommand.php index 7a6ba38..5135bf8 100644 --- a/src/php/Command/NgModelMetadataCommand.php +++ b/src/php/Command/NgModelMetadataCommand.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -61,7 +62,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setName('ng-model:metadata') @@ -72,7 +73,7 @@ use Symfony\Component\Console\Output\OutputInterface; /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $classes = $input->getArgument('classes'); Assertion::isArray($classes); @@ -87,7 +88,7 @@ use Symfony\Component\Console\Output\OutputInterface; $metadata[$class->getBaseName()] = $this->metadataFactory->getResourceMetadata($class); } - $json = \json_encode($metadata, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE); + $json = json_encode($metadata, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE); Assertion::string($json); $output->writeln($json); } diff --git a/src/php/DependencyInjection/NgModelGeneratorExtension.php b/src/php/DependencyInjection/NgModelGeneratorExtension.php index 0f7b33a..a32d60e 100644 --- a/src/php/DependencyInjection/NgModelGeneratorExtension.php +++ b/src/php/DependencyInjection/NgModelGeneratorExtension.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -34,7 +35,7 @@ class NgModelGeneratorExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('config.xml'); diff --git a/src/php/Exceptions/BadMethodCallException.php b/src/php/Exceptions/BadMethodCallException.php index 2c67147..5f7aafb 100644 --- a/src/php/Exceptions/BadMethodCallException.php +++ b/src/php/Exceptions/BadMethodCallException.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Exceptions/DomainException.php b/src/php/Exceptions/DomainException.php index 75157f5..af91a1d 100644 --- a/src/php/Exceptions/DomainException.php +++ b/src/php/Exceptions/DomainException.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Exceptions/Exception.php b/src/php/Exceptions/Exception.php index c31d5df..5955af4 100644 --- a/src/php/Exceptions/Exception.php +++ b/src/php/Exceptions/Exception.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Exceptions/InvalidArgumentException.php b/src/php/Exceptions/InvalidArgumentException.php index b6c0b45..99bd688 100644 --- a/src/php/Exceptions/InvalidArgumentException.php +++ b/src/php/Exceptions/InvalidArgumentException.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Exceptions/TypeAlreadyExistsException.php b/src/php/Exceptions/TypeAlreadyExistsException.php index fb6eb0b..43e2444 100644 --- a/src/php/Exceptions/TypeAlreadyExistsException.php +++ b/src/php/Exceptions/TypeAlreadyExistsException.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Exceptions/TypeError.php b/src/php/Exceptions/TypeError.php index 795b484..19cdb70 100644 --- a/src/php/Exceptions/TypeError.php +++ b/src/php/Exceptions/TypeError.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Exceptions/TypeNotFoundException.php b/src/php/Exceptions/TypeNotFoundException.php index 2db6e05..8e1d8cd 100644 --- a/src/php/Exceptions/TypeNotFoundException.php +++ b/src/php/Exceptions/TypeNotFoundException.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Iterators/CallbackFilterRecursorIterator.php b/src/php/Iterators/CallbackFilterRecursorIterator.php index a5fe824..e2578a9 100644 --- a/src/php/Iterators/CallbackFilterRecursorIterator.php +++ b/src/php/Iterators/CallbackFilterRecursorIterator.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -55,7 +56,7 @@ class CallbackFilterRecursorIterator extends RecursorIterator /** * @param \Iterator $iter */ - protected function doGetChildren(\Traversable $iter): \RecursiveIterator + protected function doGetChildren(Traversable $iter): \RecursiveIterator { return new self($iter, $this->filter); } diff --git a/src/php/Iterators/IteratorBuilder.php b/src/php/Iterators/IteratorBuilder.php index 637e9e2..01b296e 100644 --- a/src/php/Iterators/IteratorBuilder.php +++ b/src/php/Iterators/IteratorBuilder.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Iterators/RecursiveUniqueIterator.php b/src/php/Iterators/RecursiveUniqueIterator.php index e190e3c..8295d66 100644 --- a/src/php/Iterators/RecursiveUniqueIterator.php +++ b/src/php/Iterators/RecursiveUniqueIterator.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Iterators/RecursorIterator.php b/src/php/Iterators/RecursorIterator.php index 87643b0..c69beb9 100644 --- a/src/php/Iterators/RecursorIterator.php +++ b/src/php/Iterators/RecursorIterator.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Iterators/UniqueFilter.php b/src/php/Iterators/UniqueFilter.php index 022089a..079bb26 100644 --- a/src/php/Iterators/UniqueFilter.php +++ b/src/php/Iterators/UniqueFilter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -49,7 +50,7 @@ final class UniqueFilter private function getKey($value): string { if (\is_object($value)) { - return \get_class($value) . '#' . \spl_object_hash($value); + return \get_class($value) . '#' . spl_object_hash($value); } if (\is_array($value)) { return 'array#' . implode(', ', array_map( diff --git a/src/php/Iterators/UniqueIterator.php b/src/php/Iterators/UniqueIterator.php index 712ac1c..1277f94 100644 --- a/src/php/Iterators/UniqueIterator.php +++ b/src/php/Iterators/UniqueIterator.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Iterators/UniqueIteratorTrait.php b/src/php/Iterators/UniqueIteratorTrait.php index d8b9960..ab126df 100644 --- a/src/php/Iterators/UniqueIteratorTrait.php +++ b/src/php/Iterators/UniqueIteratorTrait.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Metadata/CachingMetadataFactory.php b/src/php/Metadata/CachingMetadataFactory.php index bd832ee..353a374 100644 --- a/src/php/Metadata/CachingMetadataFactory.php +++ b/src/php/Metadata/CachingMetadataFactory.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Metadata/ClassHierarchy.php b/src/php/Metadata/ClassHierarchy.php index 878db9b..af50e34 100644 --- a/src/php/Metadata/ClassHierarchy.php +++ b/src/php/Metadata/ClassHierarchy.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Metadata/MetadataFactory.php b/src/php/Metadata/MetadataFactory.php index dec6b3b..96ebb32 100644 --- a/src/php/Metadata/MetadataFactory.php +++ b/src/php/Metadata/MetadataFactory.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -44,7 +45,7 @@ use Symfony\Component\Routing\RouterInterface; * Class MetadataFactory * Cette classe est chargée de collecter les métadonnées des différents services d'API-Platform. */ -/* final */class MetadataFactory implements MetadataFactoryInterface +/* final */ class MetadataFactory implements MetadataFactoryInterface { /** @var ResourceClassResolverInterface */ private $resourceClassResolver; @@ -235,7 +236,7 @@ use Symfony\Component\Routing\RouterInterface; $output = $getAttribute('output', null); $normalization = null; if ($output !== false) { - if (is_array($output) && array_key_exists('class', $output)) { + if (\is_array($output) && \array_key_exists('class', $output)) { $output = $output['class']; } elseif ($output === null && $opDef->hasNormalization()) { $output = $class->getFullName(); @@ -253,7 +254,7 @@ use Symfony\Component\Routing\RouterInterface; $input = $getAttribute('input', null); $denormalization = null; if ($input !== false) { - if (is_array($input) && array_key_exists('class', $input)) { + if (\is_array($input) && \array_key_exists('class', $input)) { $input = $input['class']; } elseif ($input === null && $opDef->hasDenormalization()) { $input = $class->getFullName(); diff --git a/src/php/Metadata/MetadataFactoryInterface.php b/src/php/Metadata/MetadataFactoryInterface.php index a925320..6e0017e 100644 --- a/src/php/Metadata/MetadataFactoryInterface.php +++ b/src/php/Metadata/MetadataFactoryInterface.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Metadata/OperationDef.php b/src/php/Metadata/OperationDef.php index 8c4391e..3f9b2e5 100644 --- a/src/php/Metadata/OperationDef.php +++ b/src/php/Metadata/OperationDef.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -52,8 +53,8 @@ final class OperationDef implements \JsonSerializable, HasName $this->originalName = $name; $this->method = $method; - if (\strtolower($method) === \strtolower($name)) { - $this->special = \strtoupper($method); + if (strtolower($method) === strtolower($name)) { + $this->special = strtoupper($method); if ($method === 'POST') { $isCollection = false; } @@ -151,6 +152,6 @@ final class OperationDef implements \JsonSerializable, HasName */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Metadata/OperationMetadata.php b/src/php/Metadata/OperationMetadata.php index 62316c0..ab673a5 100644 --- a/src/php/Metadata/OperationMetadata.php +++ b/src/php/Metadata/OperationMetadata.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -215,7 +216,7 @@ class OperationMetadata implements \JsonSerializable, HasName { $vars = array_merge( $this->opDef->jsonSerialize(), - \get_object_vars($this) + get_object_vars($this) ); unset($vars['resource'], $vars['opDef']); diff --git a/src/php/Metadata/PaginationMetadata.php b/src/php/Metadata/PaginationMetadata.php index 0af323e..6edba00 100644 --- a/src/php/Metadata/PaginationMetadata.php +++ b/src/php/Metadata/PaginationMetadata.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -88,6 +89,6 @@ final class PaginationMetadata implements \JsonSerializable */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Metadata/PropertyMetadata.php b/src/php/Metadata/PropertyMetadata.php index 0534ffa..b773d9a 100644 --- a/src/php/Metadata/PropertyMetadata.php +++ b/src/php/Metadata/PropertyMetadata.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -180,7 +181,7 @@ class PropertyMetadata implements \JsonSerializable, HasName */ public function jsonSerialize() { - $vars = \get_object_vars($this); + $vars = get_object_vars($this); $vars['type'] = $this->serializeType($this->type); unset($vars['resource']); diff --git a/src/php/Metadata/PropertyMetadataFactory.php b/src/php/Metadata/PropertyMetadataFactory.php index 867efa0..6848cc8 100644 --- a/src/php/Metadata/PropertyMetadataFactory.php +++ b/src/php/Metadata/PropertyMetadataFactory.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Metadata/RepresentationMetadata.php b/src/php/Metadata/RepresentationMetadata.php index 6b2dc1b..d25038f 100644 --- a/src/php/Metadata/RepresentationMetadata.php +++ b/src/php/Metadata/RepresentationMetadata.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -161,6 +162,6 @@ final class RepresentationMetadata implements ClassName, HasName */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Metadata/ResourceClassHierarchy.php b/src/php/Metadata/ResourceClassHierarchy.php index 1f8dcf7..c5d86f5 100644 --- a/src/php/Metadata/ResourceClassHierarchy.php +++ b/src/php/Metadata/ResourceClassHierarchy.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Metadata/ResourceMetadata.php b/src/php/Metadata/ResourceMetadata.php index 92b02f6..32b9e02 100644 --- a/src/php/Metadata/ResourceMetadata.php +++ b/src/php/Metadata/ResourceMetadata.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -158,6 +159,6 @@ class ResourceMetadata implements ClassName */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Metadata/SerializationMetadata.php b/src/php/Metadata/SerializationMetadata.php index fec99ae..41ec417 100644 --- a/src/php/Metadata/SerializationMetadata.php +++ b/src/php/Metadata/SerializationMetadata.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -146,7 +147,7 @@ final class SerializationMetadata implements ClassName $subclasses = []; $rootClassName = $this->getFullName(); foreach ($this->representations as $className => $meta) { - if (\is_subclass_of($className, $rootClassName, true)) { + if (is_subclass_of($className, $rootClassName, true)) { $subclasses[$className] = $meta; } } @@ -159,6 +160,6 @@ final class SerializationMetadata implements ClassName */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/ModelGenerator.php b/src/php/ModelGenerator.php index 351029d..f81c8ec 100644 --- a/src/php/ModelGenerator.php +++ b/src/php/ModelGenerator.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/ClassInfo.php b/src/php/Models/ClassInfo.php index 2f271c3..62e27a3 100644 --- a/src/php/Models/ClassInfo.php +++ b/src/php/Models/ClassInfo.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -138,7 +139,7 @@ final class ClassInfo implements ClassName /** * Get parent. */ - public function getParent(): ?ClassInfo + public function getParent(): ?self { return $this->parent ?: null; } @@ -146,7 +147,7 @@ final class ClassInfo implements ClassName /** * Set parent. */ - public function setParent(?ClassInfo $parent): void + public function setParent(?self $parent): void { if ($parent === $this->parent) { return; @@ -176,7 +177,7 @@ final class ClassInfo implements ClassName /** * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ - private function addChild(ClassInfo $child): void + private function addChild(self $child): void { if (\in_array($child, $this->children, true)) { return; @@ -224,7 +225,7 @@ final class ClassInfo implements ClassName 'abstract' => $this->abstract, 'parent' => $this->parent ? $this->parent->getFullName() : null, 'children' => array_map( - function (ClassInfo $ci) { + function (self $ci) { return $ci->getFullName(); }, $this->children diff --git a/src/php/Models/ClassName.php b/src/php/Models/ClassName.php index 08550a9..e7666c6 100644 --- a/src/php/Models/ClassName.php +++ b/src/php/Models/ClassName.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Declaration.php b/src/php/Models/Declaration.php index 009467d..c9bc959 100644 --- a/src/php/Models/Declaration.php +++ b/src/php/Models/Declaration.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/DeclarationTrait.php b/src/php/Models/DeclarationTrait.php index e6e48cd..d1589c1 100644 --- a/src/php/Models/DeclarationTrait.php +++ b/src/php/Models/DeclarationTrait.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/HasName.php b/src/php/Models/HasName.php index 6ae177c..c1fccc4 100644 --- a/src/php/Models/HasName.php +++ b/src/php/Models/HasName.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/MultitonTrait.php b/src/php/Models/MultitonTrait.php index e7016d0..8707e28 100644 --- a/src/php/Models/MultitonTrait.php +++ b/src/php/Models/MultitonTrait.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/NamedTrait.php b/src/php/Models/NamedTrait.php index e874283..b418773 100644 --- a/src/php/Models/NamedTrait.php +++ b/src/php/Models/NamedTrait.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/PHPClass.php b/src/php/Models/PHPClass.php index 73cb176..445b2f9 100644 --- a/src/php/Models/PHPClass.php +++ b/src/php/Models/PHPClass.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -80,7 +81,7 @@ final class PHPClass implements ClassName return $this->getFullName(); } - public static function baseNameOrdering(PHPClass $a, PHPClass $b): bool + public static function baseNameOrdering(self $a, self $b): bool { return $a->getBaseName() > $b->getBaseName(); } @@ -105,7 +106,7 @@ final class PHPClass implements ClassName if (!preg_match('/^\\\\?((?:\w+\\\\)*)(\w+)$/i', $name, $groups)) { throw new InvalidArgumentException("Invalid PHP class name: $name"); } - list(, $namespace, $baseName) = $groups; + [, $namespace, $baseName] = $groups; $instances[$name] = new self($namespace, $baseName); } diff --git a/src/php/Models/Types/AbstractCollection.php b/src/php/Models/Types/AbstractCollection.php index 14969ee..d942b0d 100644 --- a/src/php/Models/Types/AbstractCollection.php +++ b/src/php/Models/Types/AbstractCollection.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/AbstractType.php b/src/php/Models/Types/AbstractType.php index 942bd09..cdf5412 100644 --- a/src/php/Models/Types/AbstractType.php +++ b/src/php/Models/Types/AbstractType.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -34,7 +35,7 @@ abstract class AbstractType implements Type */ public function __toString() { - return sprintf('%s(#%x)', get_class($this), spl_object_hash($this)); + return sprintf('%s(#%x)', static::class, spl_object_hash($this)); } /** @@ -50,7 +51,7 @@ abstract class AbstractType implements Type */ public function castToStringOrStringArray(string $expr): string { - throw new DomainException('cannot cast a ' . \get_class($this) . ' to string or string[]'); + throw new DomainException('cannot cast a ' . static::class . ' to string or string[]'); } /** @@ -58,7 +59,7 @@ abstract class AbstractType implements Type */ public function checkType(string $expr, bool $explicit = false): string { - throw new DomainException('cannot type-check a ' . \get_class($this)); + throw new DomainException('cannot type-check a ' . static::class); } /** diff --git a/src/php/Models/Types/Alias.php b/src/php/Models/Types/Alias.php index 47eef1f..bea36b7 100644 --- a/src/php/Models/Types/Alias.php +++ b/src/php/Models/Types/Alias.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/ArrayType.php b/src/php/Models/Types/ArrayType.php index 546bbea..5ff9ec2 100644 --- a/src/php/Models/Types/ArrayType.php +++ b/src/php/Models/Types/ArrayType.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/BuiltinType.php b/src/php/Models/Types/BuiltinType.php index 52872ee..7901f8b 100644 --- a/src/php/Models/Types/BuiltinType.php +++ b/src/php/Models/Types/BuiltinType.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -30,8 +31,8 @@ use Irstea\NgModelGeneratorBundle\TypescriptHelper; */ class BuiltinType extends AbstractType { - use NamedTrait; use MultitonTrait; + use NamedTrait; /** * BuiltinType constructor. diff --git a/src/php/Models/Types/Deferred.php b/src/php/Models/Types/Deferred.php index 7ba65f4..be67696 100644 --- a/src/php/Models/Types/Deferred.php +++ b/src/php/Models/Types/Deferred.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Objects/AbstractHierarchicalObject.php b/src/php/Models/Types/Objects/AbstractHierarchicalObject.php index fcb3e01..ab485d2 100644 --- a/src/php/Models/Types/Objects/AbstractHierarchicalObject.php +++ b/src/php/Models/Types/Objects/AbstractHierarchicalObject.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Objects/AnonymousObject.php b/src/php/Models/Types/Objects/AnonymousObject.php index 491074b..8256c36 100644 --- a/src/php/Models/Types/Objects/AnonymousObject.php +++ b/src/php/Models/Types/Objects/AnonymousObject.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -164,6 +165,6 @@ class AnonymousObject extends AbstractType */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Models/Types/Objects/ClassType.php b/src/php/Models/Types/Objects/ClassType.php index 51aa16b..7b23708 100644 --- a/src/php/Models/Types/Objects/ClassType.php +++ b/src/php/Models/Types/Objects/ClassType.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Objects/InterfaceType.php b/src/php/Models/Types/Objects/InterfaceType.php index 163c03e..50617ca 100644 --- a/src/php/Models/Types/Objects/InterfaceType.php +++ b/src/php/Models/Types/Objects/InterfaceType.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Objects/Property.php b/src/php/Models/Types/Objects/Property.php index 3c8861c..771834d 100644 --- a/src/php/Models/Types/Objects/Property.php +++ b/src/php/Models/Types/Objects/Property.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -171,7 +172,7 @@ class Property implements \IteratorAggregate, \JsonSerializable ]; } - public static function compare(Property $a, Property $b): bool + public static function compare(self $a, self $b): bool { if ($a === $b) { return false; diff --git a/src/php/Models/Types/Objects/Repository.php b/src/php/Models/Types/Objects/Repository.php index f52db7b..04ad4ff 100644 --- a/src/php/Models/Types/Objects/Repository.php +++ b/src/php/Models/Types/Objects/Repository.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Operations/AnyPathPart.php b/src/php/Models/Types/Operations/AnyPathPart.php index 7ad7eec..53a1b2a 100644 --- a/src/php/Models/Types/Operations/AnyPathPart.php +++ b/src/php/Models/Types/Operations/AnyPathPart.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Operations/FixedPathPart.php b/src/php/Models/Types/Operations/FixedPathPart.php index a8e601b..46ea6be 100644 --- a/src/php/Models/Types/Operations/FixedPathPart.php +++ b/src/php/Models/Types/Operations/FixedPathPart.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -52,7 +53,7 @@ class FixedPathPart implements PathPart */ public function asTestPattern(): string { - return \preg_quote($this->part, '/'); + return preg_quote($this->part, '/'); } /** @@ -84,6 +85,6 @@ class FixedPathPart implements PathPart */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Models/Types/Operations/Operation.php b/src/php/Models/Types/Operations/Operation.php index 9539e9c..37bf2c1 100644 --- a/src/php/Models/Types/Operations/Operation.php +++ b/src/php/Models/Types/Operations/Operation.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -144,6 +145,6 @@ final class Operation implements \IteratorAggregate, \JsonSerializable */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Models/Types/Operations/Parameter.php b/src/php/Models/Types/Operations/Parameter.php index a74100f..189449e 100644 --- a/src/php/Models/Types/Operations/Parameter.php +++ b/src/php/Models/Types/Operations/Parameter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Operations/ParameterPathPart.php b/src/php/Models/Types/Operations/ParameterPathPart.php index 5c01f67..54fb911 100644 --- a/src/php/Models/Types/Operations/ParameterPathPart.php +++ b/src/php/Models/Types/Operations/ParameterPathPart.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -98,6 +99,6 @@ final class ParameterPathPart implements PathPart */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Models/Types/Operations/Path.php b/src/php/Models/Types/Operations/Path.php index 84ce340..3b80ed5 100644 --- a/src/php/Models/Types/Operations/Path.php +++ b/src/php/Models/Types/Operations/Path.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -106,7 +107,7 @@ final class Path */ public function getParameters(): array { - return \array_filter( + return array_filter( array_map( function (PathPart $part): ?Parameter { return $part->getParameter(); @@ -116,7 +117,7 @@ final class Path ); } - public function buildUsing(Path $other, Parameter $otherParameter): Path + public function buildUsing(self $other, Parameter $otherParameter): self { if (\count($other->parts) > \count($this->parts)) { return $this; @@ -130,8 +131,8 @@ final class Path return $other; } - return new Path( - \array_merge( + return new self( + array_merge( [new ParameterPathPart($otherParameter, $other->getTestPattern())], \array_slice($this->parts, \count($other->parts)) ) @@ -151,6 +152,6 @@ final class Path */ public function jsonSerialize() { - return \get_object_vars($this); + return get_object_vars($this); } } diff --git a/src/php/Models/Types/Operations/PathPart.php b/src/php/Models/Types/Operations/PathPart.php index f1e7934..4fd9fb9 100644 --- a/src/php/Models/Types/Operations/PathPart.php +++ b/src/php/Models/Types/Operations/PathPart.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -34,5 +35,5 @@ interface PathPart public function getParameter(): ?Parameter; - public function isEqual(PathPart $other): bool; + public function isEqual(self $other): bool; } diff --git a/src/php/Models/Types/Placeholder.php b/src/php/Models/Types/Placeholder.php index d23967d..8d81d8b 100644 --- a/src/php/Models/Types/Placeholder.php +++ b/src/php/Models/Types/Placeholder.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,8 +30,8 @@ use Irstea\NgModelGeneratorBundle\Models\NamedTrait; */ class Placeholder extends AbstractType { - use NamedTrait; use MultitonTrait; + use NamedTrait; /** * Placeholder constructor. diff --git a/src/php/Models/Types/Reference.php b/src/php/Models/Types/Reference.php index d429051..3abc7fe 100644 --- a/src/php/Models/Types/Reference.php +++ b/src/php/Models/Types/Reference.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -91,7 +92,7 @@ class Reference extends AbstractType implements Deferred */ private function dereference(): Type { - return $this->target instanceof Reference ? $this->target->dereference() : $this->target; + return $this->target instanceof self ? $this->target->dereference() : $this->target; } /** @@ -131,7 +132,7 @@ class Reference extends AbstractType implements Deferred */ public function jsonSerialize() { - return \spl_object_hash($this); + return spl_object_hash($this); } /** diff --git a/src/php/Models/Types/Resources/Collection.php b/src/php/Models/Types/Resources/Collection.php index db01d56..d83d433 100644 --- a/src/php/Models/Types/Resources/Collection.php +++ b/src/php/Models/Types/Resources/Collection.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Resources/IRI.php b/src/php/Models/Types/Resources/IRI.php index 8d65a58..e206771 100644 --- a/src/php/Models/Types/Resources/IRI.php +++ b/src/php/Models/Types/Resources/IRI.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Resources/Representation.php b/src/php/Models/Types/Resources/Representation.php index 1fb6ffd..0f3f590 100644 --- a/src/php/Models/Types/Resources/Representation.php +++ b/src/php/Models/Types/Resources/Representation.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/Resources/UUID.php b/src/php/Models/Types/Resources/UUID.php index ddc064f..933afef 100644 --- a/src/php/Models/Types/Resources/UUID.php +++ b/src/php/Models/Types/Resources/UUID.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Models/Types/StringConst.php b/src/php/Models/Types/StringConst.php index d194fea..1a82096 100644 --- a/src/php/Models/Types/StringConst.php +++ b/src/php/Models/Types/StringConst.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -30,8 +31,8 @@ use Irstea\NgModelGeneratorBundle\TypescriptHelper; */ final class StringConst extends AbstractType { - use NamedTrait; use MultitonTrait; + use NamedTrait; /** * StringConst constructor. diff --git a/src/php/Models/Types/Type.php b/src/php/Models/Types/Type.php index 30de4bb..3b1d5ae 100644 --- a/src/php/Models/Types/Type.php +++ b/src/php/Models/Types/Type.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -32,7 +33,7 @@ interface Type extends \IteratorAggregate, \JsonSerializable public function checkType(string $expr, bool $explicit = false): string; - public function getAsType(string $typeClass): Type; + public function getAsType(string $typeClass): self; - public function findType(string $typeClass): ?Type; + public function findType(string $typeClass): ?self; } diff --git a/src/php/Models/Types/Union.php b/src/php/Models/Types/Union.php index e981290..2948a39 100644 --- a/src/php/Models/Types/Union.php +++ b/src/php/Models/Types/Union.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -113,7 +114,7 @@ final class Union extends AbstractType case 1: return $types[0]; default: - return new Union($types); + return new self($types); } } diff --git a/src/php/Models/Types/Unresolved.php b/src/php/Models/Types/Unresolved.php index f9efcdf..ad4ca1f 100644 --- a/src/php/Models/Types/Unresolved.php +++ b/src/php/Models/Types/Unresolved.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -107,12 +108,12 @@ final class Unresolved implements Type, HasName return $this->getUsage(); } - public static function get(): Unresolved + public static function get(): self { static $instance = null; if (!$instance) { - $instance = new Unresolved(); + $instance = new self(); } return $instance; diff --git a/src/php/NgModelGeneratorBundle.php b/src/php/NgModelGeneratorBundle.php index 857b8bf..c9e5f68 100644 --- a/src/php/NgModelGeneratorBundle.php +++ b/src/php/NgModelGeneratorBundle.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/OperationMapper.php b/src/php/OperationMapper.php index 7133547..737aff3 100644 --- a/src/php/OperationMapper.php +++ b/src/php/OperationMapper.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -230,12 +231,12 @@ final class OperationMapper $rootClass = $this->operation->getClassName(); foreach ($this->operation->getFilters() as $filter) { - $filterType = PHPClass::get(get_class($filter))->getBaseName(); + $filterType = PHPClass::get(\get_class($filter))->getBaseName(); foreach ($filter->getDescription($this->operation->getResource()->getFullName()) as $name => $filterDesc) { $type = $this->typeFactory->get($filterDesc['type']); - if (isset($filterDesc['property']) && is_string($filterDesc['property'])) { + if (isset($filterDesc['property']) && \is_string($filterDesc['property'])) { $propType = $this->resolvePropertyType($rootClass, $filterDesc['property']); if ($propType) { $type = $propType; @@ -250,7 +251,7 @@ final class OperationMapper $type = $this->getSingularType($type); $propName = Inflector::singularize($propName); - if (!empty($filterDesc['is_collection']) || substr($name, strlen($name) - 2) === '[]') { + if (!empty($filterDesc['is_collection']) || substr($name, \strlen($name) - 2) === '[]') { $type = new ArrayType($type); $propName .= 'In'; } @@ -265,7 +266,7 @@ final class OperationMapper $name = $property->getName(); if (isset($propDict[$name])) { if ($propDict[$name]->getOriginalName() !== $property->getOriginalName()) { - throw new InvalidArgumentException(sprintf("filter property conflict: $name")); + throw new InvalidArgumentException("filter property conflict: $name"); } $mergedeType = Union::create([$propDict[$name]->getType(), $property->getType()]); $mergedNullable = $propDict[$name]->isNullable() || $property->isNullable(); diff --git a/src/php/PathParser.php b/src/php/PathParser.php index c8ffed8..1dcb89a 100644 --- a/src/php/PathParser.php +++ b/src/php/PathParser.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -52,7 +53,7 @@ final class PathParser implements PathParserInterface */ public function parse(string $path, array $requirements): Path { - $stringParts = preg_split('/\{(\w+)\}/', $path, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + $stringParts = preg_split('/\{(\w+)\}/', $path, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE); Assertion::isArray($stringParts); $parts = []; diff --git a/src/php/PathParserInterface.php b/src/php/PathParserInterface.php index 54fe19a..202ba0b 100644 --- a/src/php/PathParserInterface.php +++ b/src/php/PathParserInterface.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/SerializationMapper.php b/src/php/SerializationMapper.php index 09920f2..d48a62b 100644 --- a/src/php/SerializationMapper.php +++ b/src/php/SerializationMapper.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -242,7 +243,7 @@ final class SerializationMapper implements TypeFactoryInterface $properties['@id'] = new Property( '@id', '', - $this->createIRI(\iterator_to_array($classInfo->iterateConcreteDescendants())), + $this->createIRI(iterator_to_array($classInfo->iterateConcreteDescendants())), true, !$this->serialization->isNormalization(), true diff --git a/src/php/SerializationMapperFactory.php b/src/php/SerializationMapperFactory.php index 22cfb7c..3b68b26 100644 --- a/src/php/SerializationMapperFactory.php +++ b/src/php/SerializationMapperFactory.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/SerializationMapperFactoryInterface.php b/src/php/SerializationMapperFactoryInterface.php index a992a3d..083d774 100644 --- a/src/php/SerializationMapperFactoryInterface.php +++ b/src/php/SerializationMapperFactoryInterface.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Twig/GeneratorExtension.php b/src/php/Twig/GeneratorExtension.php index 7b43c8c..18a14ec 100644 --- a/src/php/Twig/GeneratorExtension.php +++ b/src/php/Twig/GeneratorExtension.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/TypeFactory.php b/src/php/TypeFactory.php index 995183a..8b4661e 100644 --- a/src/php/TypeFactory.php +++ b/src/php/TypeFactory.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/TypeFactoryInterface.php b/src/php/TypeFactoryInterface.php index 981de94..8b6e6ca 100644 --- a/src/php/TypeFactoryInterface.php +++ b/src/php/TypeFactoryInterface.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/TypescriptHelper.php b/src/php/TypescriptHelper.php index b0a667f..c75467a 100644 --- a/src/php/TypescriptHelper.php +++ b/src/php/TypescriptHelper.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/ConsoleWriter.php b/src/php/Writers/ConsoleWriter.php index 459163f..2b873ca 100644 --- a/src/php/Writers/ConsoleWriter.php +++ b/src/php/Writers/ConsoleWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/DirectoryWriter.php b/src/php/Writers/DirectoryWriter.php index 8dcd992..2b2e9bb 100644 --- a/src/php/Writers/DirectoryWriter.php +++ b/src/php/Writers/DirectoryWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -52,7 +53,7 @@ final class DirectoryWriter implements MultiFileWriter throw new \RuntimeException(sprintf('Directory "%s" was not created', $fileDir)); } - $fh = fopen($filePath, 'wb'); + $fh = fopen($filePath, 'w'); Assertion::isResource($fh); return new StreamWriter($fh); diff --git a/src/php/Writers/FilteringFileWriter.php b/src/php/Writers/FilteringFileWriter.php index 27ea7de..7d4bd29 100644 --- a/src/php/Writers/FilteringFileWriter.php +++ b/src/php/Writers/FilteringFileWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/MultiFileWriter.php b/src/php/Writers/MultiFileWriter.php index 7d44a22..746607b 100644 --- a/src/php/Writers/MultiFileWriter.php +++ b/src/php/Writers/MultiFileWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/NullWriter.php b/src/php/Writers/NullWriter.php index 27d1821..e3c9c2a 100644 --- a/src/php/Writers/NullWriter.php +++ b/src/php/Writers/NullWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/PhonyFileWriter.php b/src/php/Writers/PhonyFileWriter.php index a4f39e8..91e9287 100644 --- a/src/php/Writers/PhonyFileWriter.php +++ b/src/php/Writers/PhonyFileWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/StreamWriter.php b/src/php/Writers/StreamWriter.php index b74b033..2aad185 100644 --- a/src/php/Writers/StreamWriter.php +++ b/src/php/Writers/StreamWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/Writer.php b/src/php/Writers/Writer.php index b67712a..61fe94c 100644 --- a/src/php/Writers/Writer.php +++ b/src/php/Writers/Writer.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/ZipFileWriter.php b/src/php/Writers/ZipFileWriter.php index da42221..f4d0f34 100644 --- a/src/php/Writers/ZipFileWriter.php +++ b/src/php/Writers/ZipFileWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/src/php/Writers/ZipWriter.php b/src/php/Writers/ZipWriter.php index ccf0c53..100ac05 100644 --- a/src/php/Writers/ZipWriter.php +++ b/src/php/Writers/ZipWriter.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Controller/CustomController.php b/tests/Fixtures/Controller/CustomController.php index ea7b3a5..625ea3b 100644 --- a/tests/Fixtures/Controller/CustomController.php +++ b/tests/Fixtures/Controller/CustomController.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Entity/EntityWithAccessors.php b/tests/Fixtures/Entity/EntityWithAccessors.php index 48ffb5e..cf91aef 100644 --- a/tests/Fixtures/Entity/EntityWithAccessors.php +++ b/tests/Fixtures/Entity/EntityWithAccessors.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Entity/EntityWithCustomMethods.php b/tests/Fixtures/Entity/EntityWithCustomMethods.php index b7d5784..3ae9e4c 100644 --- a/tests/Fixtures/Entity/EntityWithCustomMethods.php +++ b/tests/Fixtures/Entity/EntityWithCustomMethods.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Entity/EntityWithDTO.php b/tests/Fixtures/Entity/EntityWithDTO.php index aed6dd2..e83cd21 100644 --- a/tests/Fixtures/Entity/EntityWithDTO.php +++ b/tests/Fixtures/Entity/EntityWithDTO.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Entity/EntityWithIntegerIdentifier.php b/tests/Fixtures/Entity/EntityWithIntegerIdentifier.php index 902e213..f505149 100644 --- a/tests/Fixtures/Entity/EntityWithIntegerIdentifier.php +++ b/tests/Fixtures/Entity/EntityWithIntegerIdentifier.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Entity/EntityWithNullable.php b/tests/Fixtures/Entity/EntityWithNullable.php index 895dbfa..1dc0f08 100644 --- a/tests/Fixtures/Entity/EntityWithNullable.php +++ b/tests/Fixtures/Entity/EntityWithNullable.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -92,7 +93,7 @@ class EntityWithNullable /** * Set nullableString. */ - public function setNullableString(? string $nullableString): void + public function setNullableString(?string $nullableString): void { $this->nullableString = $nullableString; } @@ -108,7 +109,7 @@ class EntityWithNullable /** * Set nullableEntity. */ - public function setNullableEntity(? Person $nullableEntity): void + public function setNullableEntity(?Person $nullableEntity): void { $this->nullableEntity = $nullableEntity; } @@ -124,7 +125,7 @@ class EntityWithNullable /** * Set nullableEmbeddedEntity. */ - public function setNullableEmbeddedEntity(? Person $nullableEmbeddedEntity): void + public function setNullableEmbeddedEntity(?Person $nullableEmbeddedEntity): void { $this->nullableEmbeddedEntity = $nullableEmbeddedEntity; } @@ -140,7 +141,7 @@ class EntityWithNullable /** * Set nullableDate. */ - public function setNullableDate(? \DateTimeInterface $nullableDate): void + public function setNullableDate(?\DateTimeInterface $nullableDate): void { $this->nullableDate = $nullableDate; } diff --git a/tests/Fixtures/Entity/EntityWithRelations.php b/tests/Fixtures/Entity/EntityWithRelations.php index 3a3d144..5453673 100644 --- a/tests/Fixtures/Entity/EntityWithRelations.php +++ b/tests/Fixtures/Entity/EntityWithRelations.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Entity/Person.php b/tests/Fixtures/Entity/Person.php index 601f6f7..d8314b8 100644 --- a/tests/Fixtures/Entity/Person.php +++ b/tests/Fixtures/Entity/Person.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/Entity/Project.php b/tests/Fixtures/Entity/Project.php index 370a3f8..1c34144 100644 --- a/tests/Fixtures/Entity/Project.php +++ b/tests/Fixtures/Entity/Project.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/TestKernel.php b/tests/Fixtures/TestKernel.php index e4a2f2b..06b53a5 100644 --- a/tests/Fixtures/TestKernel.php +++ b/tests/Fixtures/TestKernel.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -65,7 +66,7 @@ final class TestKernel extends Kernel /** * {@inheritdoc} */ - protected function configureRoutes(RouteCollectionBuilder $routes) + protected function configureRoutes(RouteCollectionBuilder $routes): void { $routes->import(__DIR__ . '/config/routes.yaml', '', 'yaml'); } @@ -73,7 +74,7 @@ final class TestKernel extends Kernel /** * {@inheritdoc} */ - protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) + protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void { $loader->load(__DIR__ . '/config/services.yaml', 'yaml'); } diff --git a/tests/Fixtures/ValueObject/InputDTO.php b/tests/Fixtures/ValueObject/InputDTO.php index c8db3cc..7e2858d 100644 --- a/tests/Fixtures/ValueObject/InputDTO.php +++ b/tests/Fixtures/ValueObject/InputDTO.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Fixtures/ValueObject/OutputDTO.php b/tests/Fixtures/ValueObject/OutputDTO.php index fd4b7f6..51fa393 100644 --- a/tests/Fixtures/ValueObject/OutputDTO.php +++ b/tests/Fixtures/ValueObject/OutputDTO.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Functional/AccessorTest.php b/tests/Functional/AccessorTest.php index d3f97bd..2fd1151 100644 --- a/tests/Functional/AccessorTest.php +++ b/tests/Functional/AccessorTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,10 +30,9 @@ final class AccessorTest extends GenerationTestCase /** * @param string $code * - * @test * @dataProvider listExpectedSnippets */ - public function checkCodeSnippet(string $snippet): void + public function testCheckCodeSnippet(string $snippet): void { self::assertCodeContains($snippet, self::generateTypescript()); } diff --git a/tests/Functional/CustomMethodTest.php b/tests/Functional/CustomMethodTest.php index e0e2fa4..b778da1 100644 --- a/tests/Functional/CustomMethodTest.php +++ b/tests/Functional/CustomMethodTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,10 +30,9 @@ final class CustomMethodTest extends GenerationTestCase /** * @param string $code * - * @test * @dataProvider listExpectedSnippets */ - public function checkCodeSnippet(string $snippet): void + public function testCheckCodeSnippet(string $snippet): void { self::assertCodeContains($snippet, self::generateTypescript()); } diff --git a/tests/Functional/DTOTest.php b/tests/Functional/DTOTest.php index 364f20e..5382d97 100644 --- a/tests/Functional/DTOTest.php +++ b/tests/Functional/DTOTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,10 +30,9 @@ final class DTOTest extends GenerationTestCase /** * @param string $code * - * @test * @dataProvider listExpectedSnippets */ - public function checkCodeSnippet(string $snippet): void + public function testCheckCodeSnippet(string $snippet): void { self::assertCodeContains($snippet, self::generateTypescript()); } diff --git a/tests/Functional/GenerationTestCase.php b/tests/Functional/GenerationTestCase.php index 655072c..46b4c93 100644 --- a/tests/Functional/GenerationTestCase.php +++ b/tests/Functional/GenerationTestCase.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -70,7 +71,7 @@ abstract class GenerationTestCase extends KernelTestCase string $code, string $message = '' ): void { - $needleRegexp = '/' . preg_replace('/\s+/', '\\s+', \preg_quote($needle, '/')) . '/'; + $needleRegexp = '/' . preg_replace('/\s+/', '\\s+', preg_quote($needle, '/')) . '/'; self::assertRegExp($needleRegexp, $code, $message); } } diff --git a/tests/Functional/IntegerIdentifierTest.php b/tests/Functional/IntegerIdentifierTest.php index 355bb4a..5c550f5 100644 --- a/tests/Functional/IntegerIdentifierTest.php +++ b/tests/Functional/IntegerIdentifierTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,10 +30,9 @@ final class IntegerIdentifierTest extends GenerationTestCase /** * @param string $code * - * @test * @dataProvider listExpectedSnippets */ - public function checkCodeSnippet(string $snippet): void + public function testCheckCodeSnippet(string $snippet): void { self::assertCodeContains($snippet, self::generateTypescript()); } diff --git a/tests/Functional/NullableTest.php b/tests/Functional/NullableTest.php index dd3ab70..4a053f4 100644 --- a/tests/Functional/NullableTest.php +++ b/tests/Functional/NullableTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,10 +30,9 @@ final class NullableTest extends GenerationTestCase /** * @param string $code * - * @test * @dataProvider listExpectedSnippets */ - public function checkCodeSnippet(string $snippet): void + public function testCheckCodeSnippet(string $snippet): void { self::assertCodeContains($snippet, self::generateTypescript()); } diff --git a/tests/Functional/ProjectResourceTest.php b/tests/Functional/ProjectResourceTest.php index 2b12ca1..f154f0b 100644 --- a/tests/Functional/ProjectResourceTest.php +++ b/tests/Functional/ProjectResourceTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,10 +30,9 @@ final class ProjectResourceTest extends GenerationTestCase /** * @param string $code * - * @test * @dataProvider listExpectedSnippets */ - public function checkCodeSnippet(string $snippet): void + public function testCheckCodeSnippet(string $snippet): void { self::assertCodeContains($snippet, self::generateTypescript()); } @@ -45,7 +45,7 @@ final class ProjectResourceTest extends GenerationTestCase string $code, string $message = '' ): void { - $needleRegexp = '/' . preg_replace('/\s+/', '\\s+', \preg_quote($needle, '/')) . '/'; + $needleRegexp = '/' . preg_replace('/\s+/', '\\s+', preg_quote($needle, '/')) . '/'; self::assertRegExp($needleRegexp, $code, $message); } diff --git a/tests/Functional/RelationTest.php b/tests/Functional/RelationTest.php index a2c0465..ce08b37 100644 --- a/tests/Functional/RelationTest.php +++ b/tests/Functional/RelationTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -29,10 +30,9 @@ final class RelationTest extends GenerationTestCase /** * @param string $code * - * @test * @dataProvider listExpectedSnippets */ - public function checkCodeSnippet(string $snippet): void + public function testCheckCodeSnippet(string $snippet): void { self::assertCodeContains($snippet, self::generateTypescript()); } diff --git a/tests/Iterators/IteratorBuilderTest.php b/tests/Iterators/IteratorBuilderTest.php index 2548703..00615a4 100644 --- a/tests/Iterators/IteratorBuilderTest.php +++ b/tests/Iterators/IteratorBuilderTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Iterators/RecursorIteratorTest.php b/tests/Iterators/RecursorIteratorTest.php index 6bd1cc8..b30cf70 100644 --- a/tests/Iterators/RecursorIteratorTest.php +++ b/tests/Iterators/RecursorIteratorTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -33,7 +34,7 @@ class RecursorIteratorTest extends TestCase /** @var RecursorIterator */ private $tested; - protected function setUp()/* The :void return type declaration that should be here would cause a BC issue */ + protected function setUp(): void/* The :void return type declaration that should be here would cause a BC issue */ { parent::setUp(); @@ -46,7 +47,7 @@ class RecursorIteratorTest extends TestCase $this->tested = new RecursorIterator($inner); } - public function testHasChildren() + public function testHasChildren(): void { $this->tested->rewind(); self::assertFalse($this->tested->hasChildren()); @@ -61,7 +62,7 @@ class RecursorIteratorTest extends TestCase self::assertFalse($this->tested->valid()); } - public function testGetChildren() + public function testGetChildren(): void { $this->tested->rewind(); self::assertNull($this->tested->getChildren()); diff --git a/tests/Iterators/UniqueFilterTest.php b/tests/Iterators/UniqueFilterTest.php index acd2281..c8d1239 100644 --- a/tests/Iterators/UniqueFilterTest.php +++ b/tests/Iterators/UniqueFilterTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -32,20 +33,20 @@ class UniqueFilterTest extends TestCase /** @var UniqueFilter */ private $tested; - protected function setUp()/* The :void return type declaration that should be here would cause a BC issue */ + protected function setUp(): void/* The :void return type declaration that should be here would cause a BC issue */ { parent::setUp(); $this->tested = new UniqueFilter(); } - public function testKeepUniqueValues() + public function testKeepUniqueValues(): void { $input = [4, 5, null, new \stdClass(), new \stdClass()]; self::assertEquals($input, array_filter($input, $this->tested)); } - public function testRemoveDuplicates() + public function testRemoveDuplicates(): void { $obj = new \stdClass(); @@ -53,7 +54,7 @@ class UniqueFilterTest extends TestCase $actual = array_values(array_filter($input, $this->tested)); $expected = [4, 5, null, $obj, 8]; - self::assertEquals(count($expected), count($actual)); + self::assertEquals(\count($expected), \count($actual)); foreach ($expected as $i => $value) { self::assertSame($value, $actual[$i]); diff --git a/tests/Models/ClassInfoTest.php b/tests/Models/ClassInfoTest.php index 94c1ddc..7d36c87 100644 --- a/tests/Models/ClassInfoTest.php +++ b/tests/Models/ClassInfoTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free diff --git a/tests/Models/PHPClassTest.php b/tests/Models/PHPClassTest.php index 00494e3..4cc07c0 100644 --- a/tests/Models/PHPClassTest.php +++ b/tests/Models/PHPClassTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -35,7 +36,7 @@ class PHPClassTest extends TestCase * * @dataProvider getBaseNameTestCases */ - public function testGetBaseName(string $expected, string $fqcn) + public function testGetBaseName(string $expected, string $fqcn): void { $class = PHPClass::get($fqcn); self::assertEquals($expected, $class->getBaseName()); @@ -56,7 +57,7 @@ class PHPClassTest extends TestCase * * @dataProvider getNamespaceTestCases */ - public function testGetNamespace(string $expected, string $fqcn) + public function testGetNamespace(string $expected, string $fqcn): void { $class = PHPClass::get($fqcn); self::assertEquals($expected, $class->getNamespace()); @@ -77,7 +78,7 @@ class PHPClassTest extends TestCase * * @dataProvider getFullNameTestCases */ - public function testGetFullName(string $fqcn) + public function testGetFullName(string $fqcn): void { $class = PHPClass::get($fqcn); self::assertEquals($fqcn, $class->getFullName()); diff --git a/tests/TypescriptHelperTest.php b/tests/TypescriptHelperTest.php index afd9985..b0bc0de 100644 --- a/tests/TypescriptHelperTest.php +++ b/tests/TypescriptHelperTest.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free @@ -39,7 +40,7 @@ class TypescriptHelperTest extends TestCase public function identifierTestCases(): array { - return [ + return [ 'a' => ['a', true], '_a' => ['_a', true], 'A' => ['A', true], diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9f7aa1f..e8de1f0 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,9 +1,10 @@ -<?php declare(strict_types=1); +<?php +declare(strict_types=1); /* * This file is part of "irstea/ng-model-generator-bundle". * * "irstea/ng-model-generator-bundle" generates Typescript interfaces for Angular using api-platform metadata. - * Copyright (C) 2018-2020 IRSTEA + * Copyright (C) 2018-2021 IRSTEA * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free -- GitLab