SchemaCheckTrait::checkConfigSchema() and checkValue() don't property document the @return

Created on 26 February 2024, 4 months ago
Updated 28 February 2024, 4 months ago

Problem/Motivation

The docs for these methods say:

   * @return array|bool
   *   FALSE if no schema found. List of errors if any found. TRUE if fully
   *   valid.


   * @return array
   *   List of errors found while checking with the corresponding schema.

But checkValue() puts a key in its return arrays, e.g.

        return [$error_key => "variable type is $type but applied schema class is $class"];

and callers of this, such as ConfigSchemaChecker::onConfigSave() are expecting a text key:

      $errors = $this->checkConfigSchema($this->typedManager, $name, $data);
      if ($errors === FALSE) {
        throw new SchemaIncompleteException("No schema for $name");
      }
      elseif (is_array($errors)) {
        $text_errors = [];
        foreach ($errors as $key => $error) {
          $text_errors[] = new FormattableMarkup('@key @error', ['@key' => $key, '@error' => $error]);

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Documentation 

Last updated about 19 hours ago

No maintainer
Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024