Skip to content

Commit

Permalink
Merge pull request #11 from eclipxe13/version-3.0.2
Browse files Browse the repository at this point in the history
Version 3.0.2
  • Loading branch information
eclipxe13 authored Mar 8, 2022
2 parents e6bea0c + 7edddf0 commit 85931d6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.6.0" installed="3.6.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="php-cs-fixer" version="^3.7.0" installed="3.7.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcbf" version="^3.6.2" installed="3.6.2" location="./tools/phpcbf" copy="false"/>
<phar name="phpcs" version="^3.6.2" installed="3.6.2" location="./tools/phpcs" copy="false"/>
<phar name="phpstan" version="^1.4.6" installed="1.4.6" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="^4.20.0" installed="4.20.0" location="./tools/psalm" copy="false"/>
<phar name="phpstan" version="^1.4.8" installed="1.4.8" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="^4.22.0" installed="4.22.0" location="./tools/psalm" copy="false"/>
<phar name="infection" version="^0.23.0" installed="0.23.0" location="./tools/infection" copy="false"/>
</phive>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
14 changes: 14 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 avoids 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.
Expand Down
10 changes: 6 additions & 4 deletions src/SchemaValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@ public function buildSchemas(): Schemas
}

// get all the xsi:schemaLocation attributes in the document
/** @var DOMNodeList<DOMAttr> $schemasList */
/** @var iterable<DOMAttr> $schemasList */
$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;
Expand Down
2 changes: 1 addition & 1 deletion src/Schemas.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function count(): int
}

/** @return Traversable<string, Schema> */
public function getIterator()
public function getIterator(): Traversable
{
return new ArrayIterator($this->schemas);
}
Expand Down

0 comments on commit 85931d6

Please sign in to comment.