Skip to content

Commit

Permalink
refactor: add closure void return type in tests (#1181)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik authored Dec 30, 2024
1 parent b8f44e4 commit b50696a
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
ClassPropertyAssignToConstructorPromotionRector::RENAME_PROPERTY => false,
])
->withTypeCoverageLevel(0);
->withTypeCoverageLevel(2);
2 changes: 1 addition & 1 deletion src/Auth/tests/TokenStorageProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function testGetStorageTwice(): void
$this->assertSame($sameStorage, $provider->getStorage('database'));
}

public function testGetDifferentStorage()
public function testGetDifferentStorage(): void
{
$provider = new TokenStorageProvider(
new AuthConfig([
Expand Down
2 changes: 1 addition & 1 deletion src/Boot/tests/KernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function testEnv(): void
);
}

public function testBootingCallbacks()
public function testBootingCallbacks(): void
{
$kernel = TestCore::create(['root' => __DIR__]);

Expand Down
4 changes: 2 additions & 2 deletions src/Core/tests/Scope/FinalizeAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function testFinalizerWithoutConcreteScopeInRoot(): void
}

#[Group('scrutinizer-ignore')]
public function testExceptionOnDestroy()
public function testExceptionOnDestroy(): void
{
$root = self::makeContainer();

Expand Down Expand Up @@ -146,7 +146,7 @@ public function testExceptionOnDestroy()
}

#[Group('scrutinizer-ignore')]
public function testManyExceptionsOnDestroy()
public function testManyExceptionsOnDestroy(): void
{
$root = self::makeContainer();

Expand Down
2 changes: 1 addition & 1 deletion src/Core/tests/Scope/ProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ static function (#[Proxy] ContainerInterface $proxy, ContainerInterface $scoped)
);
}

public function testProxyFallbackFactory()
public function testProxyFallbackFactory(): void
{
$root = new Container();
$root->bind(UserInterface::class, new ProxyConfig(
Expand Down
8 changes: 4 additions & 4 deletions src/Mailer/tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function testReplyTo(): void
$this->assertNull($m->getReplyTo());
}

public function testSetDelayInSeconds()
public function testSetDelayInSeconds(): void
{
$m = new Message('test', '[email protected]');
$m->setDelay(100);
Expand All @@ -123,7 +123,7 @@ public function testSetDelayInSeconds()
], $m->getOptions());
}

public function testSetDelayInDateInterval()
public function testSetDelayInDateInterval(): void
{
$m = new Message('test', '[email protected]');
$m->setDelay(new \DateInterval('PT56S'));
Expand All @@ -133,7 +133,7 @@ public function testSetDelayInDateInterval()
], $m->getOptions());
}

public function testSetDelayInDateTime()
public function testSetDelayInDateTime(): void
{
$m = new Message('test', '[email protected]');
$m->setDelay(new \DateTimeImmutable('+ 123 second'));
Expand All @@ -143,7 +143,7 @@ public function testSetDelayInDateTime()
], $m->getOptions());
}

public function testSetDelayInDateTimeWithPastTime()
public function testSetDelayInDateTimeWithPastTime(): void
{
$m = new Message('test', '[email protected]');
$m->setDelay(new \DateTimeImmutable('- 123 second'));
Expand Down
4 changes: 2 additions & 2 deletions src/Pagination/tests/LimitsTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public function setUp(): void
$this->trait = $this->getMockForTrait(LimitsTrait::class);
}

public function testLimit()
public function testLimit(): void
{
$this->assertEquals(static::DEFAULT_LIMIT, $this->trait->getLimit());
$this->assertEquals($this->trait, $this->trait->limit(static::LIMIT));
$this->assertEquals(static::LIMIT, $this->trait->getLimit());
}

public function testOffset()
public function testOffset(): void
{
$this->assertEquals(static::DEFAULT_OFFSET, $this->trait->getOffset());
$this->assertEquals($this->trait, $this->trait->offset(static::OFFSET));
Expand Down
2 changes: 1 addition & 1 deletion src/Snapshots/tests/SnapshotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class SnapshotTest extends TestCase
{
public function testSnapshot()
public function testSnapshot(): void
{
$e = new \Error("message");
$s = new Snapshot("id", $e);
Expand Down
10 changes: 5 additions & 5 deletions src/Streams/tests/StreamsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function tearDown(): void
$files->deleteDirectory(self::FIXTURE_DIRECTORY, true);
}

public function testGetUri()
public function testGetUri(): void
{
$stream = Stream::create();
$stream->write('sample text');
Expand All @@ -51,7 +51,7 @@ public function testGetUri()
$this->assertFalse(StreamWrapper::has($newFilename));
}

public function testGetResource()
public function testGetResource(): void
{
$stream = Stream::create();
$stream->write('sample text');
Expand All @@ -74,7 +74,7 @@ public function testGetResource()
/**
* @requires PHP < 8.0
*/
public function testException()
public function testException(): void
{
try {
fopen('spiral://non-exists', 'rb');
Expand All @@ -92,7 +92,7 @@ public function testException()
/**
* @requires PHP >= 8.0
*/
public function testExceptionPHP8()
public function testExceptionPHP8(): void
{
try {
fopen('spiral://non-exists', 'rb');
Expand All @@ -107,7 +107,7 @@ public function testExceptionPHP8()
}
}

public function testWriteIntoStream()
public function testWriteIntoStream(): void
{
$stream = Stream::create(fopen('php://temp', 'wrb+'));
$file = StreamWrapper::getFilename($stream);
Expand Down
2 changes: 1 addition & 1 deletion src/Tokenizer/tests/ReflectionFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function deadend()
}
}

function hello()
function hello(): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Framework/Framework/KernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class KernelTest extends BaseTestCase
{
public function testAppBootingCallbacks()
public function testAppBootingCallbacks(): void
{
$kernel = $this->createAppInstance();

Expand Down
2 changes: 1 addition & 1 deletion tests/Framework/SnapshotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class SnapshotTest extends BaseTestCase
{
public function testStringConfigParams()
public function testStringConfigParams(): void
{
// string important. Emulating string from .env
$app = $this->makeApp([
Expand Down

0 comments on commit b50696a

Please sign in to comment.