Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"phpstan/phpstan-phpunit": "^2.0.6",
"phpstan/phpstan-strict-rules": "^2.0.4",
"phpunit/phpunit": "^10.5.46",
"shipmonk/coding-standard": "^0.1.3",
"shipmonk/phpstan-rules": "^4.1.2",
"slevomat/coding-standard": "^8.18.0"
},
Expand Down
430 changes: 3 additions & 427 deletions phpcs.xml.dist

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/InlineIgnoreInliner.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ public function __construct(private Io $io)

/**
* @param array<string, array{messages: array<array{line: ?int, identifier: ?string, ignorable: ?bool}>}> $errors
*
* @throws FailureException
*/
public function inlineErrors(
array $errors,
?string $comment
?string $comment,
): void
{
foreach ($errors as $filePath => $fileErrors) {
Expand Down
7 changes: 6 additions & 1 deletion src/Io.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Io

/**
* @param array<string> $argv
*
* @throws FailureException
*/
public function readCliComment(array $argv): ?string
Expand Down Expand Up @@ -66,6 +67,7 @@ public function readInput(): string

/**
* @return list<string>
*
* @throws FailureException
*/
public function readFile(string $filePath): array
Expand All @@ -82,7 +84,10 @@ public function readFile(string $filePath): array
/**
* @throws FailureException
*/
public function writeFile(string $filePath, string $contents): void
public function writeFile(
string $filePath,
string $contents,
): void
{
if (file_put_contents($filePath, $contents) === false) {
throw new FailureException('Could not write file ' . $filePath);
Expand Down
10 changes: 8 additions & 2 deletions tests/InlineIgnoreInlinerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class InlineIgnoreInlinerTest extends TestCase
{

#[DataProvider('lineEndingProvider')]
public function testInlineErrors(string $lineEnding, ?string $comment): void
public function testInlineErrors(
string $lineEnding,
?string $comment,
): void
{
$tmpFilePath = sys_get_temp_dir() . '/' . uniqid('ignore', true) . '.php';
$tmpExpectedPath = sys_get_temp_dir() . '/' . uniqid('ignore-expected', true) . '.php';
Expand Down Expand Up @@ -52,7 +55,10 @@ public function testInlineErrors(string $lineEnding, ?string $comment): void
self::assertFileEquals($tmpExpectedPath, $tmpFilePath);
}

private function getTestFileContent(string $filename, string $lineEnding): string
private function getTestFileContent(
string $filename,
string $lineEnding,
): string
{
$content = file_get_contents(__DIR__ . '/data/' . $filename);
self::assertNotFalse($content);
Expand Down
12 changes: 10 additions & 2 deletions tests/IoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ class IoTest extends TestCase
* @param list<string> $args
*/
#[DataProvider('optionsProvider')]
public function testValidCliOptions(int $exitCode, string $input, array $args, string $expectedOutput): void
public function testValidCliOptions(
int $exitCode,
string $input,
array $args,
string $expectedOutput,
): void
{
$result = $this->runCliCommand($args, $input);
self::assertSame($exitCode, $result['exitCode']);
Expand Down Expand Up @@ -51,7 +56,10 @@ public static function optionsProvider(): array
* @param list<string> $args
* @return array{exitCode: int, stdout: string, stderr: string}
*/
private function runCliCommand(array $args, string $input): array
private function runCliCommand(
array $args,
string $input,
): array
{
$binaryPath = __DIR__ . '/../bin/inline-phpstan-ignores';
$command = ['php', $binaryPath, ...$args];
Expand Down