diff --git a/.php_cs.dist b/.php_cs.dist index cadc9a91a3b62960bc160f137d91f9d014aeb27d..c4034c758bc2a9c8b688a196a4244b1b0a3c34e6 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 da94570a5b2a83388f2e52fce4d66fbcb7890991..06ce38de7217f5a7db0f37562b9832690a8056a1 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 7a6ba3876028e4d1dbd1e905f8e7a706d1325064..5135bf88faaf2febcc690fbbfeed13296184d3db 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 0f7b33a14787f8e0348eca083ac38a2f080627b0..a32d60ed6b60fc08d9245940bccddb952fea5fd0 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 2c67147e1efb81030de75e37085c6a4fbb06b072..5f7aafb97f1b569d39f9aa600a080b2abc42e40c 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 75157f52c37bd8b608186b04c5c301234c1a9cab..af91a1d355b6575667c19fbf4282e3eec0fd7c37 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 c31d5df10b861272ac89d6862a09875d8af37b65..5955af4b95792141e48e58ffaf260718b0978354 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 b6c0b456fd1f627f2c6202462afced107033167b..99bd68814259e993a6b5928eb30a2a50515e470b 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 fb6eb0b54fe496f1f565ab05429defa89fba723a..43e24443888a0486c5e9045a8ad7e5bbec9e0f66 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 795b484022e1139fab91173f09b8115969d7255c..19cdb700ef1ef04c60f623537f94473d6188b4a1 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 2db6e05b3195a6da5649524dc5b6736f0c3b52df..8e1d8cdc25e7f84adbd9ebc17113847d2e2c5ca8 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 a5fe8243f286b57e9da2cc43bc348de96b166e5d..e2578a97caed04f54fb4ab7d417d90bde983915f 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 637e9e2a0852140ad72669429538184f9438c851..01b296e342e7e76ed993981cd44d2e91fc39fffd 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 e190e3c8c6f926d5a1954c50d238237d47872e73..8295d669cc5c3c2f7331c840d696c70512b8488a 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 87643b014db35f98cf2e0407ee6588cec37e04fd..c69beb99cd8783166863042a874e9def3464f7d3 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 022089afbd7482ec1fa98866e4cdded8a9ef3234..079bb26a36c41978bea729b001177c43da267279 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 712ac1c2946a1eb8e2813721233edcd80520c5c1..1277f9412c6c592aaa0584894c133e9163112626 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 d8b99600447d85406e8312bfdb5adc038f368a5a..ab126dfb92e252de529bf793386f4dc9e7954aff 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 bd832ee3077ebb821773100fbeda7ae75940dcf3..353a374ad9f8545247dc7c4526eefc6120233343 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 878db9b93db07647ff6da28a6c83f2ac3f31fa9d..af50e344b8cdd489c7f7c81b3f9611774c730eb6 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 dec6b3bc902cd59cd35f57e81566d05d2a8506ff..96ebb32b9dcaa85b5f945b86866250fc3e04e2aa 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 a925320352708c859ba7d3e66a29a5f48ca4a103..6e0017e0c319da79c3ccccd20a0a4f83d09ad78d 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 8c4391e3fdfd40274ed5de346f673856c9640147..3f9b2e5015cae6d12bef36e35733c09353846010 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 62316c009a05763e4aa9dafc418da8450805f5d1..ab673a5582bd0de537039f9c0adce75277d1bdb5 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 0af323eb59804df2326346b70573141c9dfdbfbb..6edba00c1425c9a8c2b96714195e102bdb8e4509 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 0534ffadd9807135089559acc44efcca7b6e984a..b773d9a6e1ba31fbee6f1c364feea0867e6b756c 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 867efa086ed4bfab970d34506ffcbd452a323db5..6848cc8eb637b6f599ca6fe25fbfce49781682a5 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 6b2dc1ba3f0585753b44335c4ae80f03d7a9c502..d25038ffbfe65b13bdc94df0e7f92463f606faad 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 1f8dcf771e461e3c31812cb07570231415ff3975..c5d86f5c5e8fd5f5dd85b2e4a8aaaede28ba7a07 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 92b02f6802df3fa6c6ae4783f8eeb541d3b35c66..32b9e027649e8d093543c9d42c2182a23e1a5998 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 fec99aee57a92b4cd2c9c74c0b8a27ce92e50546..41ec4174b5477bc0dde2e19bf4e73a8a7a6ef5a1 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 351029d3b964959a8df34c6d056b306800387955..f81c8ecab5c526bec457e4fb6023eb1457f4258c 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 2f271c3cd618d3254afd694964ec1e51b88c9b4b..62e27a339e13f66dc066145e839d43321f3e0076 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 08550a97e316a6f5ee4e04fa52b2b18d34763c67..e7666c688d1126758b8011c352460151fd993c7d 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 009467d6ea39411af0e5330a8c4ef126308cf51a..c9bc959fd96fdead24abc9f4aac61887aaa63ccd 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 e6e48cd669c36ed8ea29572a3249ce17cad7faa7..d1589c13bfecde201a92fcbd64396a5f54d1207f 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 6ae177c90114feac5ff742e4b8aa08ab2f1b0bfc..c1fccc4e4dab56b9e825588f8f373932c4988418 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 e7016d090246eb29264d2156d1b65966ef77240b..8707e2890fb70646e37534389334c459cbb07ef4 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 e8742836ee48a525dcbcf9dd6931b8bac03d3137..b418773c95684bc0ab0f68c7c485c7c7ce2f1771 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 73cb176bc9ecae871b381d67f0ade5306ae5f5c9..445b2f926e46e9f461994d45f2eff96373cfdc13 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 14969ee60439935d93eb73d6a71e2eb58c7271da..d942b0d054f67e63a0e75b319fa6260aa794472d 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 942bd094928f7a59fafb693aa7d6d7b99db326b8..cdf5412173658ff9efbaf1567326f82748d5dd04 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 47eef1f68e22b99277955b574c7e475826772d64..bea36b721be0b91d8ecaf8f295e2f4f125b130b0 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 546bbeae0f667bc2aa357b1bba7139f92258b084..5ff9ec27bd19bddcad83d3af0e90c2418a0eac0f 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 52872ee6d30cbd11e4a2568a65310a91e2a77fce..7901f8b738a3b567b04f05445eacddec76e390c8 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 7ba65f4552506be8e3da92dd6053271dcbe3c917..be676961624c9f53244bc552afd14730275cd099 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 fcb3e013ce0dd01b0ba18c50733f2020b0926c5a..ab485d219820dc0b43a5a51bf735ead5669a9fd4 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 491074b7b5daa9b4b7afe987cb62787e47dc030e..8256c364bb46a8849a2fc7ad9d9816c9ceb21bfb 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 51aa16b067aaf6d7390eded10e1d1973e598c8e4..7b2370865e5afa090d67daa46f15c6091249c751 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 163c03e33568a36233a2070c4e815a6f398b60cf..50617caab711b47736bf7add34de06ad99ee7842 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 3c8861c190aa00fb3ee2befa9e6f66ffd706bec7..771834db596258ee3861650db5399e367d133323 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 f52db7b64e4f03c1c53a903f4df10b61f67e1c34..04ad4ffcbff8482e72da2991cbab3ed28af1a7a6 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 7ad7eec3c1a314b15d1707f20a49c838c6b63d20..53a1b2ab938e3772a003261f517fdfdb8484a688 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 a8e601b13ead537d1d9679fe9998b03e9827916b..46ea6be0c8ad5cfca6d3a5321021f76a4f5b8ce8 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 9539e9c75d33669c6f63e5851d8c279b620d6c53..37bf2c149c263a9d07bb250a451bc8ce6b59335e 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 a74100f3a6a36dc25b89f144cbc7066688b00bc0..189449e6384d747e03e256fae2bf59cb8e8f449c 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 5c01f670c79e7fc916bcb4325b29c0dcee5eb83a..54fb911d7601089ee476acc73fd913ded169508a 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 84ce3404aaa2b8c7d475108fe9f5a6138c29a6c8..3b80ed5f7beb1d56809465b49a393a87c81b3141 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 f1e79346f23589bf3475a17da98a13b871fa5233..4fd9fb97900329f8ee946a28231d4a123dd30f6d 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 d23967dbb04923d9e99ee2dad010bff12e24de92..8d81d8b6da30a5cd0fcde67142094bb4f5d99d1a 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 d4290513cdcb556d204f0bb76787140fec7e547e..3abc7fe4cb0caf63d0181958074c544ce31d3d59 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 db01d5693d12ff40d90efe6a7fc94557495a6d8c..d83d4335fe54550049abf91264d540abf53b7d5d 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 8d65a58eded1a01955d5552931973b663330719e..e2067719f68752423995b6e5ce87a84f22164151 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 1fb6ffd79acdea2455dafaab60cccf1ec8d3e1b7..0f3f59004009e948d06564433f702621f0323cd5 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 ddc064fc9f30e42e77d65c3a0efb0def866caf7c..933afef755041a2e4ad56126bf18450acbbedc38 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 d194fea990103d67d6af1b899997bc5f570afb6c..1a82096e062ffd7a6a77fd9ee65e1d41f1b4efd3 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 30de4bb69a8c4244f661c29e4be85845f3eefa81..3b1d5aef0a9123e5d46682a057016b8d84f297a9 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 e981290c134d90474206fd4eda011ee6cb86a3d4..2948a392e33227b4728b245029642058b9289f7d 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 f9efcdf5539f20b05c89f6040a7c5230f4249821..ad4ca1f05a71007983bd297c6223f3b546947f6b 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 857b8bfb3e1d2a3fff70a6195a3a5ed6853335e3..c9e5f68b97aef7cdc1fc18a1357cad4a824ea68a 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 7133547fd8a2d2e50bddf56d8752aa8120a9cf99..737aff3ac6123592e46dc2f7da12b9a021aa236c 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 c8ffed81816333e785753b60f63bc66fcdbb70c5..1dcb89afeb34db82714e5967f7b4a8603eb3a764 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 54fe19ae176dc7e7fb2f8582f4955379a7da5f47..202ba0bb3734a256e106bcfd7671afbb7ea3ed25 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 09920f2eb9dc957ae861a5e24ae37e9b511793ac..d48a62bb9737344d0e16d0489de41cc4dcce1cde 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 22cfb7c21bcb148f05e582cce96cb4a1bba8fe7f..3b68b266de4b8bc590218dba97359ee948fde488 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 a992a3d60ae47c2f65ea81f8bbcfa89890053107..083d77430c296e9a4da86ad6338f8351cd95d9bf 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 7b43c8c05f21bf5f9d72e84f8a937692abc53dd0..18a14ec989a8a03f157efd57f3d83896ab5891d0 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 995183a1c5b7a8aa19e392dc17aa51af2be914f0..8b4661ed0164b10288b09cf593b566de3c03077c 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 981de94351a8556c7678de89eca6bf1e385dab33..8b6e6cacb5105a3b8ba73a52b8ae4cc77bdfd7aa 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 b0a667fa0b018556453b797c07a8bdb3f8221966..c75467a41c81765ac48d213c08da2b5b39a7dd6c 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 459163f572f065d1af41036b68727c327ecda604..2b873cac13f3e548d6aae5ef1066b0602ea15fc7 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 8dcd992c9b6191a901696e0b1d69ec892c10cb64..2b2e9bb32fef8f6eed5ec88b88fc367daba7c356 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 27ea7de8780599405aa2c88b7c7ff5bd1b1b9156..7d4bd292fdc4357acb29658dcfcacafad275b80d 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 7d44a22421e722de23d6488b0299c23714c07fd6..746607b61f70145c5b721697360513216df82eda 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 27d1821620c5c5403df496cb4cf7316368535e24..e3c9c2a7ff82386558cf0997566a9fdffab16471 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 a4f39e89509da091f80428c44b25824d2481f0be..91e928756dd705f8120df9dffbe882acc809c367 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 b74b0338677b9cee9fe7077eda0e624267df1774..2aad1858fe6f18f824a85702ff2f2ad978e09fb4 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 b67712a98a3ff1ccc39a2803ea56ec962602cf0e..61fe94cfd5d837a82794d735175e920032788842 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 da42221f0355fd946f5b9ff5061927561759e563..f4d0f34ec858e062ee74a03841b9a7b9df007bd3 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 ccf0c5364324c3b2b1f5cc91cb81846b05c4ae27..100ac05c2c7d0cd7de558e06e81eb9975e0f429f 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 ea7b3a5d55f6935ea2104735453c1b6e5953b4e8..625ea3b70443e41733e04b68fdce3650277fbcf8 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 48ffb5e56d247b6e7e34f1fb8fe75c5cc500e390..cf91aef3646a57f30af7422a3eb7e2466afa5565 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 b7d5784cbc6fd5be541d85e0786a442c94c082bd..3ae9e4c7952daf86e6528a4bf69e1475a4e5e6f2 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 aed6dd2791645a68c4f1b746a9ac08f648623e87..e83cd21029b7450ca57b4d913318769278b59dd2 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 902e21359ab1acfdd0fe26c5058da4f84dba5f55..f5051493236bb7bb3c6dbc337a76a26b40745ee2 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 895dbfa653e257ef8a3d67c6990378c556dd9b04..1dc0f086e889c444f3e9de74d0db07726cb52ddf 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 3a3d144392789276824f9642f794c4940db3049f..54536735111bc0b18b9a1f6d78e684f72770a25b 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 601f6f7c015f826f137d0f93c8f5e1bdefdb35c9..d8314b8a78a5165cbba3f684f04fcefff5a9e620 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 370a3f836a6d3594e18cd32a31712cd246efb470..1c3414452af9e980d955ccee2106c7c43f1ede02 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 e4a2f2b93b9d76759b012b68655cca5278889830..06b53a5a7cab26cc716833667232dbc70a75b49f 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 c8db3cc52c77149288482e493570f6433b7c75b1..7e2858d1daecad7ef75a8a3b2aa3dc81dfb303db 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 fd4b7f62ec3e382231a60cbc00e6fa89245e03e1..51fa3932f20dd2058ea62c803a6763cba7bd9c73 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 d3f97bd4cb8d1907bbae406170b6e37e737672d6..2fd1151482cb4e31d5f5c1b1ede79cb242986dc8 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 e0e2fa437b43bf6ccbac9540d8bde065dc9992b2..b778da1ed8b79aaa8655aab7c51ccf7df412f69e 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 364f20ebd147e941b4ffdd50857248f34610ef0b..5382d9709a76d8a8ee372868a0c3983bfef2d981 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 655072c9891ae3f55d43f79ef5989a248de28edb..46b4c93287d700eb7003af2e2e1c02264d12eb6c 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 355bb4a366cc477ff95f22c642b27f2f19b3e261..5c550f5b7171ba00b1b4f48e8d1164caf0577643 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 dd3ab704d66404d34b35e0f69d843017e97a1f40..4a053f4f3555dca905b1c9e604be5730aa27cb54 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 2b12ca1fa1c42b40e32d4108743d2523ba25c16d..f154f0b297680727e2d9395a5130ad0cb39d2f63 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 a2c0465689090abcc5095b668a7bf275c6454b8b..ce08b370400b19744826f3b36846e8cb76e180e3 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 2548703ada38c08b1a8a2c06ad34bc7ad7632c60..00615a42aac3461f760ce592f87cc33025399791 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 6bd1cc86196c62e3464ecf998974af5bc18b392e..b30cf703e02de6e8c465ec6de9f346813f542b07 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 acd2281ccdb5a732a5c9f55e83078ddd76e6a1fd..c8d1239deca53deeb9ef4444ed5f22bbe4596ead 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 94c1ddcc75aa658123e0e5e5da078f89e2d24e63..7d36c87dd0c066c71278eb5ff19bdd371a7e1785 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 00494e332afcfd1b349b95119ccfc76a9aac4179..4cc07c0b2bcf943963df895128d84991b423c45f 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 afd9985f18e475d868a1166eb653326dabe70d5c..b0bc0de5f72829a64e3452721ff7ab0926d4a1ae 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 9f7aa1f19dc899f2c36a6823361a4e8ea245d85a..e8de1f0b5c381d9f5f6735e99ecac2be90c44af0 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