diff --git a/composer.json b/composer.json index 490263451f73ee0794adab161dd9bdf5ba97548c..cdb213f557c0ca11ee882f77e5474d0c6eb771f4 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "colinodell/psr-testlogger": "^1.2", "composer/composer": "^2.8.1", "drupal/coder": "^8.3.10", - "justinrainbow/json-schema": "^5.2", + "justinrainbow/json-schema": "^5.2 || ^6.3", "lullabot/mink-selenium2-driver": "^1.7", "lullabot/php-webdriver": "^2.0.4", "mglaman/phpstan-drupal": "^1.2.12", diff --git a/composer.lock b/composer.lock index 1e7ff31add09a717800e0b48679d5e068aea37cc..992dc85e6f62f7a28d2939ffe430e78a78949100 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "38510ee3fa6d0ddb39c85b7172e095fc", + "content-hash": "4c1d292a8a8199682b920af13dd37ab2", "packages": [ { "name": "asm89/stack-cors", @@ -4851,16 +4851,16 @@ }, { "name": "composer/composer", - "version": "2.8.6", + "version": "2.8.9", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "937c775a644bd7d2c3dfbb352747488463a6e673" + "reference": "b4e6bff2db7ce756ddb77ecee958a0f41f42bd9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/937c775a644bd7d2c3dfbb352747488463a6e673", - "reference": "937c775a644bd7d2c3dfbb352747488463a6e673", + "url": "https://api.github.com/repos/composer/composer/zipball/b4e6bff2db7ce756ddb77ecee958a0f41f42bd9d", + "reference": "b4e6bff2db7ce756ddb77ecee958a0f41f42bd9d", "shasum": "" }, "require": { @@ -4871,7 +4871,7 @@ "composer/semver": "^3.3", "composer/spdx-licenses": "^1.5.7", "composer/xdebug-handler": "^2.0.2 || ^3.0.3", - "justinrainbow/json-schema": "^5.3", + "justinrainbow/json-schema": "^6.3.1", "php": "^7.2.5 || ^8.0", "psr/log": "^1.0 || ^2.0 || ^3.0", "react/promise": "^2.11 || ^3.2", @@ -4945,7 +4945,7 @@ "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", "security": "https://github.com/composer/composer/security/policy", - "source": "https://github.com/composer/composer/tree/2.8.6" + "source": "https://github.com/composer/composer/tree/2.8.9" }, "funding": [ { @@ -4961,7 +4961,7 @@ "type": "tidelift" } ], - "time": "2025-02-25T12:03:50+00:00" + "time": "2025-05-13T12:01:37+00:00" }, { "name": "composer/metadata-minifier", @@ -5502,30 +5502,40 @@ }, { "name": "justinrainbow/json-schema", - "version": "5.3.0", + "version": "6.4.1", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8" + "reference": "35d262c94959571e8736db1e5c9bc36ab94ae900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", - "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/35d262c94959571e8736db1e5c9bc36ab94ae900", + "reference": "35d262c94959571e8736db1e5c9bc36ab94ae900", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-json": "*", + "marc-mabe/php-enum": "^4.0", + "php": "^7.2 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", + "friendsofphp/php-cs-fixer": "3.3.0", "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" + "marc-mabe/php-enum-phpstan": "^2.0", + "phpspec/prophecy": "^1.19", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^8.5" }, "bin": [ "bin/validate-json" ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, "autoload": { "psr-4": { "JsonSchema\\": "src/JsonSchema/" @@ -5554,16 +5564,16 @@ } ], "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", + "homepage": "https://github.com/jsonrainbow/json-schema", "keywords": [ "json", "schema" ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/5.3.0" + "source": "https://github.com/jsonrainbow/json-schema/tree/6.4.1" }, - "time": "2024-07-06T21:00:26+00:00" + "time": "2025-04-04T13:08:07+00:00" }, { "name": "lullabot/mink-selenium2-driver", @@ -5685,6 +5695,79 @@ }, "time": "2024-08-05T13:00:46+00:00" }, + { + "name": "marc-mabe/php-enum", + "version": "v4.7.1", + "source": { + "type": "git", + "url": "https://github.com/marc-mabe/php-enum.git", + "reference": "7159809e5cfa041dca28e61f7f7ae58063aae8ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/marc-mabe/php-enum/zipball/7159809e5cfa041dca28e61f7f7ae58063aae8ed", + "reference": "7159809e5cfa041dca28e61f7f7ae58063aae8ed", + "shasum": "" + }, + "require": { + "ext-reflection": "*", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpbench/phpbench": "^0.16.10 || ^1.0.4", + "phpstan/phpstan": "^1.3.1", + "phpunit/phpunit": "^7.5.20 | ^8.5.22 | ^9.5.11", + "vimeo/psalm": "^4.17.0 | ^5.26.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-3.x": "3.2-dev", + "dev-master": "4.7-dev" + } + }, + "autoload": { + "psr-4": { + "MabeEnum\\": "src/" + }, + "classmap": [ + "stubs/Stringable.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Marc Bennewitz", + "email": "dev@mabe.berlin", + "homepage": "https://mabe.berlin/", + "role": "Lead" + } + ], + "description": "Simple and fast implementation of enumerations with native PHP", + "homepage": "https://github.com/marc-mabe/php-enum", + "keywords": [ + "enum", + "enum-map", + "enum-set", + "enumeration", + "enumerator", + "enummap", + "enumset", + "map", + "set", + "type", + "type-hint", + "typehint" + ], + "support": { + "issues": "https://github.com/marc-mabe/php-enum/issues", + "source": "https://github.com/marc-mabe/php-enum/tree/v4.7.1" + }, + "time": "2024-11-28T04:54:44+00:00" + }, { "name": "mglaman/phpstan-drupal", "version": "1.3.7", diff --git a/composer/Metapackage/DevDependencies/composer.json b/composer/Metapackage/DevDependencies/composer.json index 2d102e1a977159a42a60c60f1671acefdd70510c..76d83d826ded4d4eb61a8ba36e63f98e3a0e4af9 100644 --- a/composer/Metapackage/DevDependencies/composer.json +++ b/composer/Metapackage/DevDependencies/composer.json @@ -12,7 +12,7 @@ "colinodell/psr-testlogger": "^1.2", "composer/composer": "^2.8.1", "drupal/coder": "^8.3.10", - "justinrainbow/json-schema": "^5.2", + "justinrainbow/json-schema": "^5.2 || ^6.3", "lullabot/mink-selenium2-driver": "^1.7", "lullabot/php-webdriver": "^2.0.4", "mglaman/phpstan-drupal": "^1.2.12", diff --git a/composer/Metapackage/PinnedDevDependencies/composer.json b/composer/Metapackage/PinnedDevDependencies/composer.json index 7c55b3b0a808291bfa8e0f7c3603458b14d6b666..d12b183e251509b933e6166b2e5a46b7a50c6ae8 100644 --- a/composer/Metapackage/PinnedDevDependencies/composer.json +++ b/composer/Metapackage/PinnedDevDependencies/composer.json @@ -14,7 +14,7 @@ "colinodell/psr-testlogger": "v1.3.0", "composer/ca-bundle": "1.5.6", "composer/class-map-generator": "1.6.1", - "composer/composer": "2.8.6", + "composer/composer": "2.8.9", "composer/metadata-minifier": "1.0.0", "composer/pcre": "3.3.2", "composer/spdx-licenses": "1.5.8", @@ -23,9 +23,10 @@ "doctrine/instantiator": "2.0.0", "drupal/coder": "8.3.28", "google/protobuf": "v4.30.2", - "justinrainbow/json-schema": "5.3.0", + "justinrainbow/json-schema": "6.4.1", "lullabot/mink-selenium2-driver": "v1.7.4", "lullabot/php-webdriver": "v2.0.6", + "marc-mabe/php-enum": "v4.7.1", "mglaman/phpstan-drupal": "1.3.7", "micheh/phpcs-gitlab": "1.1.0", "mikey179/vfsstream": "v1.6.12", diff --git a/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php b/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php index 82a9f93ff2c8abd8e19391fb7edc9a572c8aa16f..d747b1354c84625682c39ff405228aac8b1564d3 100644 --- a/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php +++ b/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php @@ -177,7 +177,9 @@ public function validateProps(array $context, Component $component): bool { $errors = array_filter( $this->validator->getErrors(), function (array $error) use ($context): bool { - if (($error['constraint'] ?? '') !== 'type') { + // Support 5.0 ($error['constraint']) and 6.0 + // ($error['constraint']['name']) at the same time. + if (($error['constraint']['name'] ?? $error['constraint'] ?? '') !== 'type') { return TRUE; } return !Element::isRenderArray($context[$error['property']] ?? NULL); diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt index 2fd38072c3a37967eb926c721b3e14c4a4eebfa9..35d543b8740d60fc54d713ecdf46b1e5d218ca39 100644 --- a/core/misc/cspell/dictionary.txt +++ b/core/misc/cspell/dictionary.txt @@ -337,6 +337,7 @@ lspeak lstitle ltitle lzma +mabe mainpage mank maryjane diff --git a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php index 1d52d4fb5a26152b15a940d5463d0d9a2ea92c51..51c51e937bc7d4204da9e6c178a21e7f9129b1bf 100644 --- a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php @@ -9,6 +9,7 @@ use Drupal\Core\Theme\Component\ComponentValidator; use Drupal\Core\Render\Component\Exception\InvalidComponentException; use Drupal\Core\Plugin\Component; +use JsonSchema\ConstraintError; use JsonSchema\Constraints\Factory; use JsonSchema\Constraints\FormatConstraint; use JsonSchema\Entity\JsonPointer; @@ -279,7 +280,15 @@ public function check(&$element, $schema = NULL, ?JsonPointer $path = NULL, $i = } if ($schema->format === 'uri') { if (\is_string($element) && !UrlHelper::isValid($element)) { - $this->addError($path, 'Invalid URL format', 'format', ['format' => $schema->format]); + if (class_exists(ConstraintError::class)) { + // @phpstan-ignore-next-line + $this->addError(ConstraintError::FORMAT_URL(), $path, ['format' => $schema->format]); + } + else { + // @todo Remove when we no longer support justinrainbow/json-schema v5. + // @phpstan-ignore-next-line + $this->addError($path, 'Invalid URL format', 'format', ['format' => $schema->format]); + } } return; }