Skip to content

Commit

Permalink
Fix cs (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Oct 10, 2024
1 parent f6ffc95 commit 7e45340
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Cache/Manager/FileCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class FileCacheManager implements CacheManagerInterface

public function __construct(
private CacheFileHandlerInterface $handler,
private Signature $signature
private Signature $signature,
) {
$this->cacheDirectory = \dirname($handler->getFile());

Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class Signature
public function __construct(
private string $phpVersion,
private string $fixerVersion,
private array $rules
private array $rules,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Report/Reporter/CheckstyleReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void {
$text = '<?xml version="1.0" encoding="UTF-8"?>'.\PHP_EOL;

Expand Down
2 changes: 1 addition & 1 deletion src/Report/Reporter/GithubReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void {
$violations = $report->getViolations($level);
foreach ($violations as $violation) {
Expand Down
2 changes: 1 addition & 1 deletion src/Report/Reporter/JUnitReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void {
$violations = $report->getViolations($level);
$count = \count($violations);
Expand Down
2 changes: 1 addition & 1 deletion src/Report/Reporter/NullReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void {
}
}
2 changes: 1 addition & 1 deletion src/Report/Reporter/ReporterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void;

public function getName(): string;
Expand Down
2 changes: 1 addition & 1 deletion src/Report/Reporter/TextReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void {
$io = new SymfonyStyle(new ArrayInput([]), $output);

Expand Down
2 changes: 1 addition & 1 deletion src/Report/ReporterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class ReporterFactory
* @param list<ReporterInterface> $customReporters
*/
public function __construct(
private array $customReporters = []
private array $customReporters = [],
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Rules/AbstractFixableRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class AbstractFixableRule extends AbstractRule implements FixableRuleIn
final protected function init(
?Report $report,
array $ignoredViolations = [],
?FixerInterface $fixer = null
?FixerInterface $fixer = null,
): void {
parent::init($report, $ignoredViolations);
$this->fixer = $fixer;
Expand All @@ -34,7 +34,7 @@ final public function fixFile(Tokens $tokens, FixerInterface $fixer): void
final protected function addFixableWarning(
string $message,
Token $token,
?string $messageId = null
?string $messageId = null,
): ?FixerInterface {
$added = $this->addWarning($message, $token, $messageId);
if (!$added) {
Expand All @@ -47,7 +47,7 @@ final protected function addFixableWarning(
final protected function addFixableError(
string $message,
Token $token,
?string $messageId = null
?string $messageId = null,
): ?FixerInterface {
$added = $this->addError($message, $token, $messageId);
if (!$added) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/RuleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private function addMessage(
string $fileName,
?int $line = null,
?int $linePosition = null,
?string $messageId = null
?string $messageId = null,
): bool {
$id = new ViolationId(
$this->getShortName(),
Expand Down
2 changes: 1 addition & 1 deletion src/Runner/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class Linter
public function __construct(
private Environment $env,
private TokenizerInterface $tokenizer,
?CacheManagerInterface $cacheManager = null
?CacheManagerInterface $cacheManager = null,
) {
$this->cacheManager = $cacheManager ?? new NullCacheManager();
}
Expand Down
6 changes: 4 additions & 2 deletions src/Test/AbstractRuleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use PHPUnit\Framework\TestCase;
use TwigCsFixer\Environment\StubbedEnvironment;
use TwigCsFixer\Exception\CannotFixFileException;
use TwigCsFixer\Exception\CannotTokenizeException;
use TwigCsFixer\Report\Violation;
use TwigCsFixer\Rules\Node\NodeRuleInterface;
use TwigCsFixer\Rules\RuleInterface;
Expand All @@ -20,8 +22,8 @@ abstract class AbstractRuleTestCase extends TestCase
* @param RuleInterface|NodeRuleInterface|array<RuleInterface|NodeRuleInterface> $rules
* @param array<string|null> $expects
*
* @throws \TwigCsFixer\Exception\CannotFixFileException
* @throws \TwigCsFixer\Exception\CannotTokenizeException
* @throws CannotFixFileException
* @throws CannotTokenizeException
*/
protected function checkRule(
RuleInterface|NodeRuleInterface|array $rules,
Expand Down
2 changes: 1 addition & 1 deletion src/Token/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct(
private int $linePosition,
private string $filename,
private string $value = '',
private ?self $relatedToken = null
private ?self $relatedToken = null,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Binary/Fixtures/.twig-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void {
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Config/ConfigResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function testResolveCacheManager(
?string $configPath,
bool $disableCache,
?string $expectedCacheFile,
?string $expectedCacheManager
?string $expectedCacheManager,
): void {
if (null !== $configPath) {
$configPath = $this->getTmpPath($configPath);
Expand Down
2 changes: 1 addition & 1 deletion tests/Report/ReporterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function display(
OutputInterface $output,
Report $report,
?string $level,
bool $debug
bool $debug,
): void {
}
};
Expand Down
2 changes: 1 addition & 1 deletion tests/Runner/LinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function testFileIsModifiedWhenFixed(): void
*/
public function testBuggyFixesAreReported(
CannotFixFileException|CannotTokenizeException $exception,
string $expectedMessage
string $expectedMessage,
): void {
$filePath = $this->getTmpPath(__DIR__.'/Fixtures/Linter/file.twig');
$filePath2 = $this->getTmpPath(__DIR__.'/Fixtures/Linter/file2.twig');
Expand Down

0 comments on commit 7e45340

Please sign in to comment.