Skip to content

Commit

Permalink
Update PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
IonBazan committed Dec 20, 2024
1 parent ee8037c commit b748e58
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
parameters:
level: 6
level: 7
paths:
- src
excludePaths:
- src/Command/BaseNotTypedCommand.php
checkGenericClassInNonGenericObjectType: true
checkMissingIterableValueType: true
bootstrapFiles:
- src/Command/DiffCommand.php # contains class alias
1 change: 1 addition & 0 deletions src/Formatter/AbstractFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private function terminalLink($url, $title)
return $title;
}

// @phpstan-ignore function.alreadyNarrowedType
return method_exists('Symfony\Component\Console\Formatter\OutputFormatterStyle', 'setHref') ? sprintf('<href=%s>%s</>', $url, $title) : $title;
}
}
2 changes: 1 addition & 1 deletion src/Formatter/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function renderSingle(DiffEntries $entries, $title, $withUrls)
*/
private function format(array $data)
{
$this->output->writeln(json_encode($data, 128)); // JSON_PRETTY_PRINT
$this->output->writeln((string) json_encode($data, 128)); // JSON_PRETTY_PRINT

Check warning on line 39 in src/Formatter/JsonFormatter.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 on ubuntu-latest Composer v2 (highest)

Escaped Mutant for Mutator "CastString": @@ @@ */ private function format(array $data) { - $this->output->writeln((string) json_encode($data, 128)); + $this->output->writeln(json_encode($data, 128)); // JSON_PRETTY_PRINT } /**
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PackageDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private function getFileContents($path)
}

if (filter_var($path, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED) || file_exists($path)) {
return file_get_contents($path);
return (string) file_get_contents($path);

Check warning on line 124 in src/PackageDiff.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 on ubuntu-latest Composer v2 (highest)

Escaped Mutant for Mutator "CastString": @@ @@ $path = self::LOCKFILE; } if (filter_var($path, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED) || file_exists($path)) { - return (string) file_get_contents($path); + return file_get_contents($path); } if (false === strpos($originalPath, ':')) { $path .= ':' . self::LOCKFILE;
}

if (false === strpos($originalPath, ':')) {
Expand Down

0 comments on commit b748e58

Please sign in to comment.