Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to Rector ~2.0.0 #1177

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 2 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,10 @@
// used by Configurator
__DIR__ . '/src/Scaffolder/src/Command',
],

\Rector\PHPUnit\PHPUnit100\Rector\MethodCall\AssertIssetToAssertObjectHasPropertyRector::class => [
// ArrayAccess usage
__DIR__ . '/src/Session/tests/SessionTest.php',
],
])
->withPhpSets(php81: true)
->withPreparedSets(deadCode: true, phpunit: true)
->withPreparedSets(deadCode: true)
->withComposerBased(phpunit: true)
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
ClassPropertyAssignToConstructorPromotionRector::RENAME_PROPERTY => false,
]);
10 changes: 5 additions & 5 deletions src/Core/tests/Scope/UseCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function testScopeBindingsAsNotSingletons(bool $theSame, string $alias, m

public static function provideScopeBindingsAsNotSingletons(): iterable
{
yield 'array-factory' => [false, 'foo', [Factory::class, 'makeStdClass']];
yield 'array-factory' => [false, 'foo', (new Factory())->makeStdClass(...)];
roxblnfk marked this conversation as resolved.
Show resolved Hide resolved
yield 'class-name' => [false, SampleClass::class, SampleClass::class];
yield 'object' => [true, stdClass::class, new stdClass()];
}
Expand Down Expand Up @@ -107,11 +107,11 @@ public function testScopeDefinition(): void
self::assertNotSame($c1, $c2);
self::assertInstanceOf(stdClass::class, $obj2);
self::assertNotSame($obj1, $obj2);
}, bindings: ['foo' => [Factory::class, 'makeStdClass']]);
}, bindings: ['foo' => (new Factory())->makeStdClass(...)]);

// $obj2 should be garbage collected
self::assertCount(1, $this->weakMap);
}, bindings: ['foo' => [Factory::class, 'makeStdClass']]);
}, bindings: ['foo' => (new Factory())->makeStdClass(...)]);

// $obj1 should be garbage collected
self::assertEmpty($this->weakMap);
Expand All @@ -125,7 +125,7 @@ public function testScopeDefinition(): void
public function testChildContainerResolvesDepsFromParent(): void
{
$root = new Container();
$root->bindSingleton('bar', [Factory::class, 'makeStdClass']);
$root->bindSingleton('bar', (new Factory())->makeStdClass(...));
$root->bind(stdClass::class, new stdClass());

$root->runScoped(function (ContainerInterface $c1) use ($root) {
Expand All @@ -149,7 +149,7 @@ public function testChildContainerResolvesDepsFromParent(): void
"Nested container mustn't create new instance using class name as key without definition."
);
});
}, bindings: ['foo' => [Factory::class, 'makeStdClass']]);
}, bindings: ['foo' => (new Factory())->makeStdClass(...)]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Queue/src/Attribute/RetryPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions src/Queue/src/RetryPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
*/
Expand All @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Queue/src/RetryPolicyInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/src/Bucket/ReadableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/src/Bucket/ReadableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getLastModified(string $pathname): int
}

/**
* @return positive-int|0
* @return int<0, max>
*/
public function getSize(string $pathname): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/src/File/ReadableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/src/File/ReadableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getLastModified(): int
}

/**
* @return positive-int|0
* @return int<0, max>
*/
public function getSize(): int
{
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/src/Storage/ReadableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/src/Storage/ReadableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down
Loading