Skip to content

Commit 6150d44

Browse files
authored
Merge pull request #356 from larowlan/patch-1
The entity property can return NULL
2 parents f0172e8 + d3c3e4c commit 6150d44

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

stubs/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use Drupal\Core\TypedData\OptionsProviderInterface;
88

99
/**
1010
* @property string|integer $target_id
11-
* @property \Drupal\Core\Entity\EntityInterface $entity
11+
* @property \Drupal\Core\Entity\EntityInterface|null $entity
1212
*/
1313
class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterface, PreconfiguredFieldUiOptionsInterface {
1414
}

tests/src/Type/data/field-types.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
assert($entity_reference_field instanceof EntityReferenceItem);
7070
assertType(EntityReferenceItem::class, $entity_reference_field);
7171
assertType('int|string', $entity_reference_field->target_id);
72-
assertType('Drupal\Core\Entity\EntityInterface', $entity_reference_field->entity);
72+
assertType('Drupal\Core\Entity\EntityInterface|null', $entity_reference_field->entity);
7373

7474
// FloatItem.
7575
$float_field = $node->get('field_float')->first();

0 commit comments

Comments
 (0)