diff --git a/.github/workflows/template-sync.yml b/.github/workflows/template-sync.yml index 62e9057..63c2f16 100644 --- a/.github/workflows/template-sync.yml +++ b/.github/workflows/template-sync.yml @@ -22,7 +22,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Reformat using Prettier - uses: actionsx/prettier@v2 + uses: actionsx/prettier@v3 with: args: --write . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c9119d0..070c217 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,7 +67,7 @@ jobs: uses: actions/checkout@v3 - name: Run prettier - uses: actionsx/prettier@v2 + uses: actionsx/prettier@v3 with: args: --check . diff --git a/composer.json b/composer.json index 7f63253..b450b90 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ "require-dev": { "pestphp/pest": "^2.8", "mockery/mockery": "^1.4", - "php-cs-fixer/shim": "~3.19.2", - "tenantcloud/php-cs-fixer-rule-sets": "~3.0.0", + "php-cs-fixer/shim": "^3.54", + "tenantcloud/php-cs-fixer-rule-sets": "~3.3.1", "phpstan/phpstan": "~1.10.21", "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-webmozart-assert": "^1.2", diff --git a/src/Enum/BackedEnumExtensions.php b/src/Enum/BackedEnumExtensions.php index 1a99dc6..debe5b2 100644 --- a/src/Enum/BackedEnumExtensions.php +++ b/src/Enum/BackedEnumExtensions.php @@ -12,7 +12,7 @@ trait BackedEnumExtensions { /** - * @return TEnumValue[] + * @return list */ public static function values(): array { diff --git a/src/Enum/EnumInvalidUsageException.php b/src/Enum/EnumInvalidUsageException.php index 3380bbd..e7f77f3 100644 --- a/src/Enum/EnumInvalidUsageException.php +++ b/src/Enum/EnumInvalidUsageException.php @@ -7,7 +7,7 @@ class EnumInvalidUsageException extends RuntimeException { - public function __construct(string $message, Throwable $previous = null) + public function __construct(string $message, ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } diff --git a/src/Enum/ValueEnum.php b/src/Enum/ValueEnum.php index ada40dd..f7295ea 100644 --- a/src/Enum/ValueEnum.php +++ b/src/Enum/ValueEnum.php @@ -26,7 +26,7 @@ public function __construct($value) /** * Get the instance as an array. * - * @return T[] + * @return list */ public static function values(): array { diff --git a/src/Enum/ValueNotFoundException.php b/src/Enum/ValueNotFoundException.php index bdcddaf..dd2a19e 100644 --- a/src/Enum/ValueNotFoundException.php +++ b/src/Enum/ValueNotFoundException.php @@ -7,7 +7,7 @@ class ValueNotFoundException extends RuntimeException { - public function __construct(mixed $value, Throwable $previous = null) + public function __construct(mixed $value, ?Throwable $previous = null) { parent::__construct("Value {$value} was not found.", 0, $previous); } diff --git a/src/Iterators/ArrayValuesIterator.php b/src/Iterators/ArrayValuesIterator.php index 4112984..ddedce3 100644 --- a/src/Iterators/ArrayValuesIterator.php +++ b/src/Iterators/ArrayValuesIterator.php @@ -16,23 +16,19 @@ class ArrayValuesIterator implements Iterator { private int $position; - /** @var T[] */ - private array $items; - /** - * @param T[] $items + * @param list $items */ - public function __construct(array $items = []) - { - $this->items = $items; - + public function __construct(/** @var list */ + private array $items = [] + ) { $this->rewind(); } /** * Merges new elements at given position. * - * @param T[] $values + * @param list $values */ public function merge(array $values, int $at): void { diff --git a/src/Optional/MissingValueException.php b/src/Optional/MissingValueException.php index eb04c7b..29e5800 100644 --- a/src/Optional/MissingValueException.php +++ b/src/Optional/MissingValueException.php @@ -4,6 +4,4 @@ use RuntimeException; -class MissingValueException extends RuntimeException -{ -} +class MissingValueException extends RuntimeException {} diff --git a/src/StaticConstructor/StaticConstructorInvalidUsageException.php b/src/StaticConstructor/StaticConstructorInvalidUsageException.php index 1182a65..5a9529c 100644 --- a/src/StaticConstructor/StaticConstructorInvalidUsageException.php +++ b/src/StaticConstructor/StaticConstructorInvalidUsageException.php @@ -7,7 +7,7 @@ class StaticConstructorInvalidUsageException extends RuntimeException { - public function __construct(string $message, Throwable $previous = null) + public function __construct(string $message, ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } diff --git a/src/StaticConstructor/StaticConstructorLoader.php b/src/StaticConstructor/StaticConstructorLoader.php index 86c113f..111e02a 100644 --- a/src/StaticConstructor/StaticConstructorLoader.php +++ b/src/StaticConstructor/StaticConstructorLoader.php @@ -13,12 +13,7 @@ */ final class StaticConstructorLoader extends ClassLoader { - private ClassLoader $delegate; - - public function __construct(ClassLoader $delegate) - { - $this->delegate = $delegate; - } + public function __construct(private ClassLoader $delegate) {} /** * @param class-string $className diff --git a/tests/Enum/Stubs/NonValueEnumStub.php b/tests/Enum/Stubs/NonValueEnumStub.php index 651404e..84446b3 100644 --- a/tests/Enum/Stubs/NonValueEnumStub.php +++ b/tests/Enum/Stubs/NonValueEnumStub.php @@ -10,12 +10,7 @@ class NonValueEnumStub extends Enum public static self $INHERITED_CASE; - private int $value; - - public function __construct(int $value) - { - $this->value = $value; - } + public function __construct(private int $value) {} public function value(): int {