From 52ff1a97c721745d9397240ce0b5bd9b962c5886 Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Mon, 30 Dec 2024 09:08:17 +0100 Subject: [PATCH] ci+rector rules --- .github/workflows/ci.yml | 1 + rector.php | 12 ++++++++---- src/CXml/Model/Tax.php | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f680be0..09a65d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: php-version: [ '8.2', '8.3', + '8.4' ] steps: diff --git a/rector.php b/rector.php index 5c39263..fcc570f 100644 --- a/rector.php +++ b/rector.php @@ -13,16 +13,19 @@ __DIR__ . '/src', __DIR__ . '/tests', ]) + ->withRules([ + \Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector::class, + ]) ->withSets([ JMSSetList::ANNOTATIONS_TO_ATTRIBUTES, - PHPUnitSetList::PHPUNIT_100, + PHPUnitSetList::PHPUNIT_110, PHPUnitSetList::PHPUNIT_CODE_QUALITY, PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, SetList::TYPE_DECLARATION, SetList::CODE_QUALITY, SetList::CODING_STYLE, SetList::DEAD_CODE, - SetList::PHP_82, + \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_84, SetList::PRIVATIZATION, SetList::EARLY_RETURN, SetList::INSTANCEOF, @@ -33,9 +36,10 @@ \Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector::class, //allow to use promoted properties that only purpose is to get serialized \Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector::class, - //this is stupid and makes code unreadable + //this makes code unreadable \Rector\Strict\Rector\Ternary\BooleanInTernaryOperatorRuleFixerRector::class, - \Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector::class + \Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector::class, + \Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class, ]) ->withFileExtensions(['php']) ->withCache( diff --git a/src/CXml/Model/Tax.php b/src/CXml/Model/Tax.php index f85da36..97c52b0 100644 --- a/src/CXml/Model/Tax.php +++ b/src/CXml/Model/Tax.php @@ -10,7 +10,7 @@ class Tax { #[Serializer\SerializedName('Money')] - private Money $money; + private readonly Money $money; /** * @var TaxDetail[] @@ -24,7 +24,7 @@ public function __construct( int $value, #[Serializer\SerializedName('Description')] #[Serializer\XmlElement(cdata: false)] - private MultilanguageString $description, + private readonly MultilanguageString $description, ) { $this->money = new Money($currency, $value); }