From b89a5d51471a4715e718d6ab04c2737fa6e653a5 Mon Sep 17 00:00:00 2001 From: Erayd Date: Sat, 30 Sep 2017 17:11:37 +1300 Subject: [PATCH 1/2] Update php-csfixer rules to address problem in 2.7 & new multiline rule * yoda_style in 2.7 is dangerous and may result in logic errors. In some cases, it also results in invalid syntax. * multiline comments prefixed with // now seem to be misaligned, and this cannot be disabled, so have changed the relevant comment. --- .php_cs.dist | 2 ++ src/JsonSchema/Constraints/CollectionConstraint.php | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 9b7f040e..6b7d9b92 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -11,6 +11,7 @@ $config '@PSR2' => true, '@Symfony' => true, // additionally + 'align_multiline_comment' => array('comment_type' => 'phpdocs_like'), 'array_syntax' => array('syntax' => 'long'), 'binary_operator_spaces' => false, 'concat_space' => array('spacing' => 'one'), @@ -24,6 +25,7 @@ $config 'pre_increment' => false, 'trailing_comma_in_multiline_array' => false, 'simplified_null_return' => false, + 'yoda_style' => null, )) ->setFinder($finder) ; diff --git a/src/JsonSchema/Constraints/CollectionConstraint.php b/src/JsonSchema/Constraints/CollectionConstraint.php index a4227866..18f0efd9 100644 --- a/src/JsonSchema/Constraints/CollectionConstraint.php +++ b/src/JsonSchema/Constraints/CollectionConstraint.php @@ -86,8 +86,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu $validator->check($v, $schema->items, $k_path, $i); } - unset($v); // remove dangling reference to prevent any future bugs - // caused by accidentally using $v elsewhere + unset($v); /* remove dangling reference to prevent any future bugs + * caused by accidentally using $v elsewhere */ $this->addErrors($typeValidator->getErrors()); $this->addErrors($validator->getErrors()); } else { @@ -110,8 +110,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu $this->errors = $initErrors; } } - unset($v); // remove dangling reference to prevent any future bugs - // caused by accidentally using $v elsewhere + unset($v); /* remove dangling reference to prevent any future bugs + * caused by accidentally using $v elsewhere */ } } else { // Defined item type definitions @@ -140,8 +140,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu } } } - unset($v); // remove dangling reference to prevent any future bugs - // caused by accidentally using $v elsewhere + unset($v); /* remove dangling reference to prevent any future bugs + * caused by accidentally using $v elsewhere */ // Treat when we have more schema definitions than values, not for empty arrays if (count($value) > 0) { From d52247c7df0e4d826069d8d7c4261ab5f6a0f875 Mon Sep 17 00:00:00 2001 From: Erayd Date: Sat, 30 Sep 2017 17:30:05 +1300 Subject: [PATCH 2/2] PHP-5.3 is not available on trusty, so explicitly specify precise for 5.3 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 069d8bec..3462c9f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ matrix: fast_finish: true include: - php: 5.3 + dist: precise - php: 5.4 - php: 5.5 - php: 5.6