diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php index f851723758..eb979c7fd6 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageInterface.php @@ -27,17 +27,17 @@ public function createTranslation(ContentEntityInterface $entity, $langcode, arr /** * Creates an entity with sample field values. * - * @param string $bundle - * The entity bundle. + * @param string|bool $bundle + * (optional) The entity bundle. * @param array $values * (optional) Any default values to use during generation. * * @return \Drupal\Core\Entity\FieldableEntityInterface * A fieldable content entity. * - * @throws \Drupal\Core\Entity\Exception\MissingEntityBundleException - * Thrown if the requested entity bundle does not exist. + * @throws \Drupal\Core\Entity\EntityStorageException + * Thrown if the bundle does not exist or was needed but not specified. */ - public function createWithSampleValues($bundle, array $values = []); + public function createWithSampleValues($bundle = FALSE, array $values = []); } diff --git a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php index e271f5ca0b..b3fc12d6b6 100644 --- a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php @@ -21,6 +21,6 @@ public function createTranslation(ContentEntityInterface $entity, $langcode, arr /** * {@inheritdoc} */ - public function createWithSampleValues($bundle, array $values = []) {} + public function createWithSampleValues($bundle = FALSE, array $values = []) {} } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/Element/CreateSampleEntityTest.php b/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php similarity index 98% rename from core/tests/Drupal/KernelTests/Core/Entity/Element/CreateSampleEntityTest.php rename to core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php index 05b9b4322f..b52659e5bb 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/Element/CreateSampleEntityTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php @@ -1,6 +1,6 @@