diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 96e46e57..e933cc31 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -15,7 +15,7 @@ $config->setRules( PedroTroller\CS\Fixer\RuleSetFactory::create() ->phpCsFixer(true) - ->php(8.0, true) + ->php(8.1, true) ->pedrotroller(true) ->enable('align_multiline_comment') ->enable('array_indentation') diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 7766f44d..cf26443c 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -4,7 +4,7 @@ build: analysis: environment: php: - version: 8.0.2 + version: 8.2.16 tests: override: - php-scrutinizer-run diff --git a/README.md b/README.md index 0a82bd85..c5987864 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Are you often tired to repeat static choices like gender or civility in your app ## Requirements -- PHP >= 8.0 +- PHP >= 8.1 - Symfony 5.4 or 6.* ## Installation diff --git a/composer.json b/composer.json index 67722a12..bbb27092 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": ">=8.0", + "php": ">=8.1", "symfony/config": "^5.4 || ^6.2@dev", "symfony/dependency-injection": "^5.4 || ^6.2@dev", "symfony/form": "^5.4 || ^6.2@dev", diff --git a/rector.php b/rector.php index 15405a8b..218ca791 100644 --- a/rector.php +++ b/rector.php @@ -3,29 +3,9 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Core\ValueObject\PhpVersion; use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig - ->paths( - [ - __DIR__.'/src', - ] - ) - ; - - $rectorConfig - ->phpVersion( - PhpVersion::PHP_80 - ) - ; - - $rectorConfig - ->sets( - [ - LevelSetList::UP_TO_PHP_80, - ] - ) - ; + $rectorConfig->paths([__DIR__.'/src']); + $rectorConfig->sets([LevelSetList::UP_TO_PHP_81]); }; diff --git a/src/Knp/DictionaryBundle/Dictionary/Factory/Extended.php b/src/Knp/DictionaryBundle/Dictionary/Factory/Extended.php index 70f90875..8146a78f 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Factory/Extended.php +++ b/src/Knp/DictionaryBundle/Dictionary/Factory/Extended.php @@ -12,7 +12,7 @@ final class Extended implements Factory { - public function __construct(private Factory $factory, private Collection $dictionaries) {} + public function __construct(private readonly Factory $factory, private Collection $dictionaries) {} public function create(string $name, array $config): Dictionary { diff --git a/src/Knp/DictionaryBundle/Dictionary/Factory/Invokable.php b/src/Knp/DictionaryBundle/Dictionary/Factory/Invokable.php index b9edfe49..85b2a97f 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Factory/Invokable.php +++ b/src/Knp/DictionaryBundle/Dictionary/Factory/Invokable.php @@ -11,7 +11,7 @@ final class Invokable implements Factory { - public function __construct(private ContainerInterface $container) {} + public function __construct(private readonly ContainerInterface $container) {} /** * {@inheritdoc} diff --git a/src/Knp/DictionaryBundle/Dictionary/Factory/Iterator.php b/src/Knp/DictionaryBundle/Dictionary/Factory/Iterator.php index b69964de..e6f952c9 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Factory/Iterator.php +++ b/src/Knp/DictionaryBundle/Dictionary/Factory/Iterator.php @@ -12,7 +12,7 @@ final class Iterator implements Factory { - public function __construct(private ContainerInterface $container) {} + public function __construct(private readonly ContainerInterface $container) {} /** * {@inheritdoc} diff --git a/src/Knp/DictionaryBundle/Dictionary/Factory/KeyValue.php b/src/Knp/DictionaryBundle/Dictionary/Factory/KeyValue.php index 9a53a488..a3e0d8ed 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Factory/KeyValue.php +++ b/src/Knp/DictionaryBundle/Dictionary/Factory/KeyValue.php @@ -12,7 +12,7 @@ final class KeyValue implements Factory { - public function __construct(private ValueTransformer $transformer) {} + public function __construct(private readonly ValueTransformer $transformer) {} /** * {@inheritdoc} diff --git a/src/Knp/DictionaryBundle/Dictionary/Factory/Value.php b/src/Knp/DictionaryBundle/Dictionary/Factory/Value.php index 8376c0a9..03a0ae36 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Factory/Value.php +++ b/src/Knp/DictionaryBundle/Dictionary/Factory/Value.php @@ -12,7 +12,7 @@ final class Value implements Factory { - public function __construct(private ValueTransformer $transformer) {} + public function __construct(private readonly ValueTransformer $transformer) {} /** * {@inheritdoc} diff --git a/src/Knp/DictionaryBundle/Dictionary/Factory/ValueAsKey.php b/src/Knp/DictionaryBundle/Dictionary/Factory/ValueAsKey.php index 6c2344f8..4ad16a01 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Factory/ValueAsKey.php +++ b/src/Knp/DictionaryBundle/Dictionary/Factory/ValueAsKey.php @@ -12,7 +12,7 @@ final class ValueAsKey implements Factory { - public function __construct(private ValueTransformer $transformer) {} + public function __construct(private readonly ValueTransformer $transformer) {} /** * {@inheritdoc} diff --git a/src/Knp/DictionaryBundle/Dictionary/Invokable.php b/src/Knp/DictionaryBundle/Dictionary/Invokable.php index b178fddb..51b4fe72 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Invokable.php +++ b/src/Knp/DictionaryBundle/Dictionary/Invokable.php @@ -31,8 +31,11 @@ final class Invokable implements Dictionary /** * @param mixed[] $callableArgs */ - public function __construct(private string $name, callable $callable, private array $callableArgs = []) - { + public function __construct( + private readonly string $name, + callable $callable, + private readonly array $callableArgs = [] + ) { $this->callable = $callable; } diff --git a/src/Knp/DictionaryBundle/Dictionary/Simple.php b/src/Knp/DictionaryBundle/Dictionary/Simple.php index e66f9aaa..005d99bb 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Simple.php +++ b/src/Knp/DictionaryBundle/Dictionary/Simple.php @@ -17,7 +17,7 @@ final class Simple implements Dictionary /** * @param array $values */ - public function __construct(private string $name, private array $values) {} + public function __construct(private readonly string $name, private array $values) {} public function getName(): string { diff --git a/src/Knp/DictionaryBundle/Dictionary/Traceable.php b/src/Knp/DictionaryBundle/Dictionary/Traceable.php index 9994d705..11933553 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Traceable.php +++ b/src/Knp/DictionaryBundle/Dictionary/Traceable.php @@ -17,7 +17,10 @@ final class Traceable implements Dictionary /** * @param Dictionary $dictionary */ - public function __construct(private Dictionary $dictionary, private DictionaryDataCollector $collector) {} + public function __construct( + private readonly Dictionary $dictionary, + private readonly DictionaryDataCollector $collector + ) {} public function getName(): string { diff --git a/src/Knp/DictionaryBundle/Dictionary/Wrapper.php b/src/Knp/DictionaryBundle/Dictionary/Wrapper.php index 095cc83d..e2b299e3 100644 --- a/src/Knp/DictionaryBundle/Dictionary/Wrapper.php +++ b/src/Knp/DictionaryBundle/Dictionary/Wrapper.php @@ -16,7 +16,7 @@ abstract class Wrapper implements Dictionary /** * @param Dictionary $wrapped */ - public function __construct(private Dictionary $wrapped) {} + public function __construct(private readonly Dictionary $wrapped) {} public function getName(): string { diff --git a/src/Knp/DictionaryBundle/Templating/Extension/Dictionary.php b/src/Knp/DictionaryBundle/Templating/Extension/Dictionary.php index 30dd7b82..41965b37 100644 --- a/src/Knp/DictionaryBundle/Templating/Extension/Dictionary.php +++ b/src/Knp/DictionaryBundle/Templating/Extension/Dictionary.php @@ -19,7 +19,7 @@ public function __construct(private Collection $dictionaries) {} public function getFunctions() { return [ - new TwigFunction('dictionary', [$this->dictionaries, 'offsetGet']), + new TwigFunction('dictionary', $this->dictionaries->offsetGet(...)), ]; } diff --git a/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator.php b/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator.php index 7e4513ab..2af79633 100644 --- a/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator.php +++ b/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator.php @@ -12,7 +12,7 @@ final class DictionaryValidator extends ConstraintValidator { use DictionaryValidator\SymfonyCompatibilityTrait; - public function __construct(private Collection $dictionaries) {} + public function __construct(private readonly Collection $dictionaries) {} private function varToString(mixed $var): string {