diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
index 8ccc512269bd777b94758c017d103a12b16a74fc..946645d97c3d4de8360b8271c5d080e09db7671f 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
@@ -41,7 +41,7 @@ class EntityReferenceItem extends FieldItemBase {
    *
    * @var int
    */
-  const NEW_ENTITY_MARKER = -1;
+  protected static $NEW_ENTITY_MARKER = -1;
 
   /**
    * {@inheritdoc}
@@ -168,7 +168,7 @@ public function setValue($values, $notify = TRUE) {
         // its actual id and target_id will be different, due to the new entity
         // marker.
         $entity_id = $this->get('entity')->getTargetIdentifier();
-        if ($entity_id != $values['target_id'] && ($values['target_id'] != static::NEW_ENTITY_MARKER || !$this->entity->isNew())) {
+        if ($entity_id != $values['target_id'] && ($values['target_id'] != static::$NEW_ENTITY_MARKER || !$this->entity->isNew())) {
           throw new \InvalidArgumentException('The target id and entity passed to the entity reference item do not match.');
         }
       }
@@ -201,10 +201,10 @@ public function onChange($property_name, $notify = TRUE) {
     // Make sure that the target ID and the target property stay in sync.
     if ($property_name == 'entity') {
       $property = $this->get('entity');
-      $target_id = $property->isTargetNew() ? static::NEW_ENTITY_MARKER : $property->getTargetIdentifier();
+      $target_id = $property->isTargetNew() ? static::$NEW_ENTITY_MARKER : $property->getTargetIdentifier();
       $this->writePropertyValue('target_id', $target_id);
     }
-    elseif ($property_name == 'target_id' && $this->target_id != static::NEW_ENTITY_MARKER) {
+    elseif ($property_name == 'target_id' && $this->target_id != static::$NEW_ENTITY_MARKER) {
       $this->writePropertyValue('entity', $this->target_id);
     }
     parent::onChange($property_name, $notify);
@@ -262,7 +262,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
    *   TRUE if the item holds an unsaved entity.
    */
   public function hasNewEntity() {
-    return $this->target_id === static::NEW_ENTITY_MARKER;
+    return $this->target_id === static::$NEW_ENTITY_MARKER;
   }
 
   /**
diff --git a/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php b/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php
index 0f12f9abd8a33dc5c3ce537f1e3b3134415ca77d..9a6a2689bbdeea4cdb19486311cbba7473b8427c 100644
--- a/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php
+++ b/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php
@@ -69,7 +69,7 @@ public function getSettableValues(AccountInterface $account = NULL) {
     // Flatten options firstly, because Settable Options may contain group
     // arrays.
     $values = array_keys(OptGroup::flattenOptions($this->getSettableOptions($account)));
-    $values[] = static::NEW_ENTITY_MARKER;
+    $values[] = static::$NEW_ENTITY_MARKER;
     return $values;
   }