Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flip conditional extension of legacy AnnotationDriver class #2451

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
}
}
11 changes: 11 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tests/Documents81/Suit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
6 changes: 3 additions & 3 deletions tests/Documents81/SuitInt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}