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..71cdc0de 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -4,7 +4,7 @@ build: analysis: environment: php: - version: 8.0.2 + version: 8.2.15 tests: override: - php-scrutinizer-run diff --git a/README.md b/README.md index 859575f4..d8bb774a 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, 6.4 or 7.* ## Installation diff --git a/composer.json b/composer.json index ff747cda..9055d24f 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": ">=8.0", + "php": ">=8.1", "symfony/config": "^5.4 || ^6.4 || ^7.0@dev", "symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0@dev", "symfony/form": "^5.4 || ^6.4 || ^7.0@dev", diff --git a/rector.php b/rector.php index 23dd6369..a199c708 100644 --- a/rector.php +++ b/rector.php @@ -6,7 +6,7 @@ use Rector\ValueObject\PhpVersion; return RectorConfig::configure() - ->withPhpVersion(PhpVersion::PHP_80) - ->withPhpSets(php80: true) + ->withPhpVersion(PhpVersion::PHP_81) + ->withPhpSets(php81: true) ->withPaths([__DIR__.'/src']) ; 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 df2e3890..1c52704b 100644 --- a/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator.php +++ b/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator.php @@ -32,7 +32,7 @@ public function validate(mixed $value, Constraint $constraint): void $constraint->message, [ '{{ key }}' => $this->varToString($value), - '{{ keys }}' => implode(', ', array_map([$this, 'varToString'], $values)), + '{{ keys }}' => implode(', ', array_map($this->varToString(...), $values)), ] ); }