diff --git a/CHANGELOG.md b/CHANGELOG.md index 17ad8c8..77d1fb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Notice: This library follows [SEMVER 2.0.0](https://semver.org/spec/v2.0.0.html) convention. +## Version 2.1.2 2020-04-05 + +- Internal change to split namespace and xsd location using `preg_split`. +- Introduce deprecation notice on version `2.x`. +- Update travis badges and link. + ## Version 2.1.1 2020-01-08 - Improve testing, 100% code coverage, each test class uses cover related class. diff --git a/README.md b/README.md index 9d61588..cdc411c 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,12 @@ issues: Validate an XML file and store locally a copy of the XSD files. Version 2.x breaks this problem and give this library only one propose: Validate an XML file against its multiple XSD files, it does not matter where are located. -Also, version 2.x uses PHP 7 with scalar type declarations, so it no longer compatible with PHP 5.6. +## Version 2.x is deprecated + +Version 2.x was compatible with PHP 7 and was deprecated on 2020-04-05. + +A branch `2.x` has been created, it might be installable using `composer require eclipxe/xmlschemavalidator:2.x-dev`, +but it will not be active maintained and you should change your dependency as soon as possible. ## Contributing @@ -90,7 +95,7 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor [source]: https://github.com/eclipxe13/XmlSchemaValidator [release]: https://github.com/eclipxe13/XmlSchemaValidator/releases [license]: https://github.com/eclipxe13/XmlSchemaValidator/blob/master/LICENSE -[build]: https://travis-ci.org/eclipxe13/XmlSchemaValidator?branch=master +[build]: https://travis-ci.com/eclipxe13/XmlSchemaValidator?branch=master [quality]: https://scrutinizer-ci.com/g/eclipxe13/XmlSchemaValidator/ [coverage]: https://scrutinizer-ci.com/g/eclipxe13/XmlSchemaValidator/code-structure/master [downloads]: https://packagist.org/packages/eclipxe/xmlschemavalidator @@ -98,7 +103,7 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor [badge-source]: https://img.shields.io/badge/source-eclipxe13/XmlSchemaValidator-blue.svg?style=flat-square [badge-release]: https://img.shields.io/github/release/eclipxe13/XmlSchemaValidator.svg?style=flat-square [badge-license]: https://img.shields.io/github/license/eclipxe13/XmlSchemaValidator.svg?style=flat-square -[badge-build]: https://img.shields.io/travis/eclipxe13/XmlSchemaValidator/master.svg?style=flat-square +[badge-build]: https://img.shields.io/travis/com/eclipxe13/XmlSchemaValidator/master.svg?style=flat-square [badge-quality]: https://img.shields.io/scrutinizer/g/eclipxe13/XmlSchemaValidator/master.svg?style=flat-square [badge-coverage]: https://img.shields.io/scrutinizer/coverage/g/eclipxe13/XmlSchemaValidator/master.svg?style=flat-square [badge-downloads]: https://img.shields.io/packagist/dt/eclipxe/xmlschemavalidator.svg?style=flat-square diff --git a/src/XmlSchemaValidator/SchemaValidator.php b/src/XmlSchemaValidator/SchemaValidator.php index 8254ab3..87897a0 100644 --- a/src/XmlSchemaValidator/SchemaValidator.php +++ b/src/XmlSchemaValidator/SchemaValidator.php @@ -116,14 +116,8 @@ public function buildSchemas(): Schemas foreach ($schemasList as $node) { // get the node content $content = $node->nodeValue; - // get parts without inner spaces - // $parts = array_values(array_filter(explode(' ', $content))); - - // 2020-04-03 DDW - use preg_split to handle all types of whitespace? not necessary! $xpath-query appears to remove - // vertical whitespace and convert tabs to spaces. But preg_split is a little more elegant..... - $parts = preg_split('/[\s]+/', $content); - + $parts = preg_split('/\s+/', $content) ?: []; $partsCount = count($parts); // check that the list count is an even number if (0 !== $partsCount % 2) { diff --git a/tests/XmlSchemaValidatorTests/SchemaValidatorTest.php b/tests/XmlSchemaValidatorTests/SchemaValidatorTest.php index 00e74fd..3fc02f9 100644 --- a/tests/XmlSchemaValidatorTests/SchemaValidatorTest.php +++ b/tests/XmlSchemaValidatorTests/SchemaValidatorTest.php @@ -57,7 +57,8 @@ public function testValidateWithNoSchema() ); } - public function testValidateWithVariousWhitespaceInSchemaDeclaration() { + public function testValidateWithVariousWhitespaceInSchemaDeclaration() + { $validator = $this->utilCreateValidator('books-valid-with-extra-whitespace-in-schema-declaration.xml'); $this->assertTrue($validator->validate()); }