From 8664445cd297410ecd0bf52156a86cd8bbae49bb Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Tue, 8 Mar 2022 12:41:41 -0600 Subject: [PATCH 1/6] Update development tools as of 2022-03-08 --- .phive/phars.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.phive/phars.xml b/.phive/phars.xml index 6ea1d5c..6665be4 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,9 +1,9 @@ - + - - + + From f0573bf50b4f8f554a3794713a6ae4a9da82dcec Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Tue, 8 Mar 2022 12:42:37 -0600 Subject: [PATCH 2/6] Fix PHPStan issue, it's not detecting iterable types for \DOMNodeList --- src/SchemaValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SchemaValidator.php b/src/SchemaValidator.php index 90dfebf..7690a27 100644 --- a/src/SchemaValidator.php +++ b/src/SchemaValidator.php @@ -149,7 +149,7 @@ public function buildSchemas(): Schemas } // get all the xsi:schemaLocation attributes in the document - /** @var DOMNodeList $schemasList */ + /** @var iterable $schemasList */ $schemasList = $xpath->query("//@$xsi:schemaLocation") ?: new DOMNodeList(); // process every schemaLocation and import them into schemas From 5ddccdb48c5fdcab22cb6c76ac64bdf23e989527 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Tue, 8 Mar 2022 12:43:12 -0600 Subject: [PATCH 3/6] DOMAttr::nodeValue can be null, skip if this is the case --- src/SchemaValidator.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/SchemaValidator.php b/src/SchemaValidator.php index 7690a27..f98eda9 100644 --- a/src/SchemaValidator.php +++ b/src/SchemaValidator.php @@ -153,9 +153,11 @@ public function buildSchemas(): Schemas $schemasList = $xpath->query("//@$xsi:schemaLocation") ?: new DOMNodeList(); // process every schemaLocation and import them into schemas - foreach ($schemasList as $node) { - /** @psalm-suppress PossiblyNullArgument */ - $schemas->import($this->buildSchemasFromSchemaLocationValue($node->nodeValue)); + foreach ($schemasList as $schemaAttribute) { + $schemaValue = $schemaAttribute->nodeValue; + if (null !== $schemaValue) { + $schemas->import($this->buildSchemasFromSchemaLocationValue($schemaValue)); + } } return $schemas; From a7565d08e9dabe8448a61887c7238615705c4b8b Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Tue, 8 Mar 2022 12:44:04 -0600 Subject: [PATCH 4/6] Avoid deprecation error by adding return type to getIterator --- src/Schemas.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Schemas.php b/src/Schemas.php index d693245..a39adb5 100644 --- a/src/Schemas.php +++ b/src/Schemas.php @@ -139,7 +139,7 @@ public function count(): int } /** @return Traversable */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->schemas); } From 215de185bc9db6dbe2bf309336d923acad661fb1 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Tue, 8 Mar 2022 12:44:55 -0600 Subject: [PATCH 5/6] Document changes to Version 3.0.2 --- docs/CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 09d9b00..9380941 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,20 @@ classes. The library will not export any of these objects outside its own scope. ## Unreleased changes +There are no unreleased changes. + +## Version 3.0.2 2022-03-08 + +Change return type on `Schemas::getIterator()` to include `Traversable`. This avoid compatibility issues with PHP 8.1. + +Check `DOMAttr::nodeValue` can be `null`. Remove Psalm ignore. + +Fix build, PHPStan ^1.4.7 does not recognize `DOMNodeList` element types. Change type to `iterable`. + +Update development tools to recent versions. + +This release includes Previous unreleased changes: + - 2022-02-09: Fix broken CI. Remove unused code on test. From 7edddf0fc4871c4572fed894a2adfa601877e1cc Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Tue, 8 Mar 2022 12:48:17 -0600 Subject: [PATCH 6/6] Fix typos --- README.md | 2 +- docs/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a22968..3de8e41 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ try { ## Exceptions This library creates its own specific exceptions and all of them implements `XmlSchemaValidatorException`. -Check the [exceptions documentation](docs/Exceptions.md) for more information. +Check the [exceptions' documentation](docs/Exceptions.md) for more information. When this library uses LibXML functions, it captures the errors and throw its own exception. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9380941..e834a69 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,7 +11,7 @@ There are no unreleased changes. ## Version 3.0.2 2022-03-08 -Change return type on `Schemas::getIterator()` to include `Traversable`. This avoid compatibility issues with PHP 8.1. +Change return type on `Schemas::getIterator()` to include `Traversable`. This avoids compatibility issues with PHP 8.1. Check `DOMAttr::nodeValue` can be `null`. Remove Psalm ignore.