From c20a3fd123f60c7b7fca4f908e801cda09b4697d Mon Sep 17 00:00:00 2001 From: meyerbaptiste Date: Mon, 14 Dec 2020 16:08:35 +0100 Subject: [PATCH 1/2] Fix PHP-CS-Fixer errors --- .gitignore | 1 + .php_cs.dist | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 1d12eccbda9..b660ea66b8f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /build/ /composer.lock /composer.phar +/phpstan.neon /phpunit.xml /swagger.json /swagger.yaml diff --git a/.php_cs.dist b/.php_cs.dist index cbd76a6fc83..909d81bc0e0 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -96,6 +96,7 @@ return PhpCsFixer\Config::create() 'phpdoc_add_missing_param_annotation' => [ 'only_untyped' => true, ], + 'phpdoc_no_alias_tag' => false, // Set the rule to true when https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5357 is fixed 'phpdoc_order' => true, 'phpdoc_trim_consecutive_blank_line_separation' => true, 'phpdoc_var_annotation_correct_order' => true, From 48447ceee44cc202583b47f6cb5e643d1007cd94 Mon Sep 17 00:00:00 2001 From: meyerbaptiste Date: Tue, 15 Dec 2020 14:25:49 +0100 Subject: [PATCH 2/2] Fix PHPStan errors --- src/Util/Inflector.php | 10 +++++----- tests/Fixtures/app/AppKernel.php | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Util/Inflector.php b/src/Util/Inflector.php index 0c9cf904316..2a68e16219e 100644 --- a/src/Util/Inflector.php +++ b/src/Util/Inflector.php @@ -27,7 +27,7 @@ final class Inflector { /** - * @var InflectorObject + * @var InflectorObject|null */ private static $instance; @@ -38,18 +38,18 @@ private static function getInstance(): InflectorObject } /** - * @see LegacyInflector::tableize() + * @see InflectorObject::tableize() */ public static function tableize(string $word): string { - return class_exists(InflectorFactory::class) ? self::getInstance()->tableize($word) : LegacyInflector::tableize($word); + return class_exists(LegacyInflector::class) ? LegacyInflector::tableize($word) : self::getInstance()->tableize($word); } /** - * @see LegacyInflector::pluralize() + * @see InflectorObject::pluralize() */ public static function pluralize(string $word): string { - return class_exists(InflectorFactory::class) ? self::getInstance()->pluralize($word) : LegacyInflector::pluralize($word); + return class_exists(LegacyInflector::class) ? LegacyInflector::pluralize($word) : self::getInstance()->pluralize($word); } } diff --git a/tests/Fixtures/app/AppKernel.php b/tests/Fixtures/app/AppKernel.php index dc387c557cb..3d7d1f01afe 100644 --- a/tests/Fixtures/app/AppKernel.php +++ b/tests/Fixtures/app/AppKernel.php @@ -18,7 +18,6 @@ use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle; use Doctrine\Common\Inflector\Inflector; -use Doctrine\Inflector\InflectorFactory; use FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle; use Nelmio\ApiDocBundle\NelmioApiDocBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; @@ -54,7 +53,7 @@ public function __construct(string $environment, bool $debug) // patch for old versions of Doctrine Inflector, to delete when we'll drop support for v1 // see https://github.com/doctrine/inflector/issues/147#issuecomment-628807276 - if (!class_exists(InflectorFactory::class)) { + if (class_exists(Inflector::class)) { Inflector::rules('plural', ['/taxon/i' => 'taxa']); } }