Skip EntityNotFinalRule when native lazy objects or lazy ghost objects are enabled#724
Conversation
|
@ondrejmirtes The shared claude.ai link cannot be opened by anyone but you. Not sure if you are aware. Thanks for fixing it though! |
|
Yeah, needs to be polished and finished though 😊 My main motivation was that I wanted to mention this at https://github.com/phpstan/phpstan/blob/2.2.x/website/errors/doctrine.finalEntity.md / https://phpstan.org/error-identifiers/doctrine.finalEntity and realized it's not fixed yet. |
…s are enabled When Doctrine ORM is configured with lazy ghost objects (ORM 2.x) or native lazy objects (ORM 3.4+), final entities no longer cause problems because proxy subclasses are not needed. This detects the configuration from the object manager and suppresses the error accordingly. Fixes #667 https://claude.ai/code/session_01EHwDbWjcx526ofXQu1KxNz
d645e3c to
892243b
Compare
|
@phpstan-bot Look at the CI bulld failures. And please skip the lazy ghost feature for ORM 2.x. Only keep the native lazy objects for new PHP and Doctrine3.x. |
|
Claude finished @ondrejmirtes's task in 10m 21s —— View job All tasks completed
Summary of changes (commit
|
…M 3.4+ - Remove isLazyGhostObjectEnabled() check from ObjectMetadataResolver - Use enableNativeLazyObjects(true) instead of setLazyGhostObjectEnabled(true) - Skip native lazy objects test when PHP < 8.4 or ORM < 3.4 - Conditionally expect no errors in pre-existing tests when native lazy objects are the default - Exclude entity-manager-lazy-ghost-objects.php from PHPStan analysis Co-authored-by: Ondřej Mirtes <ondrejmirtes@users.noreply.github.com>
|
@phpstan-bot Please check the PHPStan build failures for each version. We will probably need to introduce a new conditional baseline file. There are failures for PHPStan on 7.4 through 8.4 because these run doctrine/orm 2.x. PHPStan on 8.3 with Doctrine 3 has differenet failures which can be added to phpstan-baseline-orm-3.neon IMHO. |
|
Claude finished @ondrejmirtes's task in 4m 48s —— View job All tasks completed
AnalysisPHP 7.4–8.4 with ORM 2.x — 1 error each:
PHP 8.3 with Doctrine 3 — 6 errors, all
Platform test (8.1 with ORM 3): Unrelated pre-existing failure (pgsql bool/null mismatch). Summary of changes (commit
|
- Add function.alreadyNarrowedType to @phpstan-ignore comments alongside function.impossibleType so both ORM 2.x and 3.x identifiers are covered - Create phpstan-baseline-orm-2.neon for the method.notFound error on Configuration::isNativeLazyObjectsEnabled() which only exists in ORM 3.4+ - Extend compatibility/orm-3-baseline.php to conditionally include the ORM 2 baseline when ORM 3 is not installed Co-authored-by: Ondřej Mirtes <ondrejmirtes@users.noreply.github.com>
When Doctrine ORM is configured with lazy ghost objects (ORM 2.x) or
native lazy objects (ORM 3.4+), final entities no longer cause problems
because proxy subclasses are not needed. This detects the configuration
from the object manager and suppresses the error accordingly.
Fixes #667
https://claude.ai/code/session_01EHwDbWjcx526ofXQu1KxNz