diff options
author | Tim Starling <tstarling@wikimedia.org> | 2023-03-24 12:14:02 +1100 |
---|---|---|
committer | Krinkle <krinkle@fastmail.com> | 2023-03-25 00:19:58 +0000 |
commit | 580ec48e5b322e505297f3eed0ebccbd269c2166 (patch) | |
tree | 53d9c47fe2a73c643c5d0d3c25ac3ee23f6eb3fa /includes/diff/WordAccumulator.php | |
parent | d36ea70309c7cd264d3e3244738cce55d0a82e5b (diff) | |
download | mediawikicore-580ec48e5b322e505297f3eed0ebccbd269c2166.tar.gz mediawikicore-580ec48e5b322e505297f3eed0ebccbd269c2166.zip |
Fix more PHPStorm inspections (#2)
* Illegal string offset and invalid argument supplied to foreach, due to incorrect type information
* Array internal pointer reset is unnecessary
* $hookData unused since MW 1.35 due to incomplete revert
* array_push() with single element
* Unnecessary sprintf()
* for loop can be replaced with str_repeat()
* preg_replace() can be replaced with rtrim()
* array_values() call is redundant
* Unnecessary cast to string
* Unnecessary ternary. Often the result relies on short-circuit evaluation, but I find it more readable nonetheless.
Change-Id: I4c45bdb59b51b243fa96286bec8b58deb097d707
Diffstat (limited to 'includes/diff/WordAccumulator.php')
-rw-r--r-- | includes/diff/WordAccumulator.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/includes/diff/WordAccumulator.php b/includes/diff/WordAccumulator.php index fe5907fe007d..bda093c83d0d 100644 --- a/includes/diff/WordAccumulator.php +++ b/includes/diff/WordAccumulator.php @@ -70,10 +70,10 @@ class WordAccumulator { private function flushLine( $new_tag ) { $this->flushGroup( $new_tag ); if ( $this->line != '' ) { - array_push( $this->lines, $this->line ); + $this->lines[] = $this->line; } else { # make empty lines visible by inserting an NBSP - array_push( $this->lines, "\u{00A0}" ); + $this->lines[] = "\u{00A0}"; } $this->line = ''; } |