From 47dbf39e340e609b73fcfc3260a833b441329a43 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 3 Jul 2022 12:19:44 +0200 Subject: [PATCH 1/3] Flip conditional extension of legacy AnnotationDriver class --- .../Mapping/Driver/CompatibilityAnnotationDriver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ODM/MongoDB/Mapping/Driver/CompatibilityAnnotationDriver.php b/lib/Doctrine/ODM/MongoDB/Mapping/Driver/CompatibilityAnnotationDriver.php index 755077103f..08956fd8e4 100644 --- a/lib/Doctrine/ODM/MongoDB/Mapping/Driver/CompatibilityAnnotationDriver.php +++ b/lib/Doctrine/ODM/MongoDB/Mapping/Driver/CompatibilityAnnotationDriver.php @@ -9,18 +9,18 @@ use function class_exists; -if (class_exists(PersistenceAnnotationDriver::class)) { +if (! class_exists(PersistenceAnnotationDriver::class)) { /** * @internal This class will be removed in ODM 3.0. */ - abstract class CompatibilityAnnotationDriver extends PersistenceAnnotationDriver + abstract class CompatibilityAnnotationDriver implements MappingDriver { } } else { /** * @internal This class will be removed in ODM 3.0. */ - abstract class CompatibilityAnnotationDriver implements MappingDriver + abstract class CompatibilityAnnotationDriver extends PersistenceAnnotationDriver { } } From 5ce57f2398bab6b6c87d655a1253a82ff2fee87c Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 17 Jul 2022 19:41:08 +0200 Subject: [PATCH 2/3] ignore phpstan issue --- phpstan-baseline.neon | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6bf01e68db..dad54e2caf 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -220,3 +220,14 @@ parameters: message: "#.+mapField\\(\\) expects.+enumType\\: 'Documents81#" count: 2 path: tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php + + # it loads an empty class ReflectionEnum of ReflectionEnumPolyfill.php file from laminas/laminas-code, see https://github.com/phpstan/phpstan/issues/7290 + - + message: "#^Call to an undefined method ReflectionEnum\\:\\:isBacked\\(\\)\\.$#" + count: 1 + path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php + + - + message: "#^Call to an undefined method ReflectionEnum\\:\\:getBackingType\\(\\)\\.$#" + count: 1 + path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php From 0ec1b5c4658beadc39f88517bb0f7a6d337eab53 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 17 Jul 2022 19:51:24 +0200 Subject: [PATCH 3/3] Fix cs --- tests/Documents81/Suit.php | 6 +++--- tests/Documents81/SuitInt.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Documents81/Suit.php b/tests/Documents81/Suit.php index 30ed52d0fd..1a57e2340a 100644 --- a/tests/Documents81/Suit.php +++ b/tests/Documents81/Suit.php @@ -6,8 +6,8 @@ enum Suit: string { - case Hearts = 'H'; + case Hearts = 'H'; case Diamonds = 'D'; - case Clubs = 'C'; - case Spades = 'S'; + case Clubs = 'C'; + case Spades = 'S'; } diff --git a/tests/Documents81/SuitInt.php b/tests/Documents81/SuitInt.php index 13a948b2c9..9a06f94d84 100644 --- a/tests/Documents81/SuitInt.php +++ b/tests/Documents81/SuitInt.php @@ -6,8 +6,8 @@ enum SuitInt: int { - case Hearts = 1; + case Hearts = 1; case Diamonds = 2; - case Clubs = 3; - case Spades = 4; + case Clubs = 3; + case Spades = 4; }