diff --git a/.gitattributes b/.gitattributes index beeff5b8..7d46ab97 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ /docs export-ignore /tests export-ignore +.gitattributes export-ignore .gitignore export-ignore .travis.yml export-ignore phpunit.dist.xml export-ignore diff --git a/.travis.yml b/.travis.yml index be79e9fe..0573330b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: false language: php cache: @@ -23,19 +22,20 @@ matrix: - php: 7.1 - php: 7.2 - php: 7.3 - - php: 'nightly' - - php: hhvm + - php: 7.4 + - php: nightly + - php: hhvm-3.18 dist: trusty allow_failures: - - php: 'nightly' - - php: hhvm + - php: nightly before_install: - - if [[ "$WITH_COVERAGE" != "true" && "$TRAVIS_PHP_VERSION" != "hhvm" && "$TRAVIS_PHP_VERSION" != "nightly" && "$TRAVIS_PHP_VERSION" != "7.1" ]]; then phpenv config-rm xdebug.ini; fi - - if [[ "$TRAVIS_PHP_VERSION" = "hhvm" || "$TRAVIS_PHP_VERSION" = "nightly" ]]; then sed -i '/^.*friendsofphp\/php-cs-fixer.*$/d' composer.json; fi + - if [[ "$WITH_COVERAGE" != "true" && "$TRAVIS_PHP_VERSION" != "hhvm-3.18" && "$TRAVIS_PHP_VERSION" != "nightly" && "$TRAVIS_PHP_VERSION" != "7.1" ]]; then phpenv config-rm xdebug.ini; fi + - if [[ "$TRAVIS_PHP_VERSION" = "hhvm-3.18" || "$TRAVIS_PHP_VERSION" = "nightly" ]]; then sed -i '/^.*friendsofphp\/php-cs-fixer.*$/d' composer.json; fi install: - - travis_retry composer install --no-interaction --prefer-dist + - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]]; then travis_retry composer install; fi + - if [[ "$TRAVIS_PHP_VERSION" = "nightly" ]]; then travis_retry composer install --ignore-platform-reqs; fi script: - if [[ "$WITH_COVERAGE" == "true" ]]; then ./vendor/bin/phpunit --coverage-text; else composer test; fi diff --git a/bin/validate-json b/bin/validate-json index 3619bf59..d2102fe9 100755 --- a/bin/validate-json +++ b/bin/validate-json @@ -37,7 +37,7 @@ $arOptions = array(); $arArgs = array(); array_shift($argv);//script itself foreach ($argv as $arg) { - if ($arg{0} == '-') { + if ($arg[0] == '-') { $arOptions[$arg] = true; } else { $arArgs[] = $arg; @@ -95,7 +95,7 @@ function getUrlFromPath($path) //already an URL return $path; } - if ($path{0} == '/') { + if ($path[0] == '/') { //absolute path return 'file://' . $path; } @@ -200,7 +200,7 @@ if ($pathSchema === null) { exit(6); } } -if ($pathSchema{0} == '/') { +if ($pathSchema[0] == '/') { $pathSchema = 'file://' . $pathSchema; } diff --git a/composer.json b/composer.json index 884a6971..fcacd40c 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", - "json-schema/JSON-Schema-Test-Suite": "1.2.0", + "json-schema/json-schema-test-suite": "1.2.0", "phpunit/phpunit": "^4.8.35" }, "extra": { @@ -53,7 +53,7 @@ { "type": "package", "package": { - "name": "json-schema/JSON-Schema-Test-Suite", + "name": "json-schema/json-schema-test-suite", "version": "1.2.0", "source": { "type": "git", diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index e194cb0e..8effd4ba 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -59,7 +59,7 @@ public function check(&$value, $schema = null, JsonPointer $path = null, $i = nu * @param JsonPointer $path * @param string $i */ - public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null) + public function validateTypes(&$value, $schema, JsonPointer $path, $i = null) { // check array if ($this->getTypeCheck()->isArray($value)) { @@ -105,7 +105,7 @@ public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = n * @param JsonPointer $path * @param string $i */ - protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '') + protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '') { // if it extends another schema, it must pass that schema as well if (isset($schema->extends)) { @@ -151,7 +151,7 @@ protected function validateCommonProperties(&$value, $schema = null, JsonPointer ); } } else { - // If the value is both undefined and not required, skip remaining checks + // if the value is both undefined and not required, skip remaining checks // in this method which assume an actual, defined instance when validating. if ($value instanceof self) { return;