Needs work
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2026 at 12:30 UTC
Updated:
13 Feb 2026 at 20:58 UTC
Jump to comment: Most recent
Once we can use property hooks, we can define entity as a property on EntityReferenceFieldItemList and use property hooks to return the referenced entity.
This will allow us to completely remove the hack added in #3565937: Workaround PHP bug with fibers and __get() because property hooks don't have the same guarding issue.
The test coverage added in there can stay - since that demonstrates that the fiber suspend isn't broken by any PHP bugs.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
godotislateTook a shot with property hooks for
entityin bothEntityReferenceItemandEntityReferenceItemList. I choseEntityReferenceItemoverEntityReferenceItemBase, sinceentityis defined inEntityReferenceItem::propertyDefinitionsand not the code>EntityReferenceItemBase class.I thought it also made sense to add property hooks for
target_id, even though that property isn't involved in the Fiber issue.But the test PHPCS and PHPStan configuration doesn't like property hooks:
https://git.drupalcode.org/issue/drupal-3566626/-/jobs/8312295
https://git.drupalcode.org/issue/drupal-3566626/-/jobs/8312294
I ignored these temporarily, and otherwise tests are passing.
Comment #6
godotislateNot sure about PHPStan, but looks like PHPCS support for property hooks is still in progress: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/734
Comment #7
mondrakeGot similar PHPStan error while playing with property hooks in the image system:
if I
composer remove mglaman/phpstan-drupal, the error disappears. Not necessarily a phpstan-drupal issue, anyway - could also be related tophpstan-deprecation-rules.Looks like we're having a general problem with property hooks atm.
Comment #8
mondrake#7 the issue is in
\mglaman\PHPStanDrupal\DeprecatedScope\IgnoreDeprecationsScope. That method tries to reflect property hook g/setter as if they were normal methods which they aren't apparently.Comment #9
mondrakeI proposed a PR with a fix upstream, https://github.com/mglaman/phpstan-drupal/pull/935
Comment #10
godotislateThanks for investigating!
I think the bigger challenge might be PHPCS, but one step at a time.