Skip to content

Commit 1a330df

Browse files
committed
Update php-csfixer rules to address problem in 2.7 & new multiline rule (#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
1 parent 36ed4d9 commit 1a330df

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.php_cs.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $config
1111
'@PSR2' => true,
1212
'@Symfony' => true,
1313
// additionally
14+
'align_multiline_comment' => array('comment_type' => 'phpdocs_like'),
1415
'array_syntax' => array('syntax' => 'long'),
1516
'binary_operator_spaces' => false,
1617
'concat_space' => array('spacing' => 'one'),
@@ -24,6 +25,7 @@ $config
2425
'pre_increment' => false,
2526
'trailing_comma_in_multiline_array' => false,
2627
'simplified_null_return' => false,
28+
'yoda_style' => null,
2729
))
2830
->setFinder($finder)
2931
;

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ matrix:
1010
fast_finish: true
1111
include:
1212
- php: 5.3
13+
dist: precise
1314
- php: 5.4
1415
- php: 5.5
1516
- php: 5.6

src/JsonSchema/Constraints/CollectionConstraint.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu
8585

8686
$validator->check($v, $schema->items, $k_path, $i);
8787
}
88-
unset($v); // remove dangling reference to prevent any future bugs
89-
// caused by accidentally using $v elsewhere
88+
unset($v); /* remove dangling reference to prevent any future bugs
89+
* caused by accidentally using $v elsewhere */
9090
$this->addErrors($typeValidator->getErrors());
9191
$this->addErrors($validator->getErrors());
9292
} else {
@@ -109,8 +109,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu
109109
$this->errors = $initErrors;
110110
}
111111
}
112-
unset($v); // remove dangling reference to prevent any future bugs
113-
// caused by accidentally using $v elsewhere
112+
unset($v); /* remove dangling reference to prevent any future bugs
113+
* caused by accidentally using $v elsewhere */
114114
}
115115
} else {
116116
// Defined item type definitions
@@ -132,8 +132,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu
132132
}
133133
}
134134
}
135-
unset($v); // remove dangling reference to prevent any future bugs
136-
// caused by accidentally using $v elsewhere
135+
unset($v); /* remove dangling reference to prevent any future bugs
136+
* caused by accidentally using $v elsewhere */
137137

138138
// Treat when we have more schema definitions than values, not for empty arrays
139139
if (count($value) > 0) {

0 commit comments

Comments
 (0)