diff --git a/composer.json b/composer.json index 3591b7c65..a8fd0735e 100644 --- a/composer.json +++ b/composer.json @@ -142,7 +142,7 @@ "phpunit/phpunit": "10.5.3", "ramsey/collection": "^1.2", "ramsey/uuid": "^4.2.3", - "rector/rector": "1.2.10", + "rector/rector": "~2.0.0", "spiral/code-style": "^2.2", "spiral/nyholm-bridge": "^1.2", "spiral/testing": "^2.8", diff --git a/rector.php b/rector.php index d2a8c3682..7e6d72f48 100644 --- a/rector.php +++ b/rector.php @@ -17,6 +17,7 @@ use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector; use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector; use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; +use Rector\Php81\Rector\Array_\FirstClassCallableRector; use Rector\Php81\Rector\ClassMethod\NewInInitializerRector; use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; @@ -105,13 +106,13 @@ __DIR__ . '/src/Scaffolder/src/Command', ], - \Rector\PHPUnit\PHPUnit100\Rector\MethodCall\AssertIssetToAssertObjectHasPropertyRector::class => [ - // ArrayAccess usage - __DIR__ . '/src/Session/tests/SessionTest.php', + FirstClassCallableRector::class => [ + __DIR__ . '/src/Core/tests/Scope/UseCaseTest.php', ], ]) ->withPhpSets(php81: true) - ->withPreparedSets(deadCode: true, phpunit: true) + ->withPreparedSets(deadCode: true) + ->withComposerBased(phpunit: true) ->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [ ClassPropertyAssignToConstructorPromotionRector::RENAME_PROPERTY => false, ]); diff --git a/src/Queue/src/Attribute/RetryPolicy.php b/src/Queue/src/Attribute/RetryPolicy.php index 978e37f22..dcb914cf5 100644 --- a/src/Queue/src/Attribute/RetryPolicy.php +++ b/src/Queue/src/Attribute/RetryPolicy.php @@ -25,7 +25,7 @@ class RetryPolicy { /** - * @param 0|positive-int $maxAttempts + * @param int<0, max> $maxAttempts * @param positive-int $delay in seconds. */ public function __construct( diff --git a/src/Queue/src/RetryPolicy.php b/src/Queue/src/RetryPolicy.php index a05653c74..5ddb8cf22 100644 --- a/src/Queue/src/RetryPolicy.php +++ b/src/Queue/src/RetryPolicy.php @@ -11,12 +11,12 @@ final class RetryPolicy implements RetryPolicyInterface { /** - * @var positive-int|0 + * @var int<0, max> */ private readonly int $maxAttempts; /** - * @var positive-int|0 + * @var int<0, max> */ private readonly int $delay; @@ -50,7 +50,7 @@ public function __construct(int $maxAttempts, int $delay, float $multiplier = 1) } /** - * @param positive-int|0 $attempts + * @param int<0, max> $attempts * * @return positive-int */ @@ -60,7 +60,7 @@ public function getDelay(int $attempts = 0): int } /** - * @param positive-int|0 $attempts + * @param int<0, max> $attempts */ public function isRetryable(\Throwable $exception, int $attempts = 0): bool { diff --git a/src/Queue/src/RetryPolicyInterface.php b/src/Queue/src/RetryPolicyInterface.php index e45a7850f..f773268b5 100644 --- a/src/Queue/src/RetryPolicyInterface.php +++ b/src/Queue/src/RetryPolicyInterface.php @@ -7,12 +7,12 @@ interface RetryPolicyInterface { /** - * @param positive-int|0 $attempts + * @param int<0, max> $attempts */ public function isRetryable(\Throwable $exception, int $attempts = 0): bool; /** - * @param positive-int|0 $attempts + * @param int<0, max> $attempts * * @return positive-int */ diff --git a/src/Storage/src/Bucket/ReadableInterface.php b/src/Storage/src/Bucket/ReadableInterface.php index 05185d757..c27f59e7e 100644 --- a/src/Storage/src/Bucket/ReadableInterface.php +++ b/src/Storage/src/Bucket/ReadableInterface.php @@ -46,7 +46,7 @@ public function getLastModified(string $pathname): int; /** * Returns the file size in bytes. * - * @return positive-int|0 + * @return int<0, max> * @throws FileOperationException */ public function getSize(string $pathname): int; diff --git a/src/Storage/src/Bucket/ReadableTrait.php b/src/Storage/src/Bucket/ReadableTrait.php index 671ba6850..ee6364a90 100644 --- a/src/Storage/src/Bucket/ReadableTrait.php +++ b/src/Storage/src/Bucket/ReadableTrait.php @@ -63,7 +63,7 @@ public function getLastModified(string $pathname): int } /** - * @return positive-int|0 + * @return int<0, max> */ public function getSize(string $pathname): int { diff --git a/src/Storage/src/File/ReadableInterface.php b/src/Storage/src/File/ReadableInterface.php index bda3a563d..5fca69f41 100644 --- a/src/Storage/src/File/ReadableInterface.php +++ b/src/Storage/src/File/ReadableInterface.php @@ -47,7 +47,7 @@ public function getLastModified(): int; /** * {@see BucketInterface::getSize()} * - * @return positive-int|0 + * @return int<0, max> * @throws FileOperationException */ public function getSize(): int; diff --git a/src/Storage/src/File/ReadableTrait.php b/src/Storage/src/File/ReadableTrait.php index a14127a0e..11e21ccc0 100644 --- a/src/Storage/src/File/ReadableTrait.php +++ b/src/Storage/src/File/ReadableTrait.php @@ -47,7 +47,7 @@ public function getLastModified(): int } /** - * @return positive-int|0 + * @return int<0, max> */ public function getSize(): int { diff --git a/src/Storage/src/Storage/ReadableInterface.php b/src/Storage/src/Storage/ReadableInterface.php index ba53c13a1..1a37f4670 100644 --- a/src/Storage/src/Storage/ReadableInterface.php +++ b/src/Storage/src/Storage/ReadableInterface.php @@ -45,7 +45,7 @@ public function exists(string|\Stringable $id): bool; /** * {@see BucketInterface::getLastModified()} * - * @return positive-int|0 + * @return int<0, max> * @throws FileOperationException * @throws InvalidArgumentException */ @@ -54,7 +54,7 @@ public function getLastModified(string|\Stringable $id): int; /** * {@see BucketInterface::getSize()} * - * @return positive-int|0 + * @return int<0, max> * @throws FileOperationException * @throws InvalidArgumentException */ diff --git a/src/Storage/src/Storage/ReadableTrait.php b/src/Storage/src/Storage/ReadableTrait.php index a069527b8..07ef36c9e 100644 --- a/src/Storage/src/Storage/ReadableTrait.php +++ b/src/Storage/src/Storage/ReadableTrait.php @@ -40,7 +40,7 @@ public function exists(string|\Stringable $id): bool } /** - * @return positive-int|0 + * @return int<0, max> */ public function getLastModified(string|\Stringable $id): int { @@ -50,7 +50,7 @@ public function getLastModified(string|\Stringable $id): int } /** - * @return positive-int|0 + * @return int<0, max> */ public function getSize(string|\Stringable $id): int {