Skip to content

Fix PHPStan errors detected with PHP 8.4 and Symfony 7.4#3007

Open
GromNaN wants to merge 2 commits into
doctrine:2.16.xfrom
GromNaN:fix/phpstan-errors
Open

Fix PHPStan errors detected with PHP 8.4 and Symfony 7.4#3007
GromNaN wants to merge 2 commits into
doctrine:2.16.xfrom
GromNaN:fix/phpstan-errors

Conversation

@GromNaN

@GromNaN GromNaN commented Jun 15, 2026

Copy link
Copy Markdown
Member

Remove dead code guard in GraphLookup::fromReference() and Lookup::fromReference() — the check ! $this->class->hasReference($fieldName) can never be true since from() already verifies hasReference() before calling fromReference().

Fix XmlDriver using class_exists() instead of interface_exists() to trigger autoloading of ClassMetadata, which is a class not an interface.

Ignore false-positive PHPStan error on ReflectionClass::markLazyObjectAsInitialized() for proxy classes whose lazy nature is only known at runtime (PHP 8.4).

Quote the symfony-version matrix values with a caret (^7.4 instead of 7.4). A bare SYMFONY_REQUIRE=7.4 makes Flex pin symfony/* to exactly 7.4.0, which is affected by the symfony/cache advisory PKSA-z7t6-zt6p-wtng and gets blocked by Composer 2.10's policy.advisories.block. The caret keeps the full 7.4.x range so the resolver picks an unaffected patch.

- Remove dead code guard in GraphLookup::fromReference() and Lookup::fromReference()
  that could never be reached since from() already checks hasReference()
- Fix XmlDriver using class_exists() instead of interface_exists() for autoload
  trigger since ClassMetadata is a class, not an interface
- Ignore false-positive PHPStan error on ReflectionClass::markLazyObjectAsInitialized()
  for proxy classes whose lazy nature is only known at runtime
@GromNaN GromNaN added this to the 2.16.2 milestone Jun 15, 2026
@GromNaN GromNaN added the Typing label Jun 15, 2026
@GromNaN GromNaN force-pushed the fix/phpstan-errors branch from 019ee49 to 001072e Compare June 15, 2026 20:37
@GromNaN GromNaN force-pushed the fix/phpstan-errors branch from 683cb71 to 792eac8 Compare June 15, 2026 21:30
@GromNaN GromNaN requested review from alcaeus and paulinevos June 15, 2026 21:38
@GromNaN GromNaN added the CI label Jun 15, 2026
@GromNaN GromNaN enabled auto-merge (squash) June 15, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant