Skip to content

Commit

Permalink
Update php-csfixer rules to address problem in 2.7 & new multiline ru…
Browse files Browse the repository at this point in the history
…le (#449)

* 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-5.3 is not available on trusty, so explicitly specify precise for 5.3
  • Loading branch information
erayd committed Oct 3, 2017
1 parent 36ed4d9 commit 1a330df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .php_cs.dist
Expand Up @@ -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'),
Expand All @@ -24,6 +25,7 @@ $config
'pre_increment' => false,
'trailing_comma_in_multiline_array' => false,
'simplified_null_return' => false,
'yoda_style' => null,
))
->setFinder($finder)
;
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -10,6 +10,7 @@ matrix:
fast_finish: true
include:
- php: 5.3
dist: precise
- php: 5.4
- php: 5.5
- php: 5.6
Expand Down
12 changes: 6 additions & 6 deletions src/JsonSchema/Constraints/CollectionConstraint.php
Expand Up @@ -85,8 +85,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 {
Expand All @@ -109,8 +109,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
Expand All @@ -132,8 +132,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) {
Expand Down

0 comments on commit 1a330df

Please sign in to comment.