[PR #9703] Update ClassMetadataInfo::table definition #11814

Closed
opened 2026-01-22 16:12:00 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/9703

State: closed
Merged: Yes


Hello,

I recently encountered an issue when bumping the phpstan level of my project.

The code

$constraints = $metadata->table['uniqueConstraints'] ?? [];

is reported as an error because uniqueConstraints is always set.

But when I dump the value, it seems that sometimes, only the name key is set.
image

Everything except the name key might be undefined when accessing to this public property, for instance in a loadClassMetadata event.

**Original Pull Request:** https://github.com/doctrine/orm/pull/9703 **State:** closed **Merged:** Yes --- Hello, I recently encountered an issue when bumping the phpstan level of my project. The code ``` $constraints = $metadata->table['uniqueConstraints'] ?? []; ``` is reported as an error because `uniqueConstraints` is always set. But when I dump the value, it seems that sometimes, only the name key is set. ![image](https://user-images.githubusercontent.com/52003151/166111545-bedfc84b-26bc-46a9-8b3c-9236efd6bd77.png) Everything except the name key might be undefined when accessing to this public property, for instance in a `loadClassMetadata` event.
admin added the pull-request label 2026-01-22 16:12:00 +01:00
admin closed this issue 2026-01-22 16:12:00 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#11814