Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions system/DataConverter/DataConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public function __construct(
*
* @param array<string, mixed> $data DataSource data
*
* @return array<string, mixed>
*
* @internal
*/
public function fromDataSource(array $data): array
Expand All @@ -89,6 +91,8 @@ public function fromDataSource(array $data): array
*
* @param array<string, mixed> $phpData PHP data
*
* @return array<string, mixed>
*
* @internal
*/
public function toDataSource(array $phpData): array
Expand Down
18 changes: 18 additions & 0 deletions tests/system/DataConverter/DataConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public function testInstantiate(): void
$this->assertInstanceOf(DataConverter::class, $converter);
}

/**
* @param array<string, string> $types
* @param array<string, mixed> $dbData
* @param array<string, mixed> $expected
*/
#[DataProvider('provideConvertDataFromDB')]
public function testConvertDataFromDB(array $types, array $dbData, array $expected): void
{
Expand All @@ -54,6 +59,9 @@ public function testConvertDataFromDB(array $types, array $dbData, array $expect
$this->assertSame($expected, $data);
}

/**
* @return iterable<string, array{array<string, string>, array<string, mixed>, array<string, mixed>}>
*/
public static function provideConvertDataFromDB(): iterable
{
yield from [
Expand Down Expand Up @@ -270,6 +278,11 @@ public static function provideConvertDataFromDB(): iterable
];
}

/**
* @param array<string, string> $types
* @param array<string, mixed> $phpData
* @param array<string, mixed> $expected
*/
#[DataProvider('provideConvertDataToDB')]
public function testConvertDataToDB(array $types, array $phpData, array $expected): void
{
Expand All @@ -280,6 +293,9 @@ public function testConvertDataToDB(array $types, array $phpData, array $expecte
$this->assertSame($expected, $data);
}

/**
* @return iterable<string, array{array<string, string>, array<string, mixed>, array<string, mixed>}>
*/
public static function provideConvertDataToDB(): iterable
{
yield from [
Expand Down Expand Up @@ -706,6 +722,8 @@ public function testNotNullable(): void
}

/**
* @param array<string, string> $types
* @param array<string, class-string> $handlers
* @param (Closure(array<string, mixed>): object)|string|null $reconstructor
* @param (Closure(object, bool, bool): array<string, mixed>)|string|null $extractor
*/
Expand Down
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 124 errors
# total 112 errors

includes:
- argument.type.neon
Expand Down
62 changes: 1 addition & 61 deletions utils/phpstan-baseline/missingType.iterableValue.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 80 errors
# total 68 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -72,16 +72,6 @@ parameters:
count: 1
path: ../../system/Cookie/CookieStore.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverter\:\:fromDataSource\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/DataConverter/DataConverter.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverter\:\:toDataSource\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/DataConverter/DataConverter.php

-
message: '#^Method CodeIgniter\\Exceptions\\PageNotFoundException\:\:lang\(\) has parameter \$args with no value type specified in iterable type array\.$#'
count: 1
Expand Down Expand Up @@ -307,56 +297,6 @@ parameters:
count: 1
path: ../../tests/system/Cookie/CookieTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:createDataConverter\(\) has parameter \$handlers with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:createDataConverter\(\) has parameter \$types with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:provideConvertDataFromDB\(\) return type has no value type specified in iterable type iterable\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:provideConvertDataToDB\(\) return type has no value type specified in iterable type iterable\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:testConvertDataFromDB\(\) has parameter \$dbData with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:testConvertDataFromDB\(\) has parameter \$expected with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:testConvertDataFromDB\(\) has parameter \$types with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:testConvertDataToDB\(\) has parameter \$expected with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:testConvertDataToDB\(\) has parameter \$phpData with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\DataConverter\\DataConverterTest\:\:testConvertDataToDB\(\) has parameter \$types with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/DataConverter/DataConverterTest.php

-
message: '#^Method CodeIgniter\\Models\\FindModelTest\:\:provideAggregateAndGroupBy\(\) return type has no value type specified in iterable type iterable\.$#'
count: 1
Expand Down
Loading