Document field item properties with @property doc

Created on 11 August 2017, almost 7 years ago
Updated 2 February 2023, over 1 year ago

Field item properties can be accessed via magic method.
This is thanks to FieldItemBase::__get().

IMO, magic __get() is only useful if the IDE can determine the return type.

Fortunately this is easy to achieve. E.g. like this on EntityReferenceItem:

namespace Drupal\Core\Field\Plugin\Field\FieldType;
[..]
/**
[..]
 *
 * @property string|int $target_id
 * @property EntityInterface $entity
 */
class EntityReferenceItem [..] {

There are probably more magic __get() in other places. But for this issue let us focus on field items.

📌 Task
Status

Needs work

Version

10.1 ✨

Component
Field  →

Last updated about 12 hours ago

Created by

🇩🇪Germany donquixote

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024