Skip to content

Commit b5c7b7f

Browse files
committed
Fix warnings and php 7.4 deprications
1 parent a087ecf commit b5c7b7f

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/ArgParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getArg(string $name): string
2828
protected function numericArg(int $position): string
2929
{
3030
foreach ($this->args as $arg) {
31-
if ($arg{0} != '-' && $position-- == 0) {
31+
if ($arg[0] != '-' && $position-- == 0) {
3232
return $arg;
3333
}
3434
}
@@ -42,7 +42,7 @@ protected function letterArg($name): string
4242
foreach ($this->args as $arg) {
4343
list($value, $arg) = $this->splitArg($arg);
4444

45-
if ($arg{0} == '-' && $name == $arg) {
45+
if ($arg[0] == '-' && $name == $arg) {
4646
return $value;
4747
}
4848
}

src/Loaders/PhpCs.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ protected function addInvalidLine(string $file, stdClass $message)
121121

122122
$line = $message->line;
123123

124-
if ($error = $this->messageStartsWith($message->source, $this->lookupErrorPrefix)) {
124+
$error = $this->messageStartsWith($message->source, $this->lookupErrorPrefix);
125+
126+
if ($error) {
125127
$this->handleLookupError($file, $message, $error);
126128
return;
127129
}

src/Loaders/PhpStan.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public function parseLines(): array
4141
$lineNumber = 0;
4242
while (($line = fgets($this->file)) !== false) {
4343
$filename = $this->checkForFilename($line, $filename);
44-
if ($lineNumber = $this->getLineNumber($line, $lineNumber)) {
44+
$lineNumber = $this->getLineNumber($line, $lineNumber);
45+
46+
if ($lineNumber) {
4547
$error = $this->getMessage($line);
4648
if ($this->isExtendedMessage($line)) {
4749
$this->appendError($filename, $lineNumber, $error);

src/PhpunitFilter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public function getTestsForRunning($fuzziness = 0)
2626
$runTests = [];
2727
foreach ($changes as $file => $lines) {
2828
try {
29-
if ($found = $this->matcher->match($file, $fileNames)) {
29+
$found = $this->matcher->match($file, $fileNames);
30+
if ($found) {
3031
foreach ($lines as $line) {
3132
$runTests = $this->matchFuzzyLines($fuzziness, $testData, $found, $line, $runTests);
3233
}

0 commit comments

Comments
 (0)