Verified Commit 9b1b16e6 authored by godotislate's avatar godotislate
Browse files

fix: #3524163 [regression] Empty slot definitions give incorrect validation message

By: longwave
By: prudloff
By: pemson18
By: amanire
By: paulmckibben
By: smustgrave
parent 42389669
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -81,6 +81,15 @@ public function validateDefinition(array $definition, bool $enforce_schemas): bo
    if (($schema['properties'] ?? NULL) === []) {
      $schema['properties'] = new \stdClass();
    }

    // If a slot has an empty definition,
    // force casting to object instead of array.
    foreach ($definition['slots'] ?? [] as $slot_name => $slot) {
      if ($slot === []) {
        $definition['slots'][$slot_name] = new \stdClass();
      }
    }

    $classes_per_prop = $this->getClassProps($schema);
    $missing_class_errors = [];
    foreach ($classes_per_prop as $prop_name => $class_types) {
+1 −0
Original line number Diff line number Diff line
@@ -39,3 +39,4 @@ slots:
    description: The contents of the banner.
    examples:
      - <p>Foo is <strong>NOT</strong> bar.</p>
  minimal: { }