From 15f230916aa420c8f7dfcb31fe6439fc5413384a Mon Sep 17 00:00:00 2001 From: effulgentsia <alex.bronstein@acquia.com> Date: Fri, 22 Sep 2023 13:19:13 -0700 Subject: [PATCH] =?UTF-8?q?Issue=20#2444979=20by=20Wim=20Leers,=20webflo,?= =?UTF-8?q?=20borisson=5F,=20catch,=20G=C3=A1bor=20Hojtsy,=20smustgrave:?= =?UTF-8?q?=20Trigger=20deprecation=20notice=20for=20old=20schema=20defini?= =?UTF-8?q?tion=20for=20sequence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drupal/Core/Config/Schema/Sequence.php | 2 + .../schema/config_schema_test.schema.yml | 37 ++++++++++--------- .../Core/Config/ConfigSchemaTest.php | 3 ++ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/core/lib/Drupal/Core/Config/Schema/Sequence.php b/core/lib/Drupal/Core/Config/Schema/Sequence.php index 8e715baf6704..66a5c3a36f85 100644 --- a/core/lib/Drupal/Core/Config/Schema/Sequence.php +++ b/core/lib/Drupal/Core/Config/Schema/Sequence.php @@ -28,6 +28,8 @@ protected function getElementDefinition($key) { $definition = []; if (isset($this->definition['sequence'][0])) { $definition = $this->definition['sequence'][0]; + $bc_sequence_location = $this->getPropertyPath(); + @trigger_error("The definition for the '$bc_sequence_location' sequence declares the type of its items in a way that is deprecated in drupal:8.0.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/2442603", E_USER_DEPRECATED); } elseif ($this->definition['sequence']) { $definition = $this->definition['sequence']; diff --git a/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml b/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml index 4dae83290481..2ef496055139 100644 --- a/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml +++ b/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml @@ -120,6 +120,7 @@ config_schema_test.schema_data_types: type: sequence sequence: type: boolean + # @see \Drupal\Core\Config\Schema\Sequence::getElementDefinition() sequence_bc: type: sequence sequence: @@ -220,7 +221,7 @@ wrapping.config_schema_test.plugin_types: tests: type: sequence sequence: - - type: wrapping.test.plugin_types.[plugin_id] + type: wrapping.test.plugin_types.[plugin_id] wrapping.test.plugin_types.*: type: test.plugin_types.[plugin_id] @@ -240,7 +241,7 @@ wrapping.config_schema_test.double_brackets: tests: type: sequence sequence: - - type: wrapping.test.double_brackets.[another_key] + type: wrapping.test.double_brackets.[another_key] wrapping.test.double_brackets.*: type: test.double_brackets.[foo].[bar] @@ -277,7 +278,7 @@ wrapping.config_schema_test.other_double_brackets: tests: type: sequence sequence: - - type: wrapping.test.other_double_brackets.[id] + type: wrapping.test.other_double_brackets.[id] wrapping.test.other_double_brackets.*: type: test.double_brackets.[id] @@ -305,36 +306,36 @@ config_schema_test.schema_sequence_sort: type: sequence orderby: key sequence: - - type: string + type: string value_sort: type: sequence orderby: value sequence: - - type: string + type: string no_sort: type: sequence sequence: - - type: string + type: string complex_sort_value: type: sequence orderby: value sequence: - - type: mapping - mapping: - foo: - type: string - bar: - type: string + type: mapping + mapping: + foo: + type: string + bar: + type: string complex_sort_key: type: sequence orderby: key sequence: - - type: mapping - mapping: - foo: - type: string - bar: - type: string + type: mapping + mapping: + foo: + type: string + bar: + type: string config_schema_test.schema_mapping_sort: type: config_object diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php index 8a0d99bfcde1..f5f9df5385fe 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php @@ -352,6 +352,8 @@ public function testSchemaData() { /** * Tests configuration value data type enforcement using schemas. + * + * @group legacy */ public function testConfigSaveWithSchema() { $untyped_values = [ @@ -399,6 +401,7 @@ public function testConfigSaveWithSchema() { ]; // Save config which has a schema that enforces types. + $this->expectDeprecation("The definition for the 'config_schema_test.schema_data_types.sequence_bc' sequence declares the type of its items in a way that is deprecated in drupal:8.0.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/2442603"); $this->config('config_schema_test.schema_data_types') ->setData($untyped_to_typed) ->save(); -- GitLab