Skip to content

Commit

Permalink
Code cleanup (#956)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored Jan 27, 2024
1 parent e17ffa5 commit 7b8f147
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"mi-schi/phpmd-extension": "^4.3",
"phpmd/phpmd": "^2.15",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.56",
"phpstan/phpstan": "^1.10.57",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.2",
"squizlabs/php_codesniffer": "^3.8.1",
Expand Down
18 changes: 9 additions & 9 deletions .dev-tools/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions tests/Fixer/AbstractFixerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@ final public function testCodeSampleEndsWithNewLine(): void
*/
final public function testCodeSampleIsChangedDuringFixing(): void
{
$codeSample = self::getFixer()->getDefinition()->getCodeSamples()[0];
if (self::getFixer() instanceof ConfigurableFixerInterface) {
self::getFixer()->configure($codeSample->getConfiguration() ?? []);
$fixer = self::getFixer();

$codeSample = $fixer->getDefinition()->getCodeSamples()[0];
if ($fixer instanceof ConfigurableFixerInterface) {
$fixer->configure($codeSample->getConfiguration() ?? []);
}

Tokens::clearCache();
$tokens = Tokens::fromCode($codeSample->getCode());

self::getFixer()->fix($this->createSplFileInfoDouble(), $tokens);
$fixer->fix($this->createSplFileInfoDouble(), $tokens);

self::assertNotSame($codeSample->getCode(), $tokens->generateCode());
}
Expand Down
1 change: 0 additions & 1 deletion tests/Fixer/PhpdocArrayStyleFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public static function provideFixCases(): iterable
yield [
'<?php /** @var array<bool>|array<float>|array<int>|array<string> */',
'<?php /** @var array<bool>|float[]|array<int>|string[] */',
['style' => 'generic'],
];

yield [
Expand Down

0 comments on commit 7b8f147

Please sign in to comment.