diff --git a/src/Util/Inflector.php b/src/Util/Inflector.php index 2a68e16219e..6b2e607b1e6 100644 --- a/src/Util/Inflector.php +++ b/src/Util/Inflector.php @@ -42,7 +42,7 @@ private static function getInstance(): InflectorObject */ public static function tableize(string $word): string { - return class_exists(LegacyInflector::class) ? LegacyInflector::tableize($word) : self::getInstance()->tableize($word); + return class_exists(InflectorFactory::class) ? self::getInstance()->tableize($word) : LegacyInflector::tableize($word); // @phpstan-ignore-line } /** @@ -50,6 +50,6 @@ public static function tableize(string $word): string */ public static function pluralize(string $word): string { - return class_exists(LegacyInflector::class) ? LegacyInflector::pluralize($word) : self::getInstance()->pluralize($word); + return class_exists(InflectorFactory::class) ? self::getInstance()->pluralize($word) : LegacyInflector::pluralize($word); // @phpstan-ignore-line } } diff --git a/tests/Fixtures/app/AppKernel.php b/tests/Fixtures/app/AppKernel.php index 161600e7380..4e74a159861 100644 --- a/tests/Fixtures/app/AppKernel.php +++ b/tests/Fixtures/app/AppKernel.php @@ -19,6 +19,7 @@ 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\Bridge\Doctrine\Types\UuidType; @@ -57,7 +58,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(Inflector::class)) { + if (!class_exists(InflectorFactory::class)) { // @phpstan-ignore-next-line Inflector::rules('plural', ['/taxon/i' => 'taxa']); } }