Merge remote-tracking branch 'upstream/develop' into 4.4

Conflicts:
	phpstan-baseline.neon.dist
	tests/system/Router/RouteCollectionReverseRouteTest.php
This commit is contained in:
kenjis 2023-07-21 09:49:18 +09:00
commit 93398b434e
No known key found for this signature in database
GPG Key ID: BD254878922AF198
58 changed files with 3107 additions and 440 deletions

View File

@ -43,19 +43,28 @@ $finder = Finder::create()
__DIR__ . '/spark',
]);
$overrides = [];
$options = [
'cacheFile' => 'build/.php-cs-fixer.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
$overrides = [
'php_unit_data_provider_return_type' => true,
];
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
$options = [
'cacheFile' => 'build/.php-cs-fixer.cache',
'finder' => $finder,
];
$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
'CodeIgniter 4 framework',
'CodeIgniter Foundation',
'admin@codeigniter.com'
);
// @TODO: remove this check when support for PHP 7.4 is dropped
if (PHP_VERSION_ID >= 80000) {
$config
->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'))
->setRules(array_merge($config->getRules(), [
NoCodeSeparatorCommentFixer::name() => true,
]));
}
return $config;

View File

@ -29,15 +29,24 @@ $finder = Finder::create()
__DIR__ . '/admin/starter/builds',
]);
$overrides = [];
$options = [
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
$overrides = [
'php_unit_data_provider_return_type' => true,
];
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
$options = [
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
'finder' => $finder,
];
$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
// @TODO: remove this check when support for PHP 7.4 is dropped
if (PHP_VERSION_ID >= 80000) {
$config
->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'))
->setRules(array_merge($config->getRules(), [
NoCodeSeparatorCommentFixer::name() => true,
]));
}
return $config;

View File

@ -29,19 +29,27 @@ $finder = Finder::create()
]);
$overrides = [
'echo_tag_syntax' => false,
'php_unit_internal_class' => false,
'no_unused_imports' => false,
'class_attributes_separation' => false,
'echo_tag_syntax' => false,
'php_unit_internal_class' => false,
'no_unused_imports' => false,
'class_attributes_separation' => false,
'php_unit_data_provider_return_type' => true,
];
$options = [
'cacheFile' => 'build/.php-cs-fixer.user-guide.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
'finder' => $finder,
];
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
// @TODO: remove this check when support for PHP 7.4 is dropped
if (PHP_VERSION_ID >= 80000) {
$config
->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'))
->setRules(array_merge($config->getRules(), [
NoCodeSeparatorCommentFixer::name() => true,
]));
}
return $config;

View File

@ -2,6 +2,7 @@
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
@ -158,6 +159,7 @@ class Cache extends BaseConfig
* that are listed here are allowed to be used.
*
* @var array<string, string>
* @phpstan-var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,

View File

@ -20,7 +20,7 @@
"nexusphp/cs-config": "^3.6",
"nexusphp/tachycardia": "^1.0",
"php-coveralls/php-coveralls": "^2.5",
"phpstan/phpstan": "^1.7.1",
"phpstan/phpstan": "^1.10.2",
"phpunit/phpcov": "^8.2",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0",

View File

@ -1,256 +0,0 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), 'loadClass'\\} given\\.$#"
count: 1
path: system/Autoloader/Autoloader.php
-
message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), 'loadClassmap'\\} given\\.$#"
count: 1
path: system/Autoloader/Autoloader.php
-
message: "#^Property CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:\\$db \\(CodeIgniter\\\\Database\\\\BaseConnection\\) in empty\\(\\) is not falsy\\.$#"
count: 1
path: system/Database/BaseBuilder.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Database\\\\QueryInterface\\:\\:getOriginalQuery\\(\\)\\.$#"
count: 1
path: system/Database/BaseConnection.php
-
message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\ConnectionInterface\\:\\:\\$DBDriver\\.$#"
count: 2
path: system/Database/Database.php
-
message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\ConnectionInterface\\:\\:\\$connID\\.$#"
count: 2
path: system/Database/Database.php
-
message: "#^Property CodeIgniter\\\\Database\\\\Migration\\:\\:\\$DBGroup \\(string\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/Database/Migration.php
-
message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\<mysqli, mysqli_result\\>\\:\\:\\$mysqli\\.$#"
count: 3
path: system/Database/MySQLi/PreparedQuery.php
-
message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$schema\\.$#"
count: 2
path: system/Database/SQLSRV/Builder.php
-
message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$schema\\.$#"
count: 13
path: system/Database/SQLSRV/Forge.php
-
message: "#^Property CodeIgniter\\\\Log\\\\Logger\\:\\:\\$logCache \\(array\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/Debug/Toolbar/Collectors/Logs.php
-
message: "#^Call to an undefined method CodeIgniter\\\\View\\\\RendererInterface\\:\\:getData\\(\\)\\.$#"
count: 1
path: system/Debug/Toolbar/Collectors/Views.php
-
message: "#^Call to an undefined method CodeIgniter\\\\View\\\\RendererInterface\\:\\:getPerformanceData\\(\\)\\.$#"
count: 2
path: system/Debug/Toolbar/Collectors/Views.php
-
message: "#^Static property CodeIgniter\\\\Email\\\\Email\\:\\:\\$func_overload \\(bool\\) in isset\\(\\) is not nullable\\.$#"
count: 1
path: system/Email/Email.php
-
message: "#^Property CodeIgniter\\\\Files\\\\File\\:\\:\\$size \\(int\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/Files/File.php
-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/Filters/Filters.php
-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/HTTP/Files/UploadedFile.php
-
message: "#^Property CodeIgniter\\\\HTTP\\\\Files\\\\UploadedFile\\:\\:\\$error \\(int\\) on left side of \\?\\? is not nullable\\.$#"
count: 2
path: system/HTTP/Files/UploadedFile.php
-
message: "#^Return type \\(bool\\) of method CodeIgniter\\\\HTTP\\\\Files\\\\UploadedFile\\:\\:move\\(\\) should be compatible with return type \\(CodeIgniter\\\\Files\\\\File\\) of method CodeIgniter\\\\Files\\\\File\\:\\:move\\(\\)$#"
count: 1
path: system/HTTP/Files/UploadedFile.php
-
message: "#^Property CodeIgniter\\\\HTTP\\\\Message\\:\\:\\$protocolVersion \\(string\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/HTTP/Message.php
-
message: "#^Variable \\$_GET on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: system/HTTP/RedirectResponse.php
-
message: "#^Variable \\$_POST on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: system/HTTP/RedirectResponse.php
-
message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$fragment \\(string\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/HTTP/URI.php
-
message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$host \\(string\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/HTTP/URI.php
-
message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$path \\(string\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/HTTP/URI.php
-
message: "#^Right side of && is always true\\.$#"
count: 1
path: system/Helpers/filesystem_helper.php
-
message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#"
count: 1
path: system/Images/Handlers/BaseHandler.php
-
message: "#^Comparison operation \"\\>\\=\" between \\(array\\|float\\|int\\) and 0 results in an error\\.$#"
count: 2
path: system/Images/Handlers/ImageMagickHandler.php
-
message: "#^PHPDoc type string\\|null of property CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:\\$resource is not covariant with PHPDoc type resource\\|null of overridden property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$resource\\.$#"
count: 1
path: system/Images/Handlers/ImageMagickHandler.php
-
message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$height \\(int\\) on left side of \\?\\? is not nullable\\.$#"
count: 4
path: system/Images/Handlers/ImageMagickHandler.php
-
message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$width \\(int\\) on left side of \\?\\? is not nullable\\.$#"
count: 4
path: system/Images/Handlers/ImageMagickHandler.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getDefaultNamespace\\(\\)\\.$#"
count: 2
path: system/Router/Router.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getFilterForRoute\\(\\)\\.$#"
count: 1
path: system/Router/Router.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getFiltersForRoute\\(\\)\\.$#"
count: 1
path: system/Router/Router.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRoutesOptions\\(\\)\\.$#"
count: 1
path: system/Router/Router.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:isFiltered\\(\\)\\.$#"
count: 1
path: system/Router/Router.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:setHTTPVerb\\(\\)\\.$#"
count: 1
path: system/Router/Router.php
-
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRegisteredControllers\\(.*\\)\\.$#"
count: 1
path: system/Router/Router.php
-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/Router/Router.php
-
message: "#^Access to an undefined property object\\:\\:\\$createdField\\.$#"
count: 1
path: system/Test/Fabricator.php
-
message: "#^Access to an undefined property object\\:\\:\\$deletedField\\.$#"
count: 1
path: system/Test/Fabricator.php
-
message: "#^Access to an undefined property object\\:\\:\\$updatedField\\.$#"
count: 1
path: system/Test/Fabricator.php
-
message: "#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$bodyFormat \\(string\\) in isset\\(\\) is not nullable\\.$#"
count: 1
path: system/Test/FeatureTestCase.php
-
message: "#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$clean \\(bool\\) in isset\\(\\) is not nullable\\.$#"
count: 1
path: system/Test/FeatureTestCase.php
-
message: "#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$session \\(array\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/Test/FeatureTestCase.php
-
message: "#^Cannot access property \\$insert_id on object\\|resource\\|false\\.$#"
count: 1
path: system/Test/Mock/MockConnection.php
-
message: "#^Property CodeIgniter\\\\Throttle\\\\Throttler\\:\\:\\$testTime \\(int\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/Throttle/Throttler.php
-
message: "#^Property CodeIgniter\\\\View\\\\Cell\\:\\:\\$cache \\(CodeIgniter\\\\Cache\\\\CacheInterface\\) in empty\\(\\) is not falsy\\.$#"
count: 2
path: system/View/Cell.php
-
message: "#^Call to an undefined static method CodeIgniter\\\\Config\\\\Factories\\:\\:cells\\(\\)\\.$#"
count: 1
path: system/View/Cell.php
-
message: "#^Property Config\\\\View\\:\\:\\$plugins \\(array\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
path: system/View/Parser.php
-
message: "#^Constructor of class CodeIgniter\\\\HTTP\\\\CURLRequest has an unused parameter \\$config\\.$#"
count: 1
path: system/HTTP/CURLRequest.php

2905
phpstan-baseline.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,19 +9,18 @@ services:
- phpstan.rules.rule
includes:
- phpstan-baseline.neon.dist
- phpstan-baseline.php
parameters:
phpVersion: 80100
tmpDir: build/phpstan
level: 5
level: 6
bootstrapFiles:
- phpstan-bootstrap.php
paths:
- app
- system
- utils/PHPStan
treatPhpDocTypesAsCertain: false
bootstrapFiles:
- phpstan-bootstrap.php
excludePaths:
- app/Views/errors/cli/*
- app/Views/errors/html/*
@ -38,3 +37,7 @@ parameters:
- APP_NAMESPACE
- CI_DEBUG
- ENVIRONMENT
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
checkMissingCallableSignature: true
treatPhpDocTypesAsCertain: false

View File

@ -463,7 +463,7 @@ final class CLITest extends CIUnitTestCase
$this->assertSame($this->getStreamFilterBuffer(), $expected);
}
public function tableProvider()
public function tableProvider(): iterable
{
$head = [
'ID',

View File

@ -35,7 +35,7 @@ final class BaseHandlerTest extends CIUnitTestCase
BaseHandler::validateKey($input);
}
public function invalidTypeProvider(): array
public function invalidTypeProvider(): iterable
{
return [
[true],

View File

@ -296,7 +296,7 @@ final class FileHandlerTest extends AbstractHandlerTest
$this->assertSame($string, $mode);
}
public function modeProvider()
public function modeProvider(): iterable
{
return [
[

View File

@ -891,7 +891,7 @@ final class CodeIgniterTest extends CIUnitTestCase
CITestStreamFilter::removeErrorFilter();
}
public function cacheQueryStringProvider(): array
public function cacheQueryStringProvider(): iterable
{
$testingUrls = [
// URL #1

View File

@ -138,7 +138,7 @@ final class CommandTest extends CIUnitTestCase
$this->assertSame($expected, ParamsReveal::$args);
}
public function commandArgsProvider(): array
public function commandArgsProvider(): iterable
{
return [
[

View File

@ -13,7 +13,6 @@ namespace CodeIgniter\Commands\Utilities\Routes;
use CodeIgniter\Config\Services;
use CodeIgniter\Test\CIUnitTestCase;
use Generator;
/**
* @internal
@ -34,7 +33,7 @@ final class SampleURIGeneratorTest extends CIUnitTestCase
$this->assertSame($expected, $uri);
}
public function routeKeyProvider(): Generator
public function routeKeyProvider(): iterable
{
yield from [
'root' => ['/', '/'],

View File

@ -631,7 +631,7 @@ final class CommonFunctionsTest extends CIUnitTestCase
$this->assertSame($expected, clean_path($input));
}
public function dirtyPathsProvider()
public function dirtyPathsProvider(): iterable
{
$ds = DIRECTORY_SEPARATOR;

View File

@ -21,7 +21,7 @@ use Config\Mimes;
*/
final class MimesTest extends CIUnitTestCase
{
public function extensionsList()
public function extensionsList(): iterable
{
return [
'null' => [
@ -55,7 +55,7 @@ final class MimesTest extends CIUnitTestCase
$this->assertSame($expected, Mimes::guessExtensionFromType($mime));
}
public function mimesList()
public function mimesList(): iterable
{
return [
'null' => [

View File

@ -16,7 +16,6 @@ use CodeIgniter\Test\CIUnitTestCase;
use Config\Cookie as CookieConfig;
use DateTimeImmutable;
use DateTimeZone;
use Generator;
use LogicException;
/**
@ -99,7 +98,7 @@ final class CookieTest extends CIUnitTestCase
$this->assertSame($expected, $cookie->getPrefixedName());
}
public function prefixProvider(): Generator
public function prefixProvider(): iterable
{
yield from [
['prefix_', '', 'prefix_test'],

View File

@ -14,7 +14,6 @@ namespace CodeIgniter\Database;
use CodeIgniter\Database\Exceptions\DatabaseException;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\Mock\MockConnection;
use Generator;
use Throwable;
/**
@ -184,7 +183,7 @@ final class BaseConnectionTest extends CIUnitTestCase
$this->assertSame($expected, $return);
}
public function identifiersProvider(): Generator
public function identifiersProvider(): iterable
{
yield from [
// $prefixSingle, $protectIdentifiers, $fieldExists, $item, $expected

View File

@ -104,7 +104,7 @@ final class BaseQueryTest extends CIUnitTestCase
$this->assertSame($newSQL, $query->getQuery());
}
public function queryTypes()
public function queryTypes(): iterable
{
return [
'select' => [
@ -577,7 +577,7 @@ final class BaseQueryTest extends CIUnitTestCase
$this->assertSame($expected, $query->getQuery());
}
public function queryKeywords()
public function queryKeywords(): iterable
{
return [
'highlightKeyWords' => [

View File

@ -392,7 +392,7 @@ final class WhereTest extends CIUnitTestCase
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
}
public function provideInvalidKeys()
public function provideInvalidKeys(): iterable
{
return [
'null' => [null],
@ -413,7 +413,7 @@ final class WhereTest extends CIUnitTestCase
$builder->whereIn($key, ['Politician', 'Accountant']);
}
public function provideInvalidValues()
public function provideInvalidValues(): iterable
{
return [
'null' => [null],

View File

@ -13,7 +13,6 @@ namespace CodeIgniter\Database;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\ReflectionHelper;
use Generator;
/**
* @internal
@ -209,7 +208,7 @@ final class ConfigTest extends CIUnitTestCase
$this->assertSame($expected, $this->getPrivateProperty($conn, 'DSN'));
}
public function convertDSNProvider(): Generator
public function convertDSNProvider(): iterable
{
yield from [
[

View File

@ -32,7 +32,7 @@ final class EmailTest extends CIUnitTestCase
$this->assertStringContainsString('Invalid email address: "invalid"', $email->printDebugger());
}
public function autoClearProvider()
public function autoClearProvider(): iterable
{
return [
'autoclear' => [true],

View File

@ -209,7 +209,7 @@ final class FiltersTest extends CIUnitTestCase
$this->assertSame($expected, $filters->initialize()->getFilters());
}
public function provideExcept()
public function provideExcept(): iterable
{
return [
[

View File

@ -124,7 +124,7 @@ final class InvalidCharsTest extends CIUnitTestCase
$this->invalidChars->before($this->request);
}
public function stringWithLineBreakAndTabProvider()
public function stringWithLineBreakAndTabProvider(): iterable
{
yield from [
["String contains \n line break."],
@ -148,7 +148,7 @@ final class InvalidCharsTest extends CIUnitTestCase
$this->invalidChars->before($this->request);
}
public function stringWithControlCharsProvider()
public function stringWithControlCharsProvider(): iterable
{
yield from [
["String contains null char.\0"],

View File

@ -115,7 +115,7 @@ final class XMLFormatterTest extends CIUnitTestCase
$this->assertSame($expectedXML, $this->xmlFormatter->format($input));
}
public function invalidTagsProvider()
public function invalidTagsProvider(): iterable
{
return [
[

View File

@ -517,7 +517,7 @@ final class CLIRequestTest extends CIUnitTestCase
$this->assertSame($expected, $this->request->fetchGlobal('post', 'clients[]'));
}
public function ipAddressChecks()
public function ipAddressChecks(): iterable
{
return [
'empty' => [

View File

@ -17,7 +17,6 @@ use CodeIgniter\HTTP\Exceptions\HTTPException;
use CodeIgniter\HTTP\Files\UploadedFile;
use CodeIgniter\Test\CIUnitTestCase;
use Config\App;
use Generator;
use InvalidArgumentException;
use TypeError;
@ -535,7 +534,7 @@ final class IncomingRequestTest extends CIUnitTestCase
$this->assertSame($expected, $request->getRawInput());
}
public function provideRawInputVarChecks()
public function provideRawInputVarChecks(): iterable
{
return [
[
@ -643,7 +642,7 @@ final class IncomingRequestTest extends CIUnitTestCase
$this->assertTrue($request->is(strtolower($value)));
}
public function provideIsHTTPMethods(): Generator
public function provideIsHTTPMethods(): iterable
{
yield from [
['GET'],
@ -856,7 +855,7 @@ final class IncomingRequestTest extends CIUnitTestCase
$this->assertNull($this->request->getGetPost('gc'));
}
public function providePathChecks()
public function providePathChecks(): iterable
{
return [
'not /index.php' => [

View File

@ -185,7 +185,7 @@ final class MessageTest extends CIUnitTestCase
$this->assertSame('json, html, xml', $this->message->getHeaderLine('Accept'));
}
public function provideArrayHeaderValue()
public function provideArrayHeaderValue(): iterable
{
return [
'existing for next not append' => [

View File

@ -533,7 +533,7 @@ final class RequestTest extends CIUnitTestCase
$this->assertSame($expected, $this->request->fetchGlobal('post', 'people[0]', FILTER_VALIDATE_INT));
}
public function ipAddressChecks()
public function ipAddressChecks(): iterable
{
return [
'empty' => [

View File

@ -290,7 +290,7 @@ final class ResponseTest extends CIUnitTestCase
$this->assertSame($expectedCode, $response->getStatusCode());
}
public function provideForRedirect()
public function provideForRedirect(): iterable
{
yield from [
['Apache/2.4.17', 'HTTP/1.1', 'GET', null, 302],
@ -336,7 +336,7 @@ final class ResponseTest extends CIUnitTestCase
unset($_SERVER['SERVER_SOFTWARE']);
}
public function provideForRedirectWithIIS()
public function provideForRedirectWithIIS(): iterable
{
yield from [
['HTTP/1.1', 'GET', null, 302],

View File

@ -60,12 +60,12 @@ final class SiteURITest extends CIUnitTestCase
$this->assertSame($expectedTotalSegments, $uri->getTotalSegments());
}
public function provideConstructor()
public function provideConstructor(): iterable
{
return array_merge($this->provideURIs(), $this->provideRelativePathWithQueryOrFragment());
}
public function provideURIs()
public function provideURIs(): iterable
{
return [
'' => [

View File

@ -136,7 +136,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expectedPath, $uri->getPath());
}
public function provideURLs(): array
public function provideURLs(): iterable
{
return [
'' => [
@ -413,7 +413,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expectedPath, $uri->getPath());
}
public function providePaths(): array
public function providePaths(): iterable
{
return [
'' => [
@ -469,7 +469,7 @@ final class URITest extends CIUnitTestCase
];
}
public function invalidPaths()
public function invalidPaths(): iterable
{
return [
'dot-segment' => [
@ -593,7 +593,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame('', $uri->getQuery());
}
public function authorityInfo()
public function authorityInfo(): iterable
{
return [
'host-only' => [
@ -628,7 +628,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expected, $uri->getAuthority());
}
public function defaultPorts()
public function defaultPorts(): iterable
{
return [
'http' => [
@ -667,7 +667,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($authority, $uri->getAuthority());
}
public function defaultDots()
public function defaultDots(): iterable
{
return [
[
@ -776,7 +776,7 @@ final class URITest extends CIUnitTestCase
$this->assertSame($expected, URI::removeDotSegments($path));
}
public function defaultResolutions()
public function defaultResolutions(): iterable
{
return [
[

View File

@ -320,7 +320,7 @@ final class ArrayHelperTest extends CIUnitTestCase
array_sort_by_multiple_keys($data, $sortColumns);
}
public static function deepSearchProvider()
public static function deepSearchProvider(): iterable
{
return [
[
@ -346,7 +346,7 @@ final class ArrayHelperTest extends CIUnitTestCase
];
}
public static function sortByMultipleKeysProvider()
public static function sortByMultipleKeysProvider(): iterable
{
$seed = [
0 => [

View File

@ -243,7 +243,7 @@ final class InflectorHelperTest extends CIUnitTestCase
}
}
public function provideOrdinal()
public function provideOrdinal(): iterable
{
return [
['st', 1],

View File

@ -235,7 +235,7 @@ final class CurrentUrlTest extends CIUnitTestCase
$this->assertSame('assets/image.jpg', uri_string());
}
public function urlIsProvider()
public function urlIsProvider(): iterable
{
return [
[

View File

@ -112,7 +112,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test anchor
public function anchorNormalPatterns()
public function anchorNormalPatterns(): iterable
{
return [
'normal01' => [
@ -171,7 +171,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($expected, anchor($uri, $title, $attributes, $this->config));
}
public function anchorNoindexPatterns()
public function anchorNoindexPatterns(): iterable
{
return [
'noindex01' => [
@ -238,7 +238,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($expected, anchor($uri, $title, $attributes, $this->config));
}
public function anchorSubpagePatterns()
public function anchorSubpagePatterns(): iterable
{
return [
'subpage01' => [
@ -295,7 +295,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($expected, anchor($uri, $title, $attributes, $this->config));
}
public function anchorExamplePatterns()
public function anchorExamplePatterns(): iterable
{
return [
'egpage01' => [
@ -341,7 +341,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test anchor_popup
public function anchorPopupPatterns()
public function anchorPopupPatterns(): iterable
{
return [
'normal01' => [
@ -399,7 +399,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test mailto
public function mailtoPatterns()
public function mailtoPatterns(): iterable
{
return [
'page01' => [
@ -438,7 +438,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test safe_mailto
public function safeMailtoPatterns()
public function safeMailtoPatterns(): iterable
{
return [
'page01' => [
@ -487,7 +487,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test auto_link
public function autolinkUrls()
public function autolinkUrls(): iterable
{
return [
'test01' => [
@ -536,7 +536,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($out, auto_link($in, 'url'));
}
public function autolinkEmails()
public function autolinkEmails(): iterable
{
return [
'test01' => [
@ -585,7 +585,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($out, auto_link($in, 'email'));
}
public function autolinkBoth()
public function autolinkBoth(): iterable
{
return [
'test01' => [
@ -634,7 +634,7 @@ final class MiscUrlTest extends CIUnitTestCase
$this->assertSame($out, auto_link($in));
}
public function autolinkPopup()
public function autolinkPopup(): iterable
{
return [
'test01' => [
@ -685,7 +685,7 @@ final class MiscUrlTest extends CIUnitTestCase
// Test prep_url
public function prepUrlProvider()
public function prepUrlProvider(): iterable
{
// input, expected, secure
return [
@ -854,7 +854,7 @@ final class MiscUrlTest extends CIUnitTestCase
url_to($route);
}
public function urlToProvider()
public function urlToProvider(): iterable
{
$page = config('App')->indexPage !== '' ? config('App')->indexPage . '/' : '';
@ -874,7 +874,7 @@ final class MiscUrlTest extends CIUnitTestCase
];
}
public function urlToMissingRoutesProvider()
public function urlToMissingRoutesProvider(): iterable
{
return [
[

View File

@ -81,7 +81,7 @@ final class SiteUrlTest extends CIUnitTestCase
$this->assertSame($expectedBaseUrl, base_url($path, $scheme));
}
public function configProvider()
public function configProvider(): iterable
{
// baseURL, indexPage, scheme, secure, path, expectedSiteUrl, expectedBaseUrl
return [

View File

@ -17,7 +17,6 @@ use CodeIgniter\Test\CIUnitTestCase;
use Config\App;
use DateTime;
use DateTimeZone;
use Generator;
use IntlDateFormatter;
use Locale;
@ -1159,7 +1158,7 @@ final class TimeLegacyTest extends CIUnitTestCase
$this->assertSame('2017-03-10 12:00:00', (string) $time);
}
public function provideLocales(): Generator
public function provideLocales(): iterable
{
yield from [
['en'],

View File

@ -17,7 +17,6 @@ use CodeIgniter\Test\CIUnitTestCase;
use Config\App;
use DateTime;
use DateTimeZone;
use Generator;
use IntlDateFormatter;
use Locale;
@ -1171,7 +1170,7 @@ final class TimeTest extends CIUnitTestCase
$this->assertSame('2017-03-10 12:00:00', (string) $time);
}
public function provideLocales(): Generator
public function provideLocales(): iterable
{
yield from [
['en'],

View File

@ -213,7 +213,7 @@ final class LanguageTest extends CIUnitTestCase
$this->assertSame('billions and billions', lang('Core.bazillion', [], 'en'));
}
public function MessageBundles()
public function MessageBundles(): iterable
{
return [
['CLI'],

View File

@ -14,7 +14,6 @@ namespace CodeIgniter\Models;
use CodeIgniter\Database\Exceptions\DatabaseException;
use CodeIgniter\Database\Exceptions\DataException;
use CodeIgniter\Entity\Entity;
use Generator;
use InvalidArgumentException;
use stdClass;
use Tests\Support\Models\EventModel;
@ -398,7 +397,7 @@ final class UpdateModelTest extends LiveModelTestCase
$this->model->update($id, ['name' => 'Foo Bar']);
}
public function provideInvalidIds(): Generator
public function provideInvalidIds(): iterable
{
yield from [
[

View File

@ -69,7 +69,7 @@ final class PublisherRestrictionsTest extends CIUnitTestCase
$this->assertSame($expected, $errors[$file]->getMessage());
}
public function fileProvider()
public function fileProvider(): iterable
{
yield from [
'php' => ['index.php'],
@ -99,7 +99,7 @@ final class PublisherRestrictionsTest extends CIUnitTestCase
$this->assertInstanceOf(Publisher::class, $publisher);
}
public function destinationProvider()
public function destinationProvider(): iterable
{
return [
'explicit' => [

View File

@ -16,7 +16,6 @@ use CodeIgniter\Router\Exceptions\RouterException;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Modules;
use Config\Routing;
use Generator;
/**
* @internal
@ -122,7 +121,7 @@ final class RouteCollectionReverseRouteTest extends CIUnitTestCase
$this->assertSame('/en/contact', $routes->reverseRoute('myController::goto'));
}
public function reverseRoutingHandlerProvider(): Generator
public function reverseRoutingHandlerProvider(): iterable
{
return yield from [
'Omit namespace' => ['Galleries::showUserGallery'],

View File

@ -409,7 +409,7 @@ final class RouteCollectionTest extends CIUnitTestCase
$this->assertSame($expected, $routes->getRoutes());
}
public function groupProvider()
public function groupProvider(): iterable
{
yield from [
['admin', '/', [
@ -1246,7 +1246,7 @@ final class RouteCollectionTest extends CIUnitTestCase
$this->assertSame($options, $options1);
}
public function optionsProvider()
public function optionsProvider(): iterable
{
yield from [
[
@ -1661,7 +1661,7 @@ final class RouteCollectionTest extends CIUnitTestCase
$this->assertSame($expects, $router->handle('/0'));
}
public function provideRouteDefaultNamespace()
public function provideRouteDefaultNamespace(): iterable
{
return [
'with \\ prefix' => ['\App\Controllers'],

View File

@ -875,7 +875,7 @@ final class RouterTest extends CIUnitTestCase
$router->handle($url);
}
public function provideRedirectCase(): array
public function provideRedirectCase(): iterable
{
// [$route, $redirectFrom, $redirectTo, $url, $expectedPath, $alias]
return [

View File

@ -79,7 +79,7 @@ final class DOMParserTest extends CIUnitTestCase
$this->assertSame(['href' => 'http://example.com'], $selector['attr']);
}
public function provideText()
public function provideText(): iterable
{
return [
'en' => ['Hello World'],

View File

@ -302,7 +302,7 @@ final class FeatureTestTraitTest extends CIUnitTestCase
$this->get('0');
}
public function provideRoutesData()
public function provideRoutesData(): iterable
{
return [
'non parameterized cli' => [

View File

@ -46,7 +46,7 @@ final class TestResponseTest extends CIUnitTestCase
/**
* Provides status codes and their expected "OK"
*/
public function statusCodeProvider(): array
public function statusCodeProvider(): iterable
{
return [
[

View File

@ -208,7 +208,7 @@ final class ThrottleTest extends CIUnitTestCase
}
}
public function tokenTimeUsecases(): array
public function tokenTimeUsecases(): iterable
{
return [
'2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [

View File

@ -13,7 +13,6 @@ namespace CodeIgniter\Validation;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Services;
use Generator;
use Tests\Support\Validation\TestRules;
/**
@ -64,7 +63,7 @@ final class CreditCardRulesTest extends CIUnitTestCase
*
* @see https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm
*/
public function creditCardProvider(): Generator
public function creditCardProvider(): iterable
{
yield from [
'null_test' => [

View File

@ -129,7 +129,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertFalse($this->validation->run($data));
}
public function urlProvider(): Generator
public function urlProvider(): iterable
{
yield from [
[
@ -260,7 +260,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function emailProviderSingle(): Generator
public function emailProviderSingle(): iterable
{
yield from [
[
@ -278,7 +278,7 @@ class FormatRulesTest extends CIUnitTestCase
];
}
public function emailsProvider(): Generator
public function emailsProvider(): iterable
{
yield from [
[
@ -324,7 +324,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function ipProvider(): Generator
public function ipProvider(): iterable
{
yield from [
[
@ -393,7 +393,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function stringProvider(): Generator
public function stringProvider(): iterable
{
yield from [
[
@ -427,7 +427,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function alphaProvider(): Generator
public function alphaProvider(): iterable
{
yield from [
[
@ -469,7 +469,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function alphaSpaceProvider(): Generator
public function alphaSpaceProvider(): iterable
{
yield from [
[
@ -515,7 +515,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function alphaNumericProvider(): Generator
public function alphaNumericProvider(): iterable
{
yield from [
[
@ -553,7 +553,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function alphaNumericPunctProvider(): Generator
public function alphaNumericPunctProvider(): iterable
{
yield from [
[
@ -685,7 +685,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function alphaDashProvider(): Generator
public function alphaDashProvider(): iterable
{
yield from [
[
@ -723,7 +723,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function hexProvider(): Generator
public function hexProvider(): iterable
{
yield from [
[
@ -761,7 +761,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function numericProvider(): Generator
public function numericProvider(): iterable
{
yield from [
[
@ -837,7 +837,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertsame($expected, $this->validation->run($data));
}
public function integerInvalidTypeDataProvider(): Generator
public function integerInvalidTypeDataProvider(): iterable
{
// TypeError : CodeIgniter\Validation\FormatRules::integer(): Argument #1 ($str) must be of type ?string, array given
// yield 'array with int' => [
@ -883,7 +883,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function integerProvider(): Generator
public function integerProvider(): iterable
{
yield from [
[
@ -937,7 +937,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function decimalProvider(): Generator
public function decimalProvider(): iterable
{
yield from [
[
@ -995,7 +995,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function naturalProvider(): Generator
public function naturalProvider(): iterable
{
yield from [
[
@ -1037,7 +1037,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function naturalZeroProvider(): Generator
public function naturalZeroProvider(): iterable
{
yield from [
[
@ -1079,7 +1079,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function base64Provider(): Generator
public function base64Provider(): iterable
{
yield from [
[
@ -1113,7 +1113,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function jsonProvider(): Generator
public function jsonProvider(): iterable
{
yield from [
[
@ -1171,7 +1171,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function timezoneProvider(): Generator
public function timezoneProvider(): iterable
{
yield from [
[
@ -1209,7 +1209,7 @@ class FormatRulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function validDateProvider(): Generator
public function validDateProvider(): iterable
{
yield from [
[

View File

@ -13,7 +13,6 @@ namespace CodeIgniter\Validation;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Services;
use Generator;
use stdClass;
use Tests\Support\Validation\TestRules;
@ -61,7 +60,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideRequiredCases(): Generator
public function provideRequiredCases(): iterable
{
yield from [
[['foo' => null], false],
@ -82,7 +81,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function ifExistProvider(): Generator
public function ifExistProvider(): iterable
{
yield from [
[
@ -135,7 +134,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function providePermitEmptyCases(): Generator
public function providePermitEmptyCases(): iterable
{
yield from [
// If the rule is only `permit_empty`, any value will pass.
@ -299,7 +298,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideMatchesCases(): Generator
public function provideMatchesCases(): iterable
{
yield from [
[['foo' => null, 'bar' => null], true],
@ -317,7 +316,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideMatchesNestedCases(): Generator
public function provideMatchesNestedCases(): iterable
{
yield from [
[['nested' => ['foo' => 'match', 'bar' => 'match']], true],
@ -352,7 +351,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function provideEqualsCases(): Generator
public function provideEqualsCases(): iterable
{
yield from [
'null' => [['foo' => null], '', false],
@ -372,7 +371,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run(['foo' => $data]));
}
public function provideMinLengthCases(): Generator
public function provideMinLengthCases(): iterable
{
yield from [
'null' => [null, '2', false],
@ -406,7 +405,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run(['foo' => $data]));
}
public function provideExactLengthCases(): Generator
public function provideExactLengthCases(): iterable
{
yield from [
'null' => [null, false],
@ -433,7 +432,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function greaterThanProvider(): Generator
public function greaterThanProvider(): iterable
{
yield from [
['-10', '-11', true],
@ -458,7 +457,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function greaterThanEqualProvider(): Generator
public function greaterThanEqualProvider(): iterable
{
yield from [
['0', '0', true],
@ -484,7 +483,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function lessThanProvider(): Generator
public function lessThanProvider(): iterable
{
yield from [
['-10', '-11', false],
@ -510,7 +509,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function lessThanEqualProvider(): Generator
public function lessThanEqualProvider(): iterable
{
yield from [
['0', '0', true],
@ -546,7 +545,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame(! $expected, $this->validation->run($data));
}
public function inListProvider(): Generator
public function inListProvider(): iterable
{
yield from [
['red', 'red,Blue,123', true],
@ -582,7 +581,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function requiredWithProvider(): Generator
public function requiredWithProvider(): iterable
{
yield from [
['nope', 'bar', false],
@ -630,7 +629,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $result);
}
public function RequiredWithAndOtherRulesProvider(): Generator
public function RequiredWithAndOtherRulesProvider(): iterable
{
yield from [
// `otherField` and `mustBeADate` do not exist
@ -667,7 +666,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $result);
}
public function RequiredWithAndOtherRuleWithValueZeroProvider(): Generator
public function RequiredWithAndOtherRuleWithValueZeroProvider(): iterable
{
yield from [
[true, ['married' => '0', 'partner_name' => '']],
@ -697,7 +696,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function requiredWithoutProvider(): Generator
public function requiredWithoutProvider(): iterable
{
yield from [
['nope', 'bars', false],
@ -743,7 +742,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($result, $this->validation->run($data));
}
public function requiredWithoutMultipleProvider(): Generator
public function requiredWithoutMultipleProvider(): iterable
{
yield from [
'all empty' => [
@ -789,7 +788,7 @@ class RulesTest extends CIUnitTestCase
$this->assertSame($result, $this->validation->run($data));
}
public function requiredWithoutMultipleWithoutFieldsProvider(): Generator
public function requiredWithoutMultipleWithoutFieldsProvider(): iterable
{
yield from [
'baz is missing' => [

View File

@ -14,7 +14,6 @@ namespace CodeIgniter\Validation\StrictRules;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Validation\Validation;
use Config\Services;
use Generator;
use Tests\Support\Validation\TestRules;
/**
@ -65,7 +64,7 @@ final class CreditCardRulesTest extends CIUnitTestCase
*
* @see https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm
*/
public function creditCardProvider(): Generator
public function creditCardProvider(): iterable
{
yield from [
'null_test' => [

View File

@ -13,7 +13,6 @@ namespace CodeIgniter\Validation\StrictRules;
use CodeIgniter\Validation\RulesTest as TraditionalRulesTest;
use CodeIgniter\Validation\Validation;
use Generator;
use Tests\Support\Validation\TestRules;
/**
@ -51,7 +50,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function providePermitEmptyCasesStrict(): Generator
public function providePermitEmptyCasesStrict(): iterable
{
yield from [
[
@ -106,7 +105,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideGreaterThanEqualStrict(): Generator
public function provideGreaterThanEqualStrict(): iterable
{
yield from [
[0, '0', true],
@ -132,7 +131,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideGreaterThanStrict(): Generator
public function provideGreaterThanStrict(): iterable
{
yield from [
[-10, '-11', true],
@ -159,7 +158,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideLessThanStrict(): Generator
public function provideLessThanStrict(): iterable
{
yield from [
[-10, '-11', false],
@ -187,7 +186,7 @@ final class RulesTest extends TraditionalRulesTest
$this->assertSame($expected, $this->validation->run($data));
}
public function provideLessThanEqualStrict(): Generator
public function provideLessThanEqualStrict(): iterable
{
yield from [
[0, '0', true],

View File

@ -18,7 +18,6 @@ use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Config\App;
use Config\Services;
use Generator;
use PHPUnit\Framework\ExpectationFailedException;
use Tests\Support\Validation\TestRules;
use TypeError;
@ -344,7 +343,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function arrayDataProvider(): Generator
public function arrayDataProvider(): iterable
{
yield 'list array' => [
[1, 2, 3, 4, 5],
@ -396,7 +395,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->run($data));
}
public function isIntInvalidTypeDataProvider(): Generator
public function isIntInvalidTypeDataProvider(): iterable
{
yield 'array with int' => [
[555],
@ -635,7 +634,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $this->validation->getError('foo'));
}
public function rulesSetupProvider(): Generator
public function rulesSetupProvider(): iterable
{
yield from [
[
@ -987,7 +986,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($results, $this->validation->getErrors());
}
public function arrayFieldDataProvider(): Generator
public function arrayFieldDataProvider(): iterable
{
yield from [
'all_rules_should_pass' => [
@ -1223,7 +1222,7 @@ class ValidationTest extends CIUnitTestCase
$this->assertSame($expected, $actual);
}
public function dotNotationForIfExistProvider(): Generator
public function dotNotationForIfExistProvider(): iterable
{
yield 'dot-on-end-fail' => [
false,

View File

@ -418,7 +418,7 @@ final class ParserTest extends CIUnitTestCase
$this->assertSame($result, $this->parser->renderString($template));
}
public function escValueTypes()
public function escValueTypes(): iterable
{
return [
'scalar' => [42],

View File

@ -94,7 +94,7 @@ Service Accessors
If $data is a string, then it simply escapes and returns it.
If $data is an array, then it loops over it, escaping each 'value' of the key/value pairs.
Valid context values: html, js, css, url, attr, raw
Valid context values: ``html``, ``js``, ``css``, ``url``, ``attr``, ``raw``
.. php:function:: helper($filename)
@ -132,10 +132,10 @@ Service Accessors
.. php:function:: old($key[, $default = null,[, $escape = 'html']])
:param string $key: The name of the old form data to check for.
:param mixed $default: The default value to return if $key doesn't exist.
:param mixed $escape: An `escape <#esc>`_ context or false to disable it.
:param string|null $default: The default value to return if $key doesn't exist.
:param false|string $escape: An `escape <#esc>`_ context or false to disable it.
:returns: The value of the defined key, or the default value.
:rtype: mixed
:rtype: array|string|null
Provides a simple way to access "old input data" from submitting a form.
@ -143,8 +143,10 @@ Service Accessors
.. literalinclude:: common_functions/002.php
.. note:: If you are using the :doc:`form helper </helpers/form_helper>`, this feature is built-in. You only
need to use this function when not using the form helper.
.. note:: If you are using the :php:func:`set_value()`, :php:func:`set_select()`,
:php:func:`set_checkbox()`, and :php:func:`set_radio()` functions in
:doc:`form helper </helpers/form_helper>`, this feature is built-in. You only
need to use this function when not using the form helper.
.. php:function:: session([$key])

View File

@ -2,8 +2,7 @@
// in controller, checking form submittal
if (! $model->save($user)) {
// 'withInput' is what specifies "old data"
// should be saved.
// 'withInput()' is what specifies "old data" should be saved.
return redirect()->back()->withInput();
}