Skip to content

Commit 80c331d

Browse files
committed
Ruleset test: Fix bug where it doesn't catch proper number of errors/warnings on a line basis due to order of operations of incrementating after assignment.
1 parent 0df75ba commit 80c331d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/RulesetTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private function violation_type_is_error( $violation ) {
188188
* @param int $line Line number.
189189
*/
190190
private function add_error_for_line( $line ) {
191-
$this->errors[ $line ] = isset( $this->errors[ $line ] ) ? $this->errors[ $line ]++ : 1;
191+
$this->errors[ $line ] = isset( $this->errors[ $line ] ) ? ++$this->errors[ $line ] : 1;
192192
}
193193

194194
/**
@@ -197,7 +197,7 @@ private function add_error_for_line( $line ) {
197197
* @param int $line Line number.
198198
*/
199199
private function add_warning_for_line( $line ) {
200-
$this->warnings[ $line ] = isset( $this->warnings[ $line ] ) ? $this->warnings[ $line ]++ : 1;
200+
$this->warnings[ $line ] = isset( $this->warnings[ $line ] ) ? ++$this->warnings[ $line ] : 1;
201201
}
202202

203203
/**

0 commit comments

Comments
 (0)