Skip to content

Commit 14c5665

Browse files
committed
Cleanup codes. Level 10/MAX
1 parent d8a1567 commit 14c5665

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

bin/php-sl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function outputResults(array $results): void
6060
echo str_repeat("=", 40) . "\n\n";
6161

6262
foreach ($results as $file => $issues) {
63-
echo "File: {$file}\n";
63+
echo sprintf('File: %s%s', $file, PHP_EOL);
6464
foreach ($issues as $issue) {
6565
echo sprintf(
6666
" ✗ [%s] %s (Line %d)\n",
@@ -128,11 +128,11 @@ function runCli(array $argv): int
128128
outputResults($results);
129129
exit(0);
130130
} catch (LinterException $e) {
131-
fwrite(STDERR, "SCAN ERROR [{$e->getCode()}]: {$e->getMessage()}\n");
131+
fwrite(STDERR, sprintf('SCAN ERROR [%d]: %s%s', $e->getCode(), $e->getMessage(), PHP_EOL));
132132

133133
exit(2);
134134
} catch (Exception $e) {
135-
fwrite(STDERR, "FATAL ERROR: {$e->getMessage()}\n");
135+
fwrite(STDERR, sprintf('FATAL ERROR: %s%s', $e->getMessage(), PHP_EOL));
136136
exit(3);
137137
}
138138
}

rector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
->withPhpVersion(PhpVersion::PHP_83)
2121
->withComposerBased(phpunit: true)
2222
->withPhpSets(php83: true)
23-
->withTypeCoverageLevel(1)
24-
->withDeadCodeLevel(1)
25-
->withCodeQualityLevel(1)
26-
->withCodingStyleLevel(1);
23+
->withTypeCoverageLevel(10)
24+
->withDeadCodeLevel(10)
25+
->withCodeQualityLevel(10)
26+
->withCodingStyleLevel(10);

src/Exceptions/LinterException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ public static function invalidRule(string $rule): self
104104
*/
105105
public function __toString(): string
106106
{
107-
$str = self::class . ": [{$this->code}]: {$this->message}\n";
107+
$str = self::class . sprintf(': [%s]: %s%s', $this->code, $this->message, PHP_EOL);
108108

109109
if ($this->context) {
110-
$str .= "Context: {$this->context}\n";
110+
$str .= sprintf('Context: %s%s', $this->context, PHP_EOL);
111111
}
112112

113113
$str .= "Stack trace:\n" . $this->getTraceAsString();

src/Linter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct()
6464
public function scan(string $path, array $exclude = []): array
6565
{
6666
if (!file_exists($path)) {
67-
throw new LinterException("Path does not exist: {$path}");
67+
throw new LinterException('Path does not exist: ' . $path);
6868
}
6969

7070
$results = [];

0 commit comments

Comments
 (0)