Skip to content

Commit a73e2f3

Browse files
Fix CS/WS issues
1 parent 94621c8 commit a73e2f3

17 files changed

+67
-68
lines changed

src/Exception/ConfigurationException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public function __construct(
2828
'Option "%s" must be %s, got "%s".',
2929
$option,
3030
$expected,
31-
is_object($value) ? $value::class : (null === $value ? '<null>' : gettype($value) . '#' . $value)
31+
is_object($value) ? $value::class : (null === $value ? '<null>' : gettype($value) . '#' . $value),
3232
),
3333
$code,
34-
$previous
34+
$previous,
3535
);
3636
}
3737
}

src/MemoryEfficientLongestCommonSubsequenceCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function calculate(array $from, array $to): array
6161

6262
return array_merge(
6363
$this->calculate($fromStart, $toStart),
64-
$this->calculate($fromEnd, $toEnd)
64+
$this->calculate($fromEnd, $toEnd),
6565
);
6666
}
6767

src/Output/StrictUnifiedDiffOutputBuilder.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct(array $options = [])
8282
$options['fromFile'],
8383
null === $options['fromFileDate'] ? '' : "\t" . $options['fromFileDate'],
8484
$options['toFile'],
85-
null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate']
85+
null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate'],
8686
);
8787

8888
$this->collapseRanges = $options['collapseRanges'];
@@ -201,11 +201,11 @@ private function writeDiffHunks($output, array $diff): void
201201
$fromRange - $cutOff + $contextStartOffset + $this->contextLines,
202202
$toStart - $contextStartOffset,
203203
$toRange - $cutOff + $contextStartOffset + $this->contextLines,
204-
$output
204+
$output,
205205
);
206206

207207
$fromStart += $fromRange;
208-
$toStart += $toRange;
208+
$toStart += $toRange;
209209

210210
$hunkCapture = false;
211211
$sameCount = $toRange = $fromRange = 0;
@@ -251,7 +251,7 @@ private function writeDiffHunks($output, array $diff): void
251251
$contextEndOffset = min($sameCount, $this->contextLines);
252252

253253
$fromRange -= $sameCount;
254-
$toRange -= $sameCount;
254+
$toRange -= $sameCount;
255255

256256
$this->writeHunk(
257257
$diff,
@@ -261,7 +261,7 @@ private function writeDiffHunks($output, array $diff): void
261261
$fromRange + $contextStartOffset + $contextEndOffset,
262262
$toStart - $contextStartOffset,
263263
$toRange + $contextStartOffset + $contextEndOffset,
264-
$output
264+
$output,
265265
);
266266
}
267267

@@ -302,11 +302,11 @@ private function writeHunk(
302302
$this->changed = true;
303303
fwrite($output, $diff[$i][0]);
304304
}
305-
//} elseif ($diff[$i][1] === Differ::DIFF_LINE_END_WARNING) { // custom comment inserted by PHPUnit/diff package
305+
// } elseif ($diff[$i][1] === Differ::DIFF_LINE_END_WARNING) { // custom comment inserted by PHPUnit/diff package
306306
// skip
307-
//} else {
307+
// } else {
308308
// unknown/invalid
309-
//}
309+
// }
310310
}
311311
}
312312

src/Output/UnifiedDiffOutputBuilder.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use function min;
1919
use function str_ends_with;
2020
use function stream_get_contents;
21-
use function strlen;
2221
use function substr;
2322
use SebastianBergmann\Diff\Differ;
2423

@@ -67,7 +66,7 @@ public function getDiff(array $diff): string
6766
// This might happen when both the `from` and `to` do not have a trailing linebreak
6867
$last = substr($diff, -1);
6968

70-
return 0 !== strlen($diff) && "\n" !== $last && "\r" !== $last
69+
return '' !== $diff && "\n" !== $last && "\r" !== $last
7170
? $diff . "\n"
7271
: $diff;
7372
}
@@ -151,11 +150,11 @@ private function writeDiffHunks($output, array $diff): void
151150
$fromRange - $cutOff + $contextStartOffset + $this->contextLines,
152151
$toStart - $contextStartOffset,
153152
$toRange - $cutOff + $contextStartOffset + $this->contextLines,
154-
$output
153+
$output,
155154
);
156155

157156
$fromStart += $fromRange;
158-
$toStart += $toRange;
157+
$toStart += $toRange;
159158

160159
$hunkCapture = false;
161160
$sameCount = $toRange = $fromRange = 0;
@@ -199,7 +198,7 @@ private function writeDiffHunks($output, array $diff): void
199198
$contextEndOffset = min($sameCount, $this->contextLines);
200199

201200
$fromRange -= $sameCount;
202-
$toRange -= $sameCount;
201+
$toRange -= $sameCount;
203202

204203
$this->writeHunk(
205204
$diff,
@@ -209,7 +208,7 @@ private function writeDiffHunks($output, array $diff): void
209208
$fromRange + $contextStartOffset + $contextEndOffset,
210209
$toStart - $contextStartOffset,
211210
$toRange + $contextStartOffset + $contextEndOffset,
212-
$output
211+
$output,
213212
);
214213
}
215214

src/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function parseFileDiff(Diff $diff, array $lines): void
8383
(int) $match['start'],
8484
isset($match['startrange']) ? max(0, (int) $match['startrange']) : 1,
8585
(int) $match['end'],
86-
isset($match['endrange']) ? max(0, (int) $match['endrange']) : 1
86+
isset($match['endrange']) ? max(0, (int) $match['endrange']) : 1,
8787
);
8888

8989
$chunks[] = $chunk;

tests/ChunkTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private function chunk(): Chunk
7979
4,
8080
[
8181
$this->line(),
82-
]
82+
],
8383
);
8484
}
8585

tests/DifferTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public function testArrayDiffs(): void
359359
-one
360360
+two
361361
',
362-
$this->differ->diff(['one'], ['two'])
362+
$this->differ->diff(['one'], ['two']),
363363
);
364364
}
365365

tests/Exception/ConfigurationExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testConstruct(): void
3535
'integer',
3636
new SplFileInfo(__FILE__),
3737
789,
38-
new BadMethodCallException(__METHOD__)
38+
new BadMethodCallException(__METHOD__),
3939
);
4040

4141
$this->assertSame('Option "test" must be integer, got "SplFileInfo".', $e->getMessage());

tests/Output/AbstractChunkOutputBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function getChunks(array $diff, $lineThreshold)
140140

141141
$this->assertSame(
142142
$expected,
143-
$output->getChunks((new Differ(new UnifiedDiffOutputBuilder))->diffToArray($from, $to), $lineThreshold)
143+
$output->getChunks((new Differ(new UnifiedDiffOutputBuilder))->diffToArray($from, $to), $lineThreshold),
144144
);
145145
}
146146
}

tests/Output/Integration/StrictUnifiedDiffOutputBuilderIntegrationTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function testIntegrationDiffOutputBuilderVersusDiffCommand(string $diff,
171171
[
172172
'from' => $this->fileFrom,
173173
'to' => $this->fileTo,
174-
]
174+
],
175175
);
176176

177177
$this->assertSame(1, $p->getExitCode()); // note: Process assumes exit code 0 for `isSuccessful`, however `diff` uses the exit code `1` for success with diff
@@ -207,7 +207,7 @@ private function doIntegrationTestGitApply(string $diff, string $from, string $t
207207
[
208208
'dir' => $this->dir,
209209
'patch' => $this->filePatch,
210-
]
210+
],
211211
);
212212

213213
$this->assertProcessSuccessful($p);
@@ -229,15 +229,15 @@ private function doIntegrationTestPatch(string $diff, string $from, string $to):
229229
[
230230
'from' => $this->fileFrom,
231231
'patch' => $this->filePatch,
232-
]
232+
],
233233
);
234234

235235
$this->assertProcessSuccessful($p);
236236

237237
$this->assertStringEqualsFile(
238238
$this->fileFrom,
239239
$to,
240-
sprintf('Patch command "%s".', $p->getCommandLine())
240+
sprintf('Patch command "%s".', $p->getCommandLine()),
241241
);
242242
}
243243

@@ -250,8 +250,8 @@ private function assertProcessSuccessful(Process $p): void
250250
$p->getCommandLine(),
251251
$p->getOutput(),
252252
$p->getErrorOutput(),
253-
$p->getExitCode()
254-
)
253+
$p->getExitCode(),
254+
),
255255
);
256256
}
257257

0 commit comments

Comments
 (0)