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 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": {