Skip to content
Open
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
6 changes: 6 additions & 0 deletions tests/system/Router/AutoRouterImprovedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ public function testTranslateUriToCamelCase(
], $router->getPos());
}

/**
* @return iterable<string, array{string, string|null, string, string, int, int|null, int|null}>
*/
public static function provideTranslateUriToCamelCase(): iterable
{
yield from [
Expand Down Expand Up @@ -587,6 +590,9 @@ public function testRejectTranslateUriToCamelCase(string $uri, string $expMsg):
$router->getRoute($uri, Method::GET);
}

/**
* @return iterable<string, array{string, string}>
*/
public static function provideRejectTranslateUriToCamelCase(): iterable
{
yield from [
Expand Down
3 changes: 3 additions & 0 deletions tests/system/Router/DefinedRouteCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#[Group('Others')]
final class DefinedRouteCollectorTest extends CIUnitTestCase
{
/**
* @param array<non-empty-string, list<non-empty-string>|non-empty-string> $config
*/
private function createRouteCollection(array $config = [], ?Modules $moduleConfig = null): RouteCollection
{
$defaults = [
Expand Down
7 changes: 7 additions & 0 deletions tests/system/Router/RouteCollectionReverseRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ protected function setUp(): void
$this->resetFactories();
}

/**
* @param array<non-empty-string, list<non-empty-string>|non-empty-string> $config
* @param array<array-key, mixed> $files
*/
protected function getCollector(array $config = [], array $files = [], ?Modules $moduleConfig = null): RouteCollection
{
$defaults = [
Expand Down Expand Up @@ -147,6 +151,9 @@ public function testReverseRoutingDefaultNamespaceAppController(string $controll
$this->assertSame('/users/15/gallery12', $match);
}

/**
* @return iterable<string, array{string}>
*/
public static function provideReverseRoutingDefaultNamespaceAppController(): iterable
{
return yield from [
Expand Down
20 changes: 20 additions & 0 deletions tests/system/Router/RouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ protected function setUp(): void
Services::injectMock('superglobals', new Superglobals());
}

/**
* @param array<non-empty-string, list<non-empty-string>|non-empty-string> $config
* @param array<array-key, mixed> $files
*/
protected function getCollector(array $config = [], array $files = [], ?Modules $moduleConfig = null): RouteCollection
{
$defaults = [
Expand Down Expand Up @@ -507,6 +511,9 @@ static function ($routes): void {
$this->assertSame($expected, $routes->getRoutes());
}

/**
* @param array<string, string> $expected
*/
#[DataProvider('provideNestedGroupingWorksWithRootPrefix')]
public function testNestedGroupingWorksWithRootPrefix(
string $group,
Expand All @@ -531,6 +538,9 @@ static function ($routes): void {
$this->assertSame($expected, $routes->getRoutes());
}

/**
* @return iterable<int, array{string, string, array<string, string>}>
*/
public static function provideNestedGroupingWorksWithRootPrefix(): iterable
{
yield from [
Expand Down Expand Up @@ -1343,6 +1353,10 @@ static function (): void {},
$this->assertSame($options, ['as' => 'admin', 'foo' => 'baz']);
}

/**
* @param array<string, string> $options1
* @param array<string, string> $options2
*/
#[DataProvider('provideRoutesOptionsWithSameFromTwoRoutes')]
public function testRoutesOptionsWithSameFromTwoRoutes(array $options1, array $options2): void
{
Expand All @@ -1366,6 +1380,9 @@ static function (): void {},
$this->assertSame($options, $options1);
}

/**
* @return iterable<int, array{array<string, string>, array<string, string>}>
*/
public static function provideRoutesOptionsWithSameFromTwoRoutes(): iterable
{
yield from [
Expand Down Expand Up @@ -1860,6 +1877,9 @@ public function testRoutesControllerNameReturnsFQCN(string $namespace): void
$this->assertSame('\\' . Product::class, $router->controllerName());
}

/**
* @return iterable<string, array{string}>
*/
public static function provideRouteDefaultNamespace(): iterable
{
return [
Expand Down
3 changes: 3 additions & 0 deletions tests/system/Router/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,9 @@ public function testRedirectRoute(
$router->handle($url);
}

/**
* @return iterable<int, array{string, string, string, string, string, string}>
*/
public static function provideRedirectRoute(): iterable
{
// [$route, $redirectFrom, $redirectTo, $url, $expectedPath, $alias]
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 419 errors
# total 404 errors

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

parameters:
ignoreErrors:
Expand Down Expand Up @@ -1297,81 +1297,6 @@ parameters:
count: 1
path: ../../tests/system/RESTful/ResourceControllerTest.php

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

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

-
message: '#^Method CodeIgniter\\Router\\DefinedRouteCollectorTest\:\:createRouteCollection\(\) has parameter \$config with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/Router/DefinedRouteCollectorTest.php

-
message: '#^Method CodeIgniter\\Router\\RouteCollectionReverseRouteTest\:\:getCollector\(\) has parameter \$config with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/Router/RouteCollectionReverseRouteTest.php

-
message: '#^Method CodeIgniter\\Router\\RouteCollectionReverseRouteTest\:\:getCollector\(\) has parameter \$files with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/Router/RouteCollectionReverseRouteTest.php

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

-
message: '#^Method CodeIgniter\\Router\\RouteCollectionTest\:\:getCollector\(\) has parameter \$config with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/Router/RouteCollectionTest.php

-
message: '#^Method CodeIgniter\\Router\\RouteCollectionTest\:\:getCollector\(\) has parameter \$files with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/Router/RouteCollectionTest.php

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

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

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

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

-
message: '#^Method CodeIgniter\\Router\\RouteCollectionTest\:\:testRoutesOptionsWithSameFromTwoRoutes\(\) has parameter \$options1 with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/Router/RouteCollectionTest.php

-
message: '#^Method CodeIgniter\\Router\\RouteCollectionTest\:\:testRoutesOptionsWithSameFromTwoRoutes\(\) has parameter \$options2 with no value type specified in iterable type array\.$#'
count: 1
path: ../../tests/system/Router/RouteCollectionTest.php

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

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