From ac87a1e094028f56f9dfa378173a9f50af94bf00 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 17 Jul 2023 16:30:13 +0800 Subject: [PATCH] Configure `php_unit_data_provider_return_type` fixer --- .php-cs-fixer.dist.php | 4 +- .php-cs-fixer.no-header.php | 4 +- .php-cs-fixer.user-guide.php | 9 ++-- tests/system/CLI/CLITest.php | 2 +- .../system/Cache/Handlers/BaseHandlerTest.php | 2 +- .../system/Cache/Handlers/FileHandlerTest.php | 2 +- tests/system/CodeIgniterTest.php | 2 +- tests/system/Commands/CommandTest.php | 2 +- .../Routes/SampleURIGeneratorTest.php | 3 +- tests/system/CommonFunctionsTest.php | 2 +- tests/system/Config/MimesTest.php | 4 +- tests/system/Cookie/CookieTest.php | 3 +- tests/system/Database/BaseConnectionTest.php | 3 +- tests/system/Database/BaseQueryTest.php | 4 +- tests/system/Database/Builder/WhereTest.php | 4 +- tests/system/Database/ConfigTest.php | 3 +- tests/system/Email/EmailTest.php | 2 +- tests/system/Filters/FiltersTest.php | 2 +- tests/system/Filters/InvalidCharsTest.php | 4 +- tests/system/Format/XMLFormatterTest.php | 2 +- tests/system/HTTP/CLIRequestTest.php | 2 +- tests/system/HTTP/IncomingRequestTest.php | 7 ++-- tests/system/HTTP/MessageTest.php | 2 +- tests/system/HTTP/RequestTest.php | 2 +- tests/system/HTTP/ResponseTest.php | 4 +- tests/system/HTTP/URITest.php | 14 +++---- tests/system/Helpers/ArrayHelperTest.php | 4 +- tests/system/Helpers/InflectorHelperTest.php | 2 +- .../Helpers/URLHelper/CurrentUrlTest.php | 2 +- .../system/Helpers/URLHelper/MiscUrlTest.php | 28 ++++++------- .../system/Helpers/URLHelper/SiteUrlTest.php | 2 +- tests/system/I18n/TimeLegacyTest.php | 3 +- tests/system/I18n/TimeTest.php | 3 +- tests/system/Language/LanguageTest.php | 2 +- tests/system/Models/UpdateModelTest.php | 3 +- .../Publisher/PublisherRestrictionsTest.php | 4 +- .../RouteCollectionReverseRouteTest.php | 3 +- tests/system/Router/RouteCollectionTest.php | 6 +-- tests/system/Router/RouterTest.php | 2 +- tests/system/Test/DOMParserTest.php | 2 +- tests/system/Test/FeatureTestTraitTest.php | 2 +- tests/system/Test/TestResponseTest.php | 2 +- tests/system/Throttle/ThrottleTest.php | 2 +- .../system/Validation/CreditCardRulesTest.php | 3 +- tests/system/Validation/FormatRulesTest.php | 42 +++++++++---------- tests/system/Validation/RulesTest.php | 39 +++++++++-------- .../StrictRules/CreditCardRulesTest.php | 3 +- .../Validation/StrictRules/RulesTest.php | 11 +++-- tests/system/Validation/ValidationTest.php | 11 +++-- tests/system/View/ParserTest.php | 2 +- 50 files changed, 134 insertions(+), 143 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 3653cf1349c2..928f5b801071 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -43,7 +43,9 @@ __DIR__ . '/spark', ]); -$overrides = []; +$overrides = [ + 'php_unit_data_provider_return_type' => true, +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.cache', diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 7c9ae1e80737..954a06ec0230 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -29,7 +29,9 @@ __DIR__ . '/admin/starter/builds', ]); -$overrides = []; +$overrides = [ + 'php_unit_data_provider_return_type' => true, +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index a3ae78a48232..c15d0dcca006 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -29,10 +29,11 @@ ]); $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 = [ diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 0e8ed4db73a3..3068328aa9a8 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -463,7 +463,7 @@ public function testTable($tbody, $thead, $expected) $this->assertSame($this->getStreamFilterBuffer(), $expected); } - public function tableProvider() + public function tableProvider(): iterable { $head = [ 'ID', diff --git a/tests/system/Cache/Handlers/BaseHandlerTest.php b/tests/system/Cache/Handlers/BaseHandlerTest.php index 9ece2ba2ddaf..ba1dd0b2491f 100644 --- a/tests/system/Cache/Handlers/BaseHandlerTest.php +++ b/tests/system/Cache/Handlers/BaseHandlerTest.php @@ -35,7 +35,7 @@ public function testValidateKeyInvalidType($input) BaseHandler::validateKey($input); } - public function invalidTypeProvider(): array + public function invalidTypeProvider(): iterable { return [ [true], diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index 4f354495c81a..6f5e6b82f8c5 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -296,7 +296,7 @@ public function testSaveMode(int $int, string $string): void $this->assertSame($string, $mode); } - public function modeProvider() + public function modeProvider(): iterable { return [ [ diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index 9d3343bfbaa1..ae88e6f2f3a1 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -789,7 +789,7 @@ public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $e CITestStreamFilter::removeErrorFilter(); } - public function cacheQueryStringProvider(): array + public function cacheQueryStringProvider(): iterable { $testingUrls = [ 'test', // URL #1 diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index 23323933e5c9..1101e08ef5b6 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -138,7 +138,7 @@ public function testCommandParsesArgsCorrectly(string $input, array $expected) $this->assertSame($expected, ParamsReveal::$args); } - public function commandArgsProvider(): array + public function commandArgsProvider(): iterable { return [ [ diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index 4b7b8fa3e814..fe7bf12613a7 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; -use Generator; /** * @internal @@ -34,7 +33,7 @@ public function testGet(string $routeKey, string $expected) $this->assertSame($expected, $uri); } - public function routeKeyProvider(): Generator + public function routeKeyProvider(): iterable { yield from [ 'root' => ['/', '/'], diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index a0b5280ec6bc..b304eeab69eb 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -604,7 +604,7 @@ public function testCleanPathActuallyCleaningThePaths($input, $expected) $this->assertSame($expected, clean_path($input)); } - public function dirtyPathsProvider() + public function dirtyPathsProvider(): iterable { $ds = DIRECTORY_SEPARATOR; diff --git a/tests/system/Config/MimesTest.php b/tests/system/Config/MimesTest.php index 4cbd09958238..1ff85dffefec 100644 --- a/tests/system/Config/MimesTest.php +++ b/tests/system/Config/MimesTest.php @@ -21,7 +21,7 @@ */ final class MimesTest extends CIUnitTestCase { - public function extensionsList() + public function extensionsList(): iterable { return [ 'null' => [ @@ -55,7 +55,7 @@ public function testGuessExtensionFromType(?string $expected, string $mime) $this->assertSame($expected, Mimes::guessExtensionFromType($mime)); } - public function mimesList() + public function mimesList(): iterable { return [ 'null' => [ diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index 86d01305d696..c69fb1b806d2 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -16,7 +16,6 @@ use Config\Cookie as CookieConfig; use DateTimeImmutable; use DateTimeZone; -use Generator; use LogicException; /** @@ -99,7 +98,7 @@ public function testConfigPrefix(string $configPrefix, string $optionPrefix, str $this->assertSame($expected, $cookie->getPrefixedName()); } - public function prefixProvider(): Generator + public function prefixProvider(): iterable { yield from [ ['prefix_', '', 'prefix_test'], diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 300e7f7fe5e0..ee59f55d6f2a 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -14,7 +14,6 @@ use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; -use Generator; use Throwable; /** @@ -184,7 +183,7 @@ public function testProtectIdentifiers( $this->assertSame($expected, $return); } - public function identifiersProvider(): Generator + public function identifiersProvider(): iterable { yield from [ // $prefixSingle, $protectIdentifiers, $fieldExists, $item, $expected diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php index 273c52491c15..c25d1cefec69 100644 --- a/tests/system/Database/BaseQueryTest.php +++ b/tests/system/Database/BaseQueryTest.php @@ -104,7 +104,7 @@ public function testSwapPrefix() $this->assertSame($newSQL, $query->getQuery()); } - public function queryTypes() + public function queryTypes(): iterable { return [ 'select' => [ @@ -577,7 +577,7 @@ public function testSwapPrefixAfterGetQuery() $this->assertSame($expected, $query->getQuery()); } - public function queryKeywords() + public function queryKeywords(): iterable { return [ 'highlightKeyWords' => [ diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index b4a1b90a59f4..df0a778f3c39 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -392,7 +392,7 @@ public function testWhereInSubQuery() $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } - public function provideInvalidKeys() + public function provideInvalidKeys(): iterable { return [ 'null' => [null], @@ -413,7 +413,7 @@ public function testWhereInvalidKeyThrowInvalidArgumentException($key) $builder->whereIn($key, ['Politician', 'Accountant']); } - public function provideInvalidValues() + public function provideInvalidValues(): iterable { return [ 'null' => [null], diff --git a/tests/system/Database/ConfigTest.php b/tests/system/Database/ConfigTest.php index 3e963749dd57..31d2e54a8e9c 100644 --- a/tests/system/Database/ConfigTest.php +++ b/tests/system/Database/ConfigTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\ReflectionHelper; -use Generator; /** * @internal @@ -209,7 +208,7 @@ public function testConvertDSN(string $input, string $expected) $this->assertSame($expected, $this->getPrivateProperty($conn, 'DSN')); } - public function convertDSNProvider(): Generator + public function convertDSNProvider(): iterable { yield from [ [ diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index d329e60103d2..cff60c7f9e0b 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -32,7 +32,7 @@ public function testEmailValidation() $this->assertStringContainsString('Invalid email address: "invalid"', $email->printDebugger()); } - public function autoClearProvider() + public function autoClearProvider(): iterable { return [ 'autoclear' => [true], diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index f111f4b957f6..80bd9cbbf0ca 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -208,7 +208,7 @@ public function testProcessMethodProcessGlobals() $this->assertSame($expected, $filters->initialize()->getFilters()); } - public function provideExcept() + public function provideExcept(): iterable { return [ [ diff --git a/tests/system/Filters/InvalidCharsTest.php b/tests/system/Filters/InvalidCharsTest.php index becc601d816a..705d3bb70f0e 100644 --- a/tests/system/Filters/InvalidCharsTest.php +++ b/tests/system/Filters/InvalidCharsTest.php @@ -124,7 +124,7 @@ public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $this->invalidChars->before($this->request); } - public function stringWithLineBreakAndTabProvider() + public function stringWithLineBreakAndTabProvider(): iterable { yield from [ ["String contains \n line break."], @@ -148,7 +148,7 @@ public function testCheckControlStringWithControlCharsCausesException(string $in $this->invalidChars->before($this->request); } - public function stringWithControlCharsProvider() + public function stringWithControlCharsProvider(): iterable { yield from [ ["String contains null char.\0"], diff --git a/tests/system/Format/XMLFormatterTest.php b/tests/system/Format/XMLFormatterTest.php index c642d7e77eca..a97b108b088d 100644 --- a/tests/system/Format/XMLFormatterTest.php +++ b/tests/system/Format/XMLFormatterTest.php @@ -115,7 +115,7 @@ public function testValidatingInvalidTags(string $expected, array $input) $this->assertSame($expectedXML, $this->xmlFormatter->format($input)); } - public function invalidTagsProvider() + public function invalidTagsProvider(): iterable { return [ [ diff --git a/tests/system/HTTP/CLIRequestTest.php b/tests/system/HTTP/CLIRequestTest.php index 574a9f48c26d..69106adf2219 100644 --- a/tests/system/HTTP/CLIRequestTest.php +++ b/tests/system/HTTP/CLIRequestTest.php @@ -517,7 +517,7 @@ public function testFetchGlobalWithEmptyNotation() $this->assertSame($expected, $this->request->fetchGlobal('post', 'clients[]')); } - public function ipAddressChecks() + public function ipAddressChecks(): iterable { return [ 'empty' => [ diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index f6994f722ce9..b4ab3606ed8b 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -16,7 +16,6 @@ use CodeIgniter\HTTP\Files\UploadedFile; use CodeIgniter\Test\CIUnitTestCase; use Config\App; -use Generator; use InvalidArgumentException; use TypeError; @@ -519,7 +518,7 @@ public function testCanGrabGetRawInput() $this->assertSame($expected, $request->getRawInput()); } - public function provideRawInputVarChecks() + public function provideRawInputVarChecks(): iterable { return [ [ @@ -627,7 +626,7 @@ public function testIsHTTPMethodLowerCase(string $value) $this->assertTrue($request->is(strtolower($value))); } - public function provideIsHTTPMethods(): Generator + public function provideIsHTTPMethods(): iterable { yield from [ ['GET'], @@ -840,7 +839,7 @@ public function testGetPostIndexNotExists() $this->assertNull($this->request->getGetPost('gc')); } - public function providePathChecks() + public function providePathChecks(): iterable { return [ 'not /index.php' => [ diff --git a/tests/system/HTTP/MessageTest.php b/tests/system/HTTP/MessageTest.php index 8f96b267ad1e..86e870d3b073 100644 --- a/tests/system/HTTP/MessageTest.php +++ b/tests/system/HTTP/MessageTest.php @@ -185,7 +185,7 @@ public function testSetHeaderArrayValues() $this->assertSame('json, html, xml', $this->message->getHeaderLine('Accept')); } - public function provideArrayHeaderValue() + public function provideArrayHeaderValue(): iterable { return [ 'existing for next not append' => [ diff --git a/tests/system/HTTP/RequestTest.php b/tests/system/HTTP/RequestTest.php index 17cf45078fe0..ab19f05adfac 100644 --- a/tests/system/HTTP/RequestTest.php +++ b/tests/system/HTTP/RequestTest.php @@ -532,7 +532,7 @@ public function testFetchGlobalFiltersWithArrayChildElement() $this->assertSame($expected, $this->request->fetchGlobal('post', 'people[0]', FILTER_VALIDATE_INT)); } - public function ipAddressChecks() + public function ipAddressChecks(): iterable { return [ 'empty' => [ diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index eb95ab3a33cc..ce320417748c 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -291,7 +291,7 @@ public function testRedirect( $this->assertSame($expectedCode, $response->getStatusCode()); } - public function provideForRedirect() + public function provideForRedirect(): iterable { yield from [ ['Apache/2.4.17', 'HTTP/1.1', 'GET', null, 302], @@ -337,7 +337,7 @@ public function testRedirectWithIIS( unset($_SERVER['SERVER_SOFTWARE']); } - public function provideForRedirectWithIIS() + public function provideForRedirectWithIIS(): iterable { yield from [ ['HTTP/1.1', 'GET', null, 302], diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index c9d6bb97f5d9..c65a363ac21e 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -136,7 +136,7 @@ public function testSimpleUri(string $url, string $expectedURL, string $expected $this->assertSame($expectedPath, $uri->getPath()); } - public function provideURLs(): array + public function provideURLs(): iterable { return [ '' => [ @@ -375,7 +375,7 @@ public function testSetPath(string $path, string $expectedURL, string $expectedP $this->assertSame($expectedPath, $uri->getPath()); } - public function providePaths(): array + public function providePaths(): iterable { return [ '' => [ @@ -431,7 +431,7 @@ public function providePaths(): array ]; } - public function invalidPaths() + public function invalidPaths(): iterable { return [ 'dot-segment' => [ @@ -555,7 +555,7 @@ public function testSetQueryThrowsErrorWhenFragmentPresentSilent() $this->assertSame('', $uri->getQuery()); } - public function authorityInfo() + public function authorityInfo(): iterable { return [ 'host-only' => [ @@ -590,7 +590,7 @@ public function testAuthorityReturnsExceptedValues($url, $expected) $this->assertSame($expected, $uri->getAuthority()); } - public function defaultPorts() + public function defaultPorts(): iterable { return [ 'http' => [ @@ -629,7 +629,7 @@ public function testSetAuthorityReconstitutes() $this->assertSame($authority, $uri->getAuthority()); } - public function defaultDots() + public function defaultDots(): iterable { return [ [ @@ -738,7 +738,7 @@ public function testRemoveDotSegments($path, $expected) $this->assertSame($expected, URI::removeDotSegments($path)); } - public function defaultResolutions() + public function defaultResolutions(): iterable { return [ [ diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index a2db5b06e7d7..0202c8c8bf3c 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -320,7 +320,7 @@ public function testArraySortByMultipleKeysFailsInconsistentArraySizes($data) array_sort_by_multiple_keys($data, $sortColumns); } - public static function deepSearchProvider() + public static function deepSearchProvider(): iterable { return [ [ @@ -346,7 +346,7 @@ public static function deepSearchProvider() ]; } - public static function sortByMultipleKeysProvider() + public static function sortByMultipleKeysProvider(): iterable { $seed = [ 0 => [ diff --git a/tests/system/Helpers/InflectorHelperTest.php b/tests/system/Helpers/InflectorHelperTest.php index 42b55b661787..53f4ecfb5e80 100755 --- a/tests/system/Helpers/InflectorHelperTest.php +++ b/tests/system/Helpers/InflectorHelperTest.php @@ -243,7 +243,7 @@ public function testDasherize() } } - public function provideOrdinal() + public function provideOrdinal(): iterable { return [ ['st', 1], diff --git a/tests/system/Helpers/URLHelper/CurrentUrlTest.php b/tests/system/Helpers/URLHelper/CurrentUrlTest.php index faee0608b54f..204a684aa857 100644 --- a/tests/system/Helpers/URLHelper/CurrentUrlTest.php +++ b/tests/system/Helpers/URLHelper/CurrentUrlTest.php @@ -235,7 +235,7 @@ public function testUriStringSubfolderRelative() $this->assertSame('assets/image.jpg', uri_string()); } - public function urlIsProvider() + public function urlIsProvider(): iterable { return [ [ diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index b943722d3908..af3869dcafee 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -112,7 +112,7 @@ public function testIndexPageAlt() // Test anchor - public function anchorNormalPatterns() + public function anchorNormalPatterns(): iterable { return [ 'normal01' => [ @@ -171,7 +171,7 @@ public function testAnchor($expected = '', $uri = '', $title = '', $attributes = $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorNoindexPatterns() + public function anchorNoindexPatterns(): iterable { return [ 'noindex01' => [ @@ -238,7 +238,7 @@ public function testAnchorNoindex($expected = '', $uri = '', $title = '', $attri $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorSubpagePatterns() + public function anchorSubpagePatterns(): iterable { return [ 'subpage01' => [ @@ -295,7 +295,7 @@ public function testAnchorTargetted($expected = '', $uri = '', $title = '', $att $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorExamplePatterns() + public function anchorExamplePatterns(): iterable { return [ 'egpage01' => [ @@ -341,7 +341,7 @@ public function testAnchorExamples($expected = '', $uri = '', $title = '', $attr // Test anchor_popup - public function anchorPopupPatterns() + public function anchorPopupPatterns(): iterable { return [ 'normal01' => [ @@ -399,7 +399,7 @@ public function testAnchorPopup($expected = '', $uri = '', $title = '', $attribu // Test mailto - public function mailtoPatterns() + public function mailtoPatterns(): iterable { return [ 'page01' => [ @@ -438,7 +438,7 @@ public function testMailto($expected = '', $email = '', $title = '', $attributes // Test safe_mailto - public function safeMailtoPatterns() + public function safeMailtoPatterns(): iterable { return [ 'page01' => [ @@ -487,7 +487,7 @@ public function testSafeMailtoWithCsp() // Test auto_link - public function autolinkUrls() + public function autolinkUrls(): iterable { return [ 'test01' => [ @@ -536,7 +536,7 @@ public function testAutoLinkUrl($in, $out) $this->assertSame($out, auto_link($in, 'url')); } - public function autolinkEmails() + public function autolinkEmails(): iterable { return [ 'test01' => [ @@ -585,7 +585,7 @@ public function testAutoLinkEmail($in, $out) $this->assertSame($out, auto_link($in, 'email')); } - public function autolinkBoth() + public function autolinkBoth(): iterable { return [ 'test01' => [ @@ -634,7 +634,7 @@ public function testAutolinkBoth($in, $out) $this->assertSame($out, auto_link($in)); } - public function autolinkPopup() + public function autolinkPopup(): iterable { return [ 'test01' => [ @@ -685,7 +685,7 @@ public function testAutoLinkPopup($in, $out) // Test prep_url - public function prepUrlProvider() + public function prepUrlProvider(): iterable { // input, expected, secure return [ @@ -854,7 +854,7 @@ public function testUrlToThrowsOnEmptyOrMissingRoute(string $route) url_to($route); } - public function urlToProvider() + public function urlToProvider(): iterable { $page = config('App')->indexPage !== '' ? config('App')->indexPage . '/' : ''; @@ -874,7 +874,7 @@ public function urlToProvider() ]; } - public function urlToMissingRoutesProvider() + public function urlToMissingRoutesProvider(): iterable { return [ [ diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index acc2643b75ab..6017f3047790 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -81,7 +81,7 @@ public function testUrls( $this->assertSame($expectedBaseUrl, base_url($path, $scheme)); } - public function configProvider() + public function configProvider(): iterable { // baseURL, indexPage, scheme, secure, path, expectedSiteUrl, expectedBaseUrl return [ diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index 8fb19f6582ce..281970a8aa9d 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -17,7 +17,6 @@ use Config\App; use DateTime; use DateTimeZone; -use Generator; use IntlDateFormatter; use Locale; @@ -1159,7 +1158,7 @@ public function testToStringDoesNotDependOnLocale(string $locale) $this->assertSame('2017-03-10 12:00:00', (string) $time); } - public function provideLocales(): Generator + public function provideLocales(): iterable { yield from [ ['en'], diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index 8db1edd4207b..0b619600d550 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -17,7 +17,6 @@ use Config\App; use DateTime; use DateTimeZone; -use Generator; use IntlDateFormatter; use Locale; @@ -1171,7 +1170,7 @@ public function testToStringDoesNotDependOnLocale(string $locale) $this->assertSame('2017-03-10 12:00:00', (string) $time); } - public function provideLocales(): Generator + public function provideLocales(): iterable { yield from [ ['en'], diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index 8006ad6cf133..7f89baaa37b8 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -213,7 +213,7 @@ public function testPrioritizedLocator() $this->assertSame('billions and billions', lang('Core.bazillion', [], 'en')); } - public function MessageBundles() + public function MessageBundles(): iterable { return [ ['CLI'], diff --git a/tests/system/Models/UpdateModelTest.php b/tests/system/Models/UpdateModelTest.php index 7a32626aeb42..bd57025dc87f 100644 --- a/tests/system/Models/UpdateModelTest.php +++ b/tests/system/Models/UpdateModelTest.php @@ -14,7 +14,6 @@ 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 @@ public function testUpdateThrowDatabaseExceptionWithoutWhereClause($id, string $ $this->model->update($id, ['name' => 'Foo Bar']); } - public function provideInvalidIds(): Generator + public function provideInvalidIds(): iterable { yield from [ [ diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index 7c6c9788768b..f351a1791a73 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -69,7 +69,7 @@ public function testDefaultPublicRestrictions(string $path) $this->assertSame($expected, $errors[$file]->getMessage()); } - public function fileProvider() + public function fileProvider(): iterable { yield from [ 'php' => ['index.php'], @@ -99,7 +99,7 @@ public function testDestinations(string $destination, bool $allowed) $this->assertInstanceOf(Publisher::class, $publisher); } - public function destinationProvider() + public function destinationProvider(): iterable { return [ 'explicit' => [ diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index 2e6de5aacdf7..4f0e37c94c82 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -15,7 +15,6 @@ use CodeIgniter\Router\Exceptions\RouterException; use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; -use Generator; /** * @internal @@ -121,7 +120,7 @@ public function testReverseRoutingWithLocale() $this->assertSame('/en/contact', $routes->reverseRoute('myController::goto')); } - public function reverseRoutingHandlerProvider(): Generator + public function reverseRoutingHandlerProvider(): iterable { return yield from [ 'Omit namespace' => ['Galleries::showUserGallery'], diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index 40c5da39b091..734420f73733 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -405,7 +405,7 @@ static function ($routes) { $this->assertSame($expected, $routes->getRoutes()); } - public function groupProvider() + public function groupProvider(): iterable { yield from [ ['admin', '/', [ @@ -1242,7 +1242,7 @@ static function () {}, $this->assertSame($options, $options1); } - public function optionsProvider() + public function optionsProvider(): iterable { yield from [ [ @@ -1657,7 +1657,7 @@ public function testZeroAsURIPath() $this->assertSame($expects, $router->handle('/0')); } - public function provideRouteDefaultNamespace() + public function provideRouteDefaultNamespace(): iterable { return [ 'with \\ prefix' => ['\App\Controllers'], diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index 5be01a47bfc6..1ba0ee9ed798 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -870,7 +870,7 @@ public function testRedirectRoute( $router->handle($url); } - public function provideRedirectCase(): array + public function provideRedirectCase(): iterable { // [$route, $redirectFrom, $redirectTo, $url, $expectedPath, $alias] return [ diff --git a/tests/system/Test/DOMParserTest.php b/tests/system/Test/DOMParserTest.php index c1ca8194f4b7..49d5e4b5d955 100644 --- a/tests/system/Test/DOMParserTest.php +++ b/tests/system/Test/DOMParserTest.php @@ -79,7 +79,7 @@ public function testParseSelectorWithAttribute() $this->assertSame(['href' => 'http://example.com'], $selector['attr']); } - public function provideText() + public function provideText(): iterable { return [ 'en' => ['Hello World'], diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 6cebdae1a50a..e26776d1fb29 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -284,7 +284,7 @@ public function testCallZeroAsPathGot404() $this->get('0'); } - public function provideRoutesData() + public function provideRoutesData(): iterable { return [ 'non parameterized cli' => [ diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 8abc71c6d9ed..63b7d9c7aa94 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -46,7 +46,7 @@ public function testIsOK(int $code, bool $isOk) /** * Provides status codes and their expected "OK" */ - public function statusCodeProvider(): array + public function statusCodeProvider(): iterable { return [ [ diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 2121636baefa..3bdd2e661224 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -208,7 +208,7 @@ public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $ } } - public function tokenTimeUsecases(): array + public function tokenTimeUsecases(): iterable { return [ '2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [ diff --git a/tests/system/Validation/CreditCardRulesTest.php b/tests/system/Validation/CreditCardRulesTest.php index 13168eed2f5b..6ef13c5ecee5 100644 --- a/tests/system/Validation/CreditCardRulesTest.php +++ b/tests/system/Validation/CreditCardRulesTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\Services; -use Generator; use Tests\Support\Validation\TestRules; /** @@ -64,7 +63,7 @@ public function testValidCCNumber(string $type, ?string $number, bool $expected) * * @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' => [ diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index 8e78750e494e..7f1de6439345 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -129,7 +129,7 @@ public function testValidURLStrictWithSchema() $this->assertFalse($this->validation->run($data)); } - public function urlProvider(): Generator + public function urlProvider(): iterable { yield from [ [ @@ -260,7 +260,7 @@ public function testValidEmails(?string $email, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function emailProviderSingle(): Generator + public function emailProviderSingle(): iterable { yield from [ [ @@ -278,7 +278,7 @@ public function emailProviderSingle(): Generator ]; } - public function emailsProvider(): Generator + public function emailsProvider(): iterable { yield from [ [ @@ -324,7 +324,7 @@ public function testValidIP(?string $ip, ?string $which, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function ipProvider(): Generator + public function ipProvider(): iterable { yield from [ [ @@ -393,7 +393,7 @@ public function testString($str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function stringProvider(): Generator + public function stringProvider(): iterable { yield from [ [ @@ -427,7 +427,7 @@ public function testAlpha(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaProvider(): Generator + public function alphaProvider(): iterable { yield from [ [ @@ -469,7 +469,7 @@ public function testAlphaSpace(?string $value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaSpaceProvider(): Generator + public function alphaSpaceProvider(): iterable { yield from [ [ @@ -515,7 +515,7 @@ public function testAlphaNumeric(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaNumericProvider(): Generator + public function alphaNumericProvider(): iterable { yield from [ [ @@ -553,7 +553,7 @@ public function testAlphaNumericPunct(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaNumericPunctProvider(): Generator + public function alphaNumericPunctProvider(): iterable { yield from [ [ @@ -685,7 +685,7 @@ public function testAlphaDash(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaDashProvider(): Generator + public function alphaDashProvider(): iterable { yield from [ [ @@ -723,7 +723,7 @@ public function testHex(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function hexProvider(): Generator + public function hexProvider(): iterable { yield from [ [ @@ -761,7 +761,7 @@ public function testNumeric(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function numericProvider(): Generator + public function numericProvider(): iterable { yield from [ [ @@ -837,7 +837,7 @@ public function testNumericWithInvalidTypeData($value, bool $expected): void $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 @@ public function testInteger(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function integerProvider(): Generator + public function integerProvider(): iterable { yield from [ [ @@ -937,7 +937,7 @@ public function testDecimal(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function decimalProvider(): Generator + public function decimalProvider(): iterable { yield from [ [ @@ -995,7 +995,7 @@ public function testNatural(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function naturalProvider(): Generator + public function naturalProvider(): iterable { yield from [ [ @@ -1037,7 +1037,7 @@ public function testNaturalNoZero(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function naturalZeroProvider(): Generator + public function naturalZeroProvider(): iterable { yield from [ [ @@ -1079,7 +1079,7 @@ public function testBase64(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function base64Provider(): Generator + public function base64Provider(): iterable { yield from [ [ @@ -1113,7 +1113,7 @@ public function testJson(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function jsonProvider(): Generator + public function jsonProvider(): iterable { yield from [ [ @@ -1171,7 +1171,7 @@ public function testTimeZone(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function timezoneProvider(): Generator + public function timezoneProvider(): iterable { yield from [ [ @@ -1209,7 +1209,7 @@ public function testValidDate(?string $str, ?string $format, bool $expected): vo $this->assertSame($expected, $this->validation->run($data)); } - public function validDateProvider(): Generator + public function validDateProvider(): iterable { yield from [ [ diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 7760401655d6..fe10358e20ce 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\Services; -use Generator; use stdClass; use Tests\Support\Validation\TestRules; @@ -61,7 +60,7 @@ public function testRequired(array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideRequiredCases(): Generator + public function provideRequiredCases(): iterable { yield from [ [['foo' => null], false], @@ -82,7 +81,7 @@ public function testIfExist(array $rules, array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function ifExistProvider(): Generator + public function ifExistProvider(): iterable { yield from [ [ @@ -135,7 +134,7 @@ public function testPermitEmpty(array $rules, array $data, bool $expected): void $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 @@ public function testMatches(array $data, bool $expected): void $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 @@ public function testMatchesNested(array $data, bool $expected): void $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 @@ public function testEquals(array $data, string $param, bool $expected): void $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 @@ public function testMinLength(?string $data, string $length, bool $expected): vo $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 @@ public function testExactLength(?string $data, bool $expected): void $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 @@ public function testGreaterThan(?string $first, ?string $second, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function greaterThanProvider(): Generator + public function greaterThanProvider(): iterable { yield from [ ['-10', '-11', true], @@ -458,7 +457,7 @@ public function testGreaterThanEqual(?string $first, ?string $second, bool $expe $this->assertSame($expected, $this->validation->run($data)); } - public function greaterThanEqualProvider(): Generator + public function greaterThanEqualProvider(): iterable { yield from [ ['0', '0', true], @@ -484,7 +483,7 @@ public function testLessThan(?string $first, ?string $second, bool $expected): v $this->assertSame($expected, $this->validation->run($data)); } - public function lessThanProvider(): Generator + public function lessThanProvider(): iterable { yield from [ ['-10', '-11', false], @@ -510,7 +509,7 @@ public function testLessThanEqual(?string $first, ?string $second, bool $expecte $this->assertSame($expected, $this->validation->run($data)); } - public function lessThanEqualProvider(): Generator + public function lessThanEqualProvider(): iterable { yield from [ ['0', '0', true], @@ -546,7 +545,7 @@ public function testNotInList(?string $first, ?string $second, bool $expected): $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 @@ public function testRequiredWith(?string $field, ?string $check, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function requiredWithProvider(): Generator + public function requiredWithProvider(): iterable { yield from [ ['nope', 'bar', false], @@ -630,7 +629,7 @@ public function testRequiredWithAndOtherRules(bool $expected, array $data): void $this->assertSame($expected, $result); } - public function RequiredWithAndOtherRulesProvider(): Generator + public function RequiredWithAndOtherRulesProvider(): iterable { yield from [ // `otherField` and `mustBeADate` do not exist @@ -667,7 +666,7 @@ public function testRequiredWithAndOtherRuleWithValueZero(bool $expected, array $this->assertSame($expected, $result); } - public function RequiredWithAndOtherRuleWithValueZeroProvider(): Generator + public function RequiredWithAndOtherRuleWithValueZeroProvider(): iterable { yield from [ [true, ['married' => '0', 'partner_name' => '']], @@ -697,7 +696,7 @@ public function testRequiredWithout(?string $field, ?string $check, bool $expect $this->assertSame($expected, $this->validation->run($data)); } - public function requiredWithoutProvider(): Generator + public function requiredWithoutProvider(): iterable { yield from [ ['nope', 'bars', false], @@ -743,7 +742,7 @@ public function testRequiredWithoutMultiple(string $foo, string $bar, string $ba $this->assertSame($result, $this->validation->run($data)); } - public function requiredWithoutMultipleProvider(): Generator + public function requiredWithoutMultipleProvider(): iterable { yield from [ 'all empty' => [ @@ -789,7 +788,7 @@ public function testRequiredWithoutMultipleWithoutFields(array $data, bool $resu $this->assertSame($result, $this->validation->run($data)); } - public function requiredWithoutMultipleWithoutFieldsProvider(): Generator + public function requiredWithoutMultipleWithoutFieldsProvider(): iterable { yield from [ 'baz is missing' => [ diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index a0619df06cc0..f6441c70b7fd 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -14,7 +14,6 @@ use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; -use Generator; use Tests\Support\Validation\TestRules; /** @@ -65,7 +64,7 @@ public function testValidCCNumber(string $type, ?string $number, bool $expected) * * @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' => [ diff --git a/tests/system/Validation/StrictRules/RulesTest.php b/tests/system/Validation/StrictRules/RulesTest.php index 4389a48b0ff1..2bbddad70561 100644 --- a/tests/system/Validation/StrictRules/RulesTest.php +++ b/tests/system/Validation/StrictRules/RulesTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Validation\RulesTest as TraditionalRulesTest; use CodeIgniter\Validation\Validation; -use Generator; use Tests\Support\Validation\TestRules; /** @@ -51,7 +50,7 @@ public function testPermitEmptyStrict(array $rules, array $data, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function providePermitEmptyCasesStrict(): Generator + public function providePermitEmptyCasesStrict(): iterable { yield from [ [ @@ -106,7 +105,7 @@ public function testGreaterThanEqualStrict($value, string $param, bool $expected $this->assertSame($expected, $this->validation->run($data)); } - public function provideGreaterThanEqualStrict(): Generator + public function provideGreaterThanEqualStrict(): iterable { yield from [ [0, '0', true], @@ -132,7 +131,7 @@ public function testGreaterThanStrict($value, string $param, bool $expected): vo $this->assertSame($expected, $this->validation->run($data)); } - public function provideGreaterThanStrict(): Generator + public function provideGreaterThanStrict(): iterable { yield from [ [-10, '-11', true], @@ -159,7 +158,7 @@ public function testLessThanStrict($value, string $param, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideLessThanStrict(): Generator + public function provideLessThanStrict(): iterable { yield from [ [-10, '-11', false], @@ -187,7 +186,7 @@ public function testLessEqualThanStrict($value, ?string $param, bool $expected): $this->assertSame($expected, $this->validation->run($data)); } - public function provideLessThanEqualStrict(): Generator + public function provideLessThanEqualStrict(): iterable { yield from [ [0, '0', true], diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index efc00290ebd4..638dd56e26d2 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -18,7 +18,6 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use Config\App; use Config\Services; -use Generator; use PHPUnit\Framework\ExpectationFailedException; use Tests\Support\Validation\TestRules; use TypeError; @@ -339,7 +338,7 @@ public function testCanValidatetArrayData($value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function arrayDataProvider(): Generator + public function arrayDataProvider(): iterable { yield 'list array' => [ [1, 2, 3, 4, 5], @@ -391,7 +390,7 @@ public function testIsIntWithInvalidTypeData($value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function isIntInvalidTypeDataProvider(): Generator + public function isIntInvalidTypeDataProvider(): iterable { yield 'array with int' => [ [555], @@ -623,7 +622,7 @@ public function testRulesSetup($rules, $expected, array $errors = []) $this->assertSame($expected, $this->validation->getError('foo')); } - public function rulesSetupProvider(): Generator + public function rulesSetupProvider(): iterable { yield from [ [ @@ -971,7 +970,7 @@ public function testRulesForArrayField(array $body, array $rules, array $results $this->assertSame($results, $this->validation->getErrors()); } - public function arrayFieldDataProvider(): Generator + public function arrayFieldDataProvider(): iterable { yield from [ 'all_rules_should_pass' => [ @@ -1206,7 +1205,7 @@ public function testDotNotationOnIfExistRule(bool $expected, array $rules, array $this->assertSame($expected, $actual); } - public function dotNotationForIfExistProvider(): Generator + public function dotNotationForIfExistProvider(): iterable { yield 'dot-on-end-fail' => [ false, diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php index cfa2ab1e81e8..d1bd13620470 100644 --- a/tests/system/View/ParserTest.php +++ b/tests/system/View/ParserTest.php @@ -418,7 +418,7 @@ public function testMismatchedVarPair() $this->assertSame($result, $this->parser->renderString($template)); } - public function escValueTypes() + public function escValueTypes(): iterable { return [ 'scalar' => [42],