Skip to content

Commit 6dc3850

Browse files
committed
test: add type definitions
1 parent 4486cbd commit 6dc3850

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

tests/system/Cache/Handlers/AbstractHandlerTestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
abstract class AbstractHandlerTestCase extends CIUnitTestCase
2323
{
2424
protected BaseHandler $handler;
25-
protected static $key1 = 'key1';
26-
protected static $key2 = 'key2';
27-
protected static $key3 = 'key3';
28-
protected static $dummy = 'dymmy';
25+
protected static string $key1 = 'key1';
26+
protected static string $key2 = 'key2';
27+
protected static string $key3 = 'key3';
28+
protected static string $dummy = 'dymmy';
2929

3030
public function testGetMetaDataMiss(): void
3131
{

tests/system/Database/Live/AbstractGetFieldDataTestCase.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use CodeIgniter\Database\Forge;
1818
use CodeIgniter\Test\CIUnitTestCase;
1919
use Config\Database;
20+
use stdClass;
2021

2122
abstract class AbstractGetFieldDataTestCase extends CIUnitTestCase
2223
{
@@ -56,7 +57,7 @@ protected function tearDown(): void
5657
$this->forge->dropTable($this->table, true);
5758
}
5859

59-
protected function createTableForDefault()
60+
protected function createTableForDefault(): void
6061
{
6162
$this->forge->dropTable($this->table, true);
6263

@@ -98,7 +99,7 @@ protected function createTableForDefault()
9899
$this->forge->createTable($this->table);
99100
}
100101

101-
protected function createTableForType()
102+
protected function createTableForType(): void
102103
{
103104
$this->forge->dropTable($this->table, true);
104105

@@ -158,7 +159,11 @@ protected function createTableForType()
158159

159160
abstract public function testGetFieldDataDefault(): void;
160161

161-
protected function assertSameFieldData(array $expected, array $actual)
162+
/**
163+
* @param list<stdClass> $expected
164+
* @param list<stdClass> $actual
165+
*/
166+
protected function assertSameFieldData(array $expected, array $actual): void
162167
{
163168
$expectedArray = json_decode(json_encode($expected), true);
164169
array_sort_by_multiple_keys($expectedArray, ['name' => SORT_ASC]);

tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testGetFieldDataDefault(): void
105105
$this->assertSameFieldData($expected, $fields);
106106
}
107107

108-
protected function createTableCompositePrimaryKey()
108+
protected function createTableCompositePrimaryKey(): void
109109
{
110110
$this->forge->dropTable($this->table, true);
111111

tests/system/Events/EventsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public function testHandleEventCallableInternalFunc(): void
287287
public function testHandleEventCallableClass(): void
288288
{
289289
$box = new class () {
290-
public $logged;
290+
public string $logged;
291291

292292
public function hold(string $value): void
293293
{

0 commit comments

Comments
 (0)