diff --git a/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/AutoIncrementingTestItem.php b/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/AutoIncrementingTestItem.php
index baa175e769cd9ce0db2215eb328627ab259369f5..d4b53defe9393c07ba2ad084270b109505b363b1 100644
--- a/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/AutoIncrementingTestItem.php
+++ b/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/AutoIncrementingTestItem.php
@@ -32,8 +32,8 @@ public function preSave() {
    *   The incremented field value.
    */
   private static function getIncrementedFieldValue() {
-    $current_value = &drupal_static(__METHOD__, 0);
-    return ++$current_value;
+    static $cache = 0;
+    return ++$cache;
   }
 
 }