diff --git a/composer.json b/composer.json index ee3f95b..51eb3e7 100644 --- a/composer.json +++ b/composer.json @@ -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" }, diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e7c73b8..d3bafb7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -2,441 +2,17 @@ - - - - - - - - src/ tests/ tests/data/* - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Exception type missing for @throws annotation - - - Only 1 @return annotation is allowed in a function comment - - - Extra @param annotation - - - @param annotation for parameter "%s" missing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/InlineIgnoreInliner.php b/src/InlineIgnoreInliner.php index f5931ca..2856b8f 100644 --- a/src/InlineIgnoreInliner.php +++ b/src/InlineIgnoreInliner.php @@ -18,11 +18,12 @@ public function __construct(private Io $io) /** * @param array}> $errors + * * @throws FailureException */ public function inlineErrors( array $errors, - ?string $comment + ?string $comment, ): void { foreach ($errors as $filePath => $fileErrors) { diff --git a/src/Io.php b/src/Io.php index 9ac35d3..937711f 100644 --- a/src/Io.php +++ b/src/Io.php @@ -18,6 +18,7 @@ class Io /** * @param array $argv + * * @throws FailureException */ public function readCliComment(array $argv): ?string @@ -66,6 +67,7 @@ public function readInput(): string /** * @return list + * * @throws FailureException */ public function readFile(string $filePath): array @@ -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); diff --git a/tests/InlineIgnoreInlinerTest.php b/tests/InlineIgnoreInlinerTest.php index cafa9b8..b5974cb 100644 --- a/tests/InlineIgnoreInlinerTest.php +++ b/tests/InlineIgnoreInlinerTest.php @@ -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'; @@ -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); diff --git a/tests/IoTest.php b/tests/IoTest.php index 2607750..89cf396 100644 --- a/tests/IoTest.php +++ b/tests/IoTest.php @@ -19,7 +19,12 @@ class IoTest extends TestCase * @param list $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']); @@ -51,7 +56,10 @@ public static function optionsProvider(): array * @param list $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];