From 819825438c9e37703499b028aae3d0c4c0f28c03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 29 Jan 2022 19:13:30 +0000 Subject: [PATCH 1/2] tools(deps-dev): update vimeo/psalm requirement in /tools/psalm Updates the requirements on [vimeo/psalm](https://github.com/vimeo/psalm) to permit the latest version. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/4.18.1...4.19.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- tools/psalm/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/psalm/composer.json b/tools/psalm/composer.json index e638bf4c..7f674072 100644 --- a/tools/psalm/composer.json +++ b/tools/psalm/composer.json @@ -4,7 +4,7 @@ "type": "metapackage", "require-dev": { "roave/security-advisories": "dev-latest", - "vimeo/psalm": "4.18.1" + "vimeo/psalm": "4.19.0" }, "prefer-stable": true, "config": { From 8d56a7b20c31af62f749d6096225a2159b51f880 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 31 Jan 2022 19:42:18 +0100 Subject: [PATCH 2/2] fixed `ValidatorInterface::validateString()` parameter to be non-empty string Signed-off-by: Jan Kowalleck --- HISTORY.md | 6 ++++++ src/Core/Validation/ValidatorInterface.php | 3 +++ src/Core/Validation/Validators/JsonValidator.php | 2 ++ src/Core/Validation/Validators/XmlValidator.php | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 85e34523..579f7577 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. ## unreleased +* Fixed + * `CycloneDX\Core\Validation\ValidatorInterface::validateString()` and implementations + are documented as `non-empty-string`, were undocumented `string` before. (via [#63]) + +[#63]: https://github.com/CycloneDX/cyclonedx-php-library/pull/63 + ## 1.4.0 - 2021-12-20 * Added diff --git a/src/Core/Validation/ValidatorInterface.php b/src/Core/Validation/ValidatorInterface.php index fb9898af..34e18903 100644 --- a/src/Core/Validation/ValidatorInterface.php +++ b/src/Core/Validation/ValidatorInterface.php @@ -34,5 +34,8 @@ public function __construct(SpecInterface $spec); public function getSpec(): SpecInterface; + /** + * @psalm-param non-empty-string $string + */ public function validateString(string $string): ?ValidationError; } diff --git a/src/Core/Validation/Validators/JsonValidator.php b/src/Core/Validation/Validators/JsonValidator.php index 202c0796..0e49fddf 100644 --- a/src/Core/Validation/Validators/JsonValidator.php +++ b/src/Core/Validation/Validators/JsonValidator.php @@ -54,6 +54,8 @@ protected static function listSchemaFiles(): array } /** + * @psalm-param non-empty-string $string + * * @throws FailedLoadingSchemaException if schema file unknown or not readable * @throws JsonException if loading the JSON failed * diff --git a/src/Core/Validation/Validators/XmlValidator.php b/src/Core/Validation/Validators/XmlValidator.php index d6b72b4c..a3222ad9 100644 --- a/src/Core/Validation/Validators/XmlValidator.php +++ b/src/Core/Validation/Validators/XmlValidator.php @@ -52,6 +52,8 @@ protected static function listSchemaFiles(): array } /** + * @psalm-param non-empty-string $string + * * @throws FailedLoadingSchemaException if schema file unknown or not readable * @throws DOMException if loading the DOM failed * @@ -97,6 +99,8 @@ private function validateDomWithSchema(DOMDocument $doc): ?\LibXMLError } /** + * @psalm-param non-empty-string $xml + * * @throws DOMException if loading the DOM failed */ private function loadDomFromXml(string $xml): DOMDocument