Skip to content

Commit

Permalink
bump rector config and code to PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Feb 2, 2024
1 parent 6c3f26c commit 9922322
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 54 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
"php": "^8.2",
"symfony/console": "^6.3",
"symfony/finder": "^6.3",
"illuminate/container": "^10.35",
"illuminate/container": "^10.43",
"webmozart/assert": "^1.11",
"nikic/php-parser": "^4.17",
"nikic/php-parser": "^4.18",
"sebastian/lines-of-code": "^2.0",
"nunomaduro/termwind": "^1.15"
},
"require-dev": {
"phpunit/phpunit": "^10.5",
"rector/rector": "^0.19",
"phpstan/phpstan": "^1.10.26",
"rector/rector": "^0.19.5",
"phpstan/phpstan": "^1.10.57",
"symplify/easy-coding-standard": "^12.1",
"tracy/tracy": "^2.10",
"tomasvotruba/class-leak": "^0.2",
"phpstan/extension-installer": "^1.3",
"symplify/vendor-patches": "^11.2",
"symplify/phpstan-rules": "^12.1"
"symplify/vendor-patches": "^11.3",
"symplify/phpstan-rules": "^12.4"
},
"autoload": {
"psr-4": {
Expand Down
43 changes: 12 additions & 31 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,19 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames();

$rectorConfig->rules([
YieldDataProviderRector::class,
]);

$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

$rectorConfig->skip([
return RectorConfig::configure()
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
->withPreparedSets(
codeQuality: true,
naming: true,
codingStyle: true,
privatization: true,
deadCode: true,
)
->withPhpSets()
->withImportNames(removeUnusedImports: true)
->withSkip([
'*/Fixture/*',
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
SetList::CODE_QUALITY,
SetList::NAMING,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,
SetList::PRIVATIZATION,
SetList::DEAD_CODE,
PHPUnitSetList::PHPUNIT_100,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);
};
8 changes: 4 additions & 4 deletions src/Analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

namespace TomasVotruba\Lines;

use Throwable;
use PhpParser\NodeTraverser;
use PhpParser\Parser;
use SebastianBergmann\LinesOfCode\Counter;
use Throwable;
use TomasVotruba\Lines\NodeVisitor\StructureNodeVisitor;
use Webmozart\Assert\Assert;

/**
* @see \TomasVotruba\Lines\Tests\AnalyserTest
*/
final class Analyser
final readonly class Analyser
{
public function __construct(
private readonly Parser $parser,
private readonly Counter $counter,
private Parser $parser,
private Counter $counter,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Console/OutputFormatter/TextOutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
use TomasVotruba\Lines\ValueObject\TableView;
use Webmozart\Assert\Assert;

final class TextOutputFormatter implements OutputFormatterInterface
final readonly class TextOutputFormatter implements OutputFormatterInterface
{
public function __construct(
private readonly ViewRenderer $viewRenderer,
private readonly SymfonyStyle $symfonyStyle,
private ViewRenderer $viewRenderer,
private SymfonyStyle $symfonyStyle,
) {
}

Expand Down
10 changes: 5 additions & 5 deletions src/ValueObject/TableRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
/**
* @api used in templates
*/
final class TableRow
final readonly class TableRow
{
public function __construct(
private readonly string $name,
private readonly string $count,
private readonly ?string $percent,
private readonly bool $isChild,
private string $name,
private string $count,
private ?string $percent,
private bool $isChild,
) {
}

Expand Down
10 changes: 5 additions & 5 deletions src/ValueObject/TableView.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
/**
* @api used in templates
*/
final class TableView
final readonly class TableView
{
/**
* @param TableRow[] $tableRows
*/
public function __construct(
private readonly string $title,
private readonly string $label,
private readonly array $tableRows,
private readonly bool $shouldIncludeRelative = false,
private string $title,
private string $label,
private array $tableRows,
private bool $shouldIncludeRelative = false,
) {
Assert::allIsInstanceOf($tableRows, TableRow::class);
}
Expand Down

0 comments on commit 9922322

Please sign in to comment.