diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index fec847d3312..066be5fb762 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -2,7 +2,6 @@ namespace Drupal\Core\Config; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\Schema\ConfigSchemaAlterException; @@ -83,10 +82,7 @@ class TypedConfigManager extends TypedDataManager implements TypedConfigManagerI $data = $this->configStorage->read($name); if ($data === FALSE) { // For a typed config the data MUST exist. - $data = []; - trigger_error(new FormattableMarkup('Missing required data for typed configuration: @config', [ - '@config' => $name, - ]), E_USER_ERROR); + throw new \InvalidArgumentException("Missing required data for typed configuration: $name"); } return $this->createFromNameAndData($name, $data); } diff --git a/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php b/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php index c26ec8ca805..44c6b7d87f1 100644 --- a/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php +++ b/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php @@ -12,7 +12,6 @@ use Drupal\Core\TypedData\ComplexDataInterface; use Drupal\Core\TypedData\Type\IntegerInterface; use Drupal\Core\TypedData\Type\StringInterface; use Drupal\KernelTests\KernelTestBase; -use PHPUnit\Framework\Error\Error; use Symfony\Component\Validator\ConstraintViolationListInterface; /** @@ -53,7 +52,7 @@ class TypedConfigTest extends KernelTestBase { $typed_config_manager->get('config_test.non_existent'); $this->fail('Expected error when trying to get non-existent typed config.'); } - catch (Error $e) { + catch (\InvalidArgumentException $e) { $this->assertEquals('Missing required data for typed configuration: config_test.non_existent', $e->getMessage()); }