Skip to content

Commit 90d340b

Browse files
eraydbighappyface
authored andcommitted
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 3948abb commit 90d340b

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
@@ -86,8 +86,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu
8686

8787
$validator->check($v, $schema->items, $k_path, $i);
8888
}
89-
unset($v); // remove dangling reference to prevent any future bugs
90-
// caused by accidentally using $v elsewhere
89+
unset($v); /* remove dangling reference to prevent any future bugs
90+
* caused by accidentally using $v elsewhere */
9191
$this->addErrors($typeValidator->getErrors());
9292
$this->addErrors($validator->getErrors());
9393
} else {
@@ -110,8 +110,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu
110110
$this->errors = $initErrors;
111111
}
112112
}
113-
unset($v); // remove dangling reference to prevent any future bugs
114-
// caused by accidentally using $v elsewhere
113+
unset($v); /* remove dangling reference to prevent any future bugs
114+
* caused by accidentally using $v elsewhere */
115115
}
116116
} else {
117117
// Defined item type definitions
@@ -140,8 +140,8 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu
140140
}
141141
}
142142
}
143-
unset($v); // remove dangling reference to prevent any future bugs
144-
// caused by accidentally using $v elsewhere
143+
unset($v); /* remove dangling reference to prevent any future bugs
144+
* caused by accidentally using $v elsewhere */
145145

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

0 commit comments

Comments
 (0)