Issue #2444979 by Wim Leers, webflo, borisson_, catch, Gábor Hojtsy, smustgrave: Trigger deprecation notice for old schema definition for sequence

merge-requests/4600/merge
effulgentsia 2023-09-22 13:19:13 -07:00
parent 9a3156daf8
commit 15f230916a
3 changed files with 24 additions and 18 deletions

View File

@ -28,6 +28,8 @@ class Sequence extends ArrayElement {
$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'];

View File

@ -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

View File

@ -352,6 +352,8 @@ class ConfigSchemaTest extends KernelTestBase {
/**
* Tests configuration value data type enforcement using schemas.
*
* @group legacy
*/
public function testConfigSaveWithSchema() {
$untyped_values = [
@ -399,6 +401,7 @@ class ConfigSchemaTest extends KernelTestBase {
];
// 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();