diff -u b/core/modules/entity/entity.module b/core/modules/entity/entity.module --- b/core/modules/entity/entity.module +++ b/core/modules/entity/entity.module @@ -415,9 +415,8 @@ /** * Returns the label of an entity. * - * This is a wrapper for EntityInterface::label(), this function should only - * be used for menu title callbacks and similar places that do not allow to - * directly call the method. + * This is a wrapper for EntityInterface::label(). This function should only + * be used as callback, e.g. for menu title callbacks. * * @param Drupal\entity\EntityInterface $entity * The entity for which to generate the label. diff -u b/core/modules/field/tests/field.test b/core/modules/field/tests/field.test --- b/core/modules/field/tests/field.test +++ b/core/modules/field/tests/field.test @@ -3396,7 +3396,7 @@ $entity = field_test_create_stub_entity(); foreach ($entity_types as $entity_type) { - $label = entity_create($entity_type, (array)$entity)->label(); + $label = entity_create($entity_type, (array) $entity)->label(); switch ($entity_type) { case 'test_entity_no_label': diff -u b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php --- b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php @@ -25,7 +25,7 @@ parent::setUp('user'); $this->account = $this->drupalCreateUser(); - $this->anonymous = entity_create('user', (array)drupal_anonymous_user()); + $this->anonymous = entity_create('user', (array) drupal_anonymous_user()); } /**