Skip to content

Fix Loggable template bounds for Symfony TypeInfo compatibility#3046

Open
Prometee wants to merge 1 commit intodoctrine-extensions:mainfrom
Prometee:fix/loggable-template-type-info-3044
Open

Fix Loggable template bounds for Symfony TypeInfo compatibility#3046
Prometee wants to merge 1 commit intodoctrine-extensions:mainfrom
Prometee:fix/loggable-template-type-info-3044

Conversation

@Prometee
Copy link
Copy Markdown

@Prometee Prometee commented Mar 28, 2026

Fixes #3044.

What

This PR updates 3 Loggable PHPDoc template bounds that currently combine Loggable and object in the same bound:

  • src/Loggable/LoggableListener.php
  • src/Loggable/Entity/MappedSuperclass/AbstractLogEntry.php
  • src/Loggable/LogEntryInterface.php
    The bound is simplified to object.

Why

Recent versions of symfony/type-info parse @phpstan-template / @psalm-template annotations and reject bounds combining object with a specific class/interface.
This causes the incompatibility reported in #3044.

Scope / BC

  • PHPDoc-only change
  • No runtime behavior changes
  • No API signature changes

@mbabker
Copy link
Copy Markdown
Contributor

mbabker commented Mar 28, 2026

I dare suggest this should go the other way around and just be an object.

None of the extensions require entities to implement the marker interfaces (of which this Loggable interface is one), so the generic type only supporting the marker interface would create other static analysis issues if you aren't implementing them.

(Long term since they offer no value to this library, maybe they should just be deprecated and let applications have their own marker interfaces if they so choose?)

@Prometee Prometee force-pushed the fix/loggable-template-type-info-3044 branch from 8ae7d5c to 9824f91 Compare March 28, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatibility with symfony/type-info > 8.0.4

2 participants