Skip to content
Snippets Groups Projects

Move where we decide deprecation vs error

Open Alex Pott requested to merge issue/drupal-3402168:3402168-alternate-approach into 11.x
1 unresolved thread
Files
5
@@ -53,8 +53,12 @@ class ConfigSchemaChecker implements EventSubscriberInterface {
* The typed config manager.
* @param string[] $exclude
* An array of config object names that are excluded from schema checking.
* @param bool $validateConstraints
* Determines if constraints will be validated. If TRUE, constraint
* validation errors will be added to the errors found by
* SchemaCheckTrait::checkConfigSchema().
*/
public function __construct(TypedConfigManagerInterface $typed_manager, array $exclude = []) {
public function __construct(TypedConfigManagerInterface $typed_manager, array $exclude = [], private readonly bool $validateConstraints = FALSE) {
$this->typedManager = $typed_manager;
$this->exclude = $exclude;
}
@@ -82,7 +86,7 @@ public function onConfigSave(ConfigCrudEvent $event) {
$checksum = Crypt::hashBase64(serialize($data));
if (!in_array($name, $this->exclude) && !isset($this->checked[$name . ':' . $checksum])) {
$this->checked[$name . ':' . $checksum] = TRUE;
$errors = $this->checkConfigSchema($this->typedManager, $name, $data);
$errors = $this->checkConfigSchema($this->typedManager, $name, $data, $this->validateConstraints);
if ($errors === FALSE) {
throw new SchemaIncompleteException("No schema for $name");
}
Loading