Skip to content

Commit

Permalink
chore: Refactor code formatting in Clean.php, PintInputInterface.php,…
Browse files Browse the repository at this point in the history
… CustomOrderedClassElementsFixer.php, PintConfigurationJsonRepository.php, Tool.php, and UserScript.php
  • Loading branch information
mr-chetan committed Jul 17, 2024
1 parent 23a2faa commit f5058f9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
3 changes: 1 addition & 2 deletions app/Actions/Clean.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class Clean
public function __construct(
protected string $mode,
protected array $tools,
) {
}
) {}

public function execute(): int
{
Expand Down
4 changes: 1 addition & 3 deletions app/Contracts/PintInputInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Symfony\Component\Console\Input\InputInterface;

interface PintInputInterface extends InputInterface
{
}
interface PintInputInterface extends InputInterface {}
13 changes: 9 additions & 4 deletions app/Fixer/ClassNotation/CustomOrderedClassElementsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ static function (array $values) use ($builtIns): bool {
'method_private',
])
->getOption(),
(new FixerOptionBuilder('sort_algorithm', 'How multiple occurrences of same type statements should be sorted.'))
(new FixerOptionBuilder(
'sort_algorithm',
'How multiple occurrences of same type statements should be sorted.'
))
->setAllowedValues(self::SUPPORTED_SORT_ALGORITHMS)
->setDefault(self::SORT_NONE)
->getOption(),
Expand Down Expand Up @@ -540,7 +543,7 @@ private function findElementEnd(Tokens $tokens, int $index): int
$index = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $index);
}

for (++$index; $tokens[$index]->isWhitespace(" \t") || $tokens[$index]->isComment(); $index++);
for (++$index; $tokens[$index]->isWhitespace(" \t") || $tokens[$index]->isComment(); $index++); // @codingStandardsIgnoreLine

$index--;

Expand Down Expand Up @@ -569,7 +572,9 @@ private function sortElements(array $elements): array
$getPositionType = function (array $element) use ($phpunitPositions): int {
$type = $element['type'];

if (in_array($type, ['method', 'magic', 'phpunit'], true) && isset($this->typePosition["method:{$element['name']}"])) {
if (in_array($type, ['method', 'magic', 'phpunit'], true) &&
isset($this->typePosition["method:{$element['name']}"])
) {
return $this->typePosition["method:{$element['name']}"];
}

Expand Down Expand Up @@ -617,7 +622,7 @@ private function sortElements(array $elements): array
* @param array{element: _ClassElement, position: int} $b
* @return -1|0|1
*/
fn (array $a, array $b): int => ($a['position'] === $b['position']) ? $this->sortGroupElements($a['element'], $b['element']) : $a['position'] <=> $b['position'],
fn (array $a, array $b): int => ($a['position'] === $b['position']) ? $this->sortGroupElements($a['element'], $b['element']) : $a['position'] <=> $b['position'], // @codingStandardsIgnoreLine
);
}

Expand Down
3 changes: 1 addition & 2 deletions app/Repositories/PintConfigurationJsonRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public function __construct(
protected $path,
protected $preset,
protected array $exclude
) {
}
) {}

/**
* @return array<string, array<int, string>|string>
Expand Down
3 changes: 1 addition & 2 deletions app/Support/Tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ abstract class Tool
{
public function __construct(
protected ReviveConfig $reviveConfig,
) {
}
) {}

abstract public function lint(): int;

Expand Down
3 changes: 1 addition & 2 deletions app/Support/UserScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public function __construct(
protected string $name,
protected array $command,
protected ReviveConfig $reviveConfig,
) {
}
) {}

public function lint(): int
{
Expand Down

0 comments on commit f5058f9

Please sign in to comment.