From 64a02223ed90b41be090265161bd07d347351a41 Mon Sep 17 00:00:00 2001 From: Jawira Portugal Date: Fri, 12 Jun 2026 11:11:50 +0200 Subject: [PATCH 1/4] fix: Add parent constructor call in EnumReflectionProperty --- phpstan-baseline.neon | 12 ------ src/Reflection/EnumReflectionProperty.php | 42 +------------------ .../Reflection/EnumReflectionPropertyTest.php | 12 ++++++ 3 files changed, 14 insertions(+), 52 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e14ded7e..1bf49ced 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -18,18 +18,6 @@ parameters: count: 1 path: src/ObjectManagerDecorator.php - - - message: '#^Doctrine\\Persistence\\Reflection\\EnumReflectionProperty\:\:__construct\(\) does not call parent constructor from ReflectionProperty\.$#' - identifier: constructor.missingParentCall - count: 1 - path: src/Reflection/EnumReflectionProperty.php - - - - message: '#^Method Doctrine\\Persistence\\Reflection\\EnumReflectionProperty\:\:getDeclaringClass\(\) return type with generic class ReflectionClass does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/Reflection/EnumReflectionProperty.php - - message: '#^Method Doctrine\\Persistence\\Reflection\\EnumReflectionProperty\:\:toEnum\(\) should return array\\|BackedEnum but returns array\\.$#' identifier: return.type diff --git a/src/Reflection/EnumReflectionProperty.php b/src/Reflection/EnumReflectionProperty.php index 01394270..188366b4 100644 --- a/src/Reflection/EnumReflectionProperty.php +++ b/src/Reflection/EnumReflectionProperty.php @@ -5,9 +5,7 @@ namespace Doctrine\Persistence\Reflection; use BackedEnum; -use ReflectionClass; use ReflectionProperty; -use ReflectionType; use ReturnTypeWillChange; use function array_map; @@ -28,33 +26,12 @@ class EnumReflectionProperty extends ReflectionProperty /** @param class-string $enumType */ public function __construct(ReflectionProperty $originalReflectionProperty, string $enumType) { + parent::__construct($originalReflectionProperty->class, $originalReflectionProperty->name); + $this->originalReflectionProperty = $originalReflectionProperty; $this->enumType = $enumType; } - public function getDeclaringClass(): ReflectionClass - { - return $this->originalReflectionProperty->getDeclaringClass(); - } - - public function getName(): string - { - return $this->originalReflectionProperty->getName(); - } - - public function getType(): ?ReflectionType - { - return $this->originalReflectionProperty->getType(); - } - - /** - * {@inheritDoc} - */ - public function getAttributes(?string $name = null, int $flags = 0): array - { - return $this->originalReflectionProperty->getAttributes($name, $flags); - } - /** * {@inheritDoc} * @@ -133,19 +110,4 @@ private function toEnum($value) return $this->enumType::from($value); } - - public function getModifiers(): int - { - return $this->originalReflectionProperty->getModifiers(); - } - - public function getDocComment(): string|false - { - return $this->originalReflectionProperty->getDocComment(); - } - - public function isPrivate(): bool - { - return $this->originalReflectionProperty->isPrivate(); - } } diff --git a/tests_php81/Reflection/EnumReflectionPropertyTest.php b/tests_php81/Reflection/EnumReflectionPropertyTest.php index 57590a8b..c8e0f760 100644 --- a/tests_php81/Reflection/EnumReflectionPropertyTest.php +++ b/tests_php81/Reflection/EnumReflectionPropertyTest.php @@ -131,6 +131,18 @@ public function testIsPrivate(): void $reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class); self::assertFalse($reflProperty->isPrivate()); } + + public function testIsPublic(): void + { + $reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class); + self::assertTrue($reflProperty->isPublic()); + } + + public function testHasDefaultValue(): void + { + $reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class); + self::assertTrue($reflProperty->hasDefaultValue()); + } } #[Attribute(Attribute::TARGET_PROPERTY)] From 3aaf119a0bdb8ce57b37b59cd485ee47a27fba31 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 13 Jun 2026 19:22:09 +0000 Subject: [PATCH 2/4] Bump the doctrine group with 5 updates Bumps the doctrine group with 5 updates: | Package | From | To | | --- | --- | --- | | [doctrine/.github/.github/workflows/coding-standards.yml](https://github.com/doctrine/.github) | `15.0.0` | `15.1.0` | | [doctrine/.github/.github/workflows/continuous-integration.yml](https://github.com/doctrine/.github) | `15.0.0` | `15.1.0` | | [doctrine/.github/.github/workflows/documentation.yml](https://github.com/doctrine/.github) | `15.0.0` | `15.1.0` | | [doctrine/.github/.github/workflows/release-on-milestone-closed.yml](https://github.com/doctrine/.github) | `15.0.0` | `15.1.0` | | [doctrine/.github/.github/workflows/phpstan.yml](https://github.com/doctrine/.github) | `15.0.0` | `15.1.0` | Updates `doctrine/.github/.github/workflows/coding-standards.yml` from 15.0.0 to 15.1.0 - [Release notes](https://github.com/doctrine/.github/releases) - [Commits](https://github.com/doctrine/.github/compare/15.0.0...15.1.0) Updates `doctrine/.github/.github/workflows/continuous-integration.yml` from 15.0.0 to 15.1.0 - [Release notes](https://github.com/doctrine/.github/releases) - [Commits](https://github.com/doctrine/.github/compare/15.0.0...15.1.0) Updates `doctrine/.github/.github/workflows/documentation.yml` from 15.0.0 to 15.1.0 - [Release notes](https://github.com/doctrine/.github/releases) - [Commits](https://github.com/doctrine/.github/compare/15.0.0...15.1.0) Updates `doctrine/.github/.github/workflows/release-on-milestone-closed.yml` from 15.0.0 to 15.1.0 - [Release notes](https://github.com/doctrine/.github/releases) - [Commits](https://github.com/doctrine/.github/compare/15.0.0...15.1.0) Updates `doctrine/.github/.github/workflows/phpstan.yml` from 15.0.0 to 15.1.0 - [Release notes](https://github.com/doctrine/.github/releases) - [Commits](https://github.com/doctrine/.github/compare/15.0.0...15.1.0) --- updated-dependencies: - dependency-name: doctrine/.github/.github/workflows/coding-standards.yml dependency-version: 15.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: doctrine - dependency-name: doctrine/.github/.github/workflows/continuous-integration.yml dependency-version: 15.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: doctrine - dependency-name: doctrine/.github/.github/workflows/documentation.yml dependency-version: 15.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: doctrine - dependency-name: doctrine/.github/.github/workflows/release-on-milestone-closed.yml dependency-version: 15.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: doctrine - dependency-name: doctrine/.github/.github/workflows/phpstan.yml dependency-version: 15.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: doctrine ... Signed-off-by: dependabot[bot] --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/continuous-integration.yml | 2 +- .github/workflows/documentation.yml | 2 +- .github/workflows/release-on-milestone-closed.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index cd8b9bc7..34d41214 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -12,6 +12,6 @@ on: jobs: coding-standards: name: "Coding Standards" - uses: "doctrine/.github/.github/workflows/coding-standards.yml@15.0.0" + uses: "doctrine/.github/.github/workflows/coding-standards.yml@15.1.0" with: composer-root-version: "3.0" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 088a6b69..7dc7e674 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -12,7 +12,7 @@ on: jobs: phpunit: name: "PHPUnit" - uses: "doctrine/.github/.github/workflows/continuous-integration.yml@15.0.0" + uses: "doctrine/.github/.github/workflows/continuous-integration.yml@15.1.0" with: composer-root-version: "3.0" php-versions: '["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"]' diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 640f06bd..04037de7 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -17,4 +17,4 @@ on: jobs: documentation: name: "Documentation" - uses: "doctrine/.github/.github/workflows/documentation.yml@15.0.0" + uses: "doctrine/.github/.github/workflows/documentation.yml@15.1.0" diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 7100986c..786e150b 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -8,7 +8,7 @@ on: jobs: release: name: "Git tag, release & create merge-up PR" - uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@15.0.0" + uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@15.1.0" secrets: GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 26a71223..1f24ed41 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -12,6 +12,6 @@ on: jobs: static-analysis: name: "Static Analysis" - uses: "doctrine/.github/.github/workflows/phpstan.yml@15.0.0" + uses: "doctrine/.github/.github/workflows/phpstan.yml@15.1.0" with: composer-root-version: "3.0" From 222ed758c60b01fdab8b13ef522c8968d7ea79bf Mon Sep 17 00:00:00 2001 From: Junaid Hussnain <84363665+Junaid-PK@users.noreply.github.com> Date: Fri, 11 Sep 2026 13:53:12 +0500 Subject: [PATCH 3/4] Handle root-namespace classes in SymfonyFileLocator (#521) --- src/Mapping/Driver/SymfonyFileLocator.php | 9 ++------- tests/Mapping/SymfonyFileLocatorTest.php | 9 +++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Mapping/Driver/SymfonyFileLocator.php b/src/Mapping/Driver/SymfonyFileLocator.php index 09339fae..5d9b1ceb 100644 --- a/src/Mapping/Driver/SymfonyFileLocator.php +++ b/src/Mapping/Driver/SymfonyFileLocator.php @@ -11,16 +11,14 @@ use RuntimeException; use function array_keys; -use function assert; +use function basename; use function is_dir; use function is_file; -use function is_int; use function realpath; use function sprintf; use function str_replace; use function str_starts_with; use function strlen; -use function strrpos; use function strtr; use function substr; @@ -222,12 +220,9 @@ public function findMappingFile(string $className): string } } - $pos = strrpos($className, '\\'); - assert(is_int($pos)); - throw MappingException::mappingFileNotFound( $className, - substr($className, $pos + 1) . $this->fileExtension, + basename(str_replace('\\', '/', $className)) . $this->fileExtension, ); } diff --git a/tests/Mapping/SymfonyFileLocatorTest.php b/tests/Mapping/SymfonyFileLocatorTest.php index ff7767d8..0b58d5b4 100644 --- a/tests/Mapping/SymfonyFileLocatorTest.php +++ b/tests/Mapping/SymfonyFileLocatorTest.php @@ -188,6 +188,15 @@ public function testFindMappingFileNotFound(): void $locator->findMappingFile('Foo\\stdClass2'); } + public function testFindMappingFileNotFoundForClassInRootNamespace(): void + { + $locator = new SymfonyFileLocator([], '.yml'); + + $this->expectException(MappingException::class); + $this->expectExceptionMessage("No mapping file found named 'DateTime.yml' for class 'DateTime'."); + $locator->findMappingFile('DateTime'); + } + public function testFindMappingFileLeastSpecificNamespaceFirst(): void { // Low -> High From ce55d1f913b73eb21c180bbabdf4b5330a8b6503 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 3 Oct 2026 08:48:36 +0200 Subject: [PATCH 4/4] Describe ManagerRegistry for Symfony's debug:autowiring command --- src/ManagerRegistry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ManagerRegistry.php b/src/ManagerRegistry.php index 2e0a389c..43ac855d 100644 --- a/src/ManagerRegistry.php +++ b/src/ManagerRegistry.php @@ -5,7 +5,7 @@ namespace Doctrine\Persistence; /** - * Contract covering object managers for a Doctrine persistence layer ManagerRegistry class to implement. + * Gives access to the object managers and connections of an application, by name or by class. */ interface ManagerRegistry extends ConnectionRegistry {