diff --git a/system/Config/Factories.php b/system/Config/Factories.php index dc74c45e76f7..ab5343d15fb8 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -513,6 +513,12 @@ public static function getBasename(string $alias): string /** * Gets component data for caching. * + * @return array{ + * options: array, + * aliases: array, + * instances: array, + * } + * * @internal For caching only */ public static function getComponentInstances(string $component): array diff --git a/system/Test/FilterTestTrait.php b/system/Test/FilterTestTrait.php index 45411fad0a42..1140adf7dc5e 100644 --- a/system/Test/FilterTestTrait.php +++ b/system/Test/FilterTestTrait.php @@ -120,7 +120,7 @@ protected function setUpFilterTestTrait(): void * @param FilterInterface|string $filter The filter instance, class, or alias * @param string $position "before" or "after" * - * @phpstan-return Closure(list|null=): mixed + * @return Closure(list|null=): mixed */ protected function getFilterCaller($filter, string $position): Closure { @@ -268,6 +268,8 @@ protected function assertFilter(string $route, string $position, string $alias): * @param string $route The route to test * @param string $position "before" or "after" * @param string $alias Alias for the anticipated filter + * + * @return void */ protected function assertNotFilter(string $route, string $position, string $alias) { @@ -286,6 +288,8 @@ protected function assertNotFilter(string $route, string $position, string $alia * * @param string $route The route to test * @param string $position "before" or "after" + * + * @return void */ protected function assertHasFilters(string $route, string $position) { @@ -303,6 +307,8 @@ protected function assertHasFilters(string $route, string $position) * * @param string $route The route to test * @param string $position "before" or "after" + * + * @return void */ protected function assertNotHasFilters(string $route, string $position) { diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index b1b03d211559..f13af5179112 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -23,7 +23,6 @@ use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\Validation\Exceptions\ValidationException; use CodeIgniter\View\RendererInterface; -use Config\Validation as ValidationConfig; /** * Validator @@ -96,7 +95,7 @@ class Validation implements ValidationInterface /** * Our configuration. * - * @var ValidationConfig + * @var object{ruleSets: list} */ protected $config; @@ -110,7 +109,7 @@ class Validation implements ValidationInterface /** * Validation constructor. * - * @param ValidationConfig $config + * @param object{ruleSets: list} $config */ public function __construct($config, RendererInterface $view) { diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index 978513b74c50..bc61dd06c81d 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -108,7 +108,7 @@ private function createRequestAndResponse(string $routePath = '', array $userHea } } - protected function makeController(string $routePath = '', array $userHeaders = []) + protected function makeController(string $routePath = '', array $userHeaders = []): object { $this->createRequestAndResponse($routePath, $userHeaders); @@ -659,7 +659,7 @@ public function testXMLResponseFormat(): void $this->assertSame($xmlFormatter->format($data), $this->response->getXML()); } - private function invoke(object $controller, string $method, array $args = []) + private function invoke(object $controller, string $method, array $args = []): object { $method = self::getPrivateMethodInvoker($controller, $method); diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index 47223198caad..4c45a0712f64 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -30,7 +30,10 @@ final class FileHandlerTest extends AbstractHandlerTestCase private static string $directory = 'FileHandler'; private Cache $config; - private static function getKeyArray() + /** + * @return list + */ + private static function getKeyArray(): array { return [ self::$key1, @@ -328,25 +331,16 @@ public function testSaveMode(int $int, string $string): void $this->assertSame($string, $mode); } + /** + * @return iterable + */ public static function provideSaveMode(): iterable { return [ - [ - 0640, - '640', - ], - [ - 0600, - '600', - ], - [ - 0660, - '660', - ], - [ - 0777, - '777', - ], + [0640, '640'], + [0600, '600'], + [0660, '660'], + [0777, '777'], ]; } @@ -382,14 +376,19 @@ public function __construct() $this->config->file['storePath'] .= self::$directory; parent::__construct($this->config); + + helper('filesystem'); } - public function getFileInfoTest() + /** + * @return array|null + */ + public function getFileInfoTest(): ?array { $tmpHandle = tmpfile(); stream_get_meta_data($tmpHandle); - return $this->getFileInfo(stream_get_meta_data($tmpHandle)['uri'], [ + return get_file_info(stream_get_meta_data($tmpHandle)['uri'], [ 'name', 'server_path', 'size', diff --git a/tests/system/Cache/Handlers/MemcachedHandlerTest.php b/tests/system/Cache/Handlers/MemcachedHandlerTest.php index 938607aa9844..c6cfdb8543ee 100644 --- a/tests/system/Cache/Handlers/MemcachedHandlerTest.php +++ b/tests/system/Cache/Handlers/MemcachedHandlerTest.php @@ -25,7 +25,10 @@ #[Group('CacheLive')] final class MemcachedHandlerTest extends AbstractHandlerTestCase { - private static function getKeyArray() + /** + * @return list + */ + private static function getKeyArray(): array { return [ self::$key1, diff --git a/tests/system/Cache/Handlers/PredisHandlerTest.php b/tests/system/Cache/Handlers/PredisHandlerTest.php index 9b11c23b0683..4b009582cd55 100644 --- a/tests/system/Cache/Handlers/PredisHandlerTest.php +++ b/tests/system/Cache/Handlers/PredisHandlerTest.php @@ -26,7 +26,10 @@ final class PredisHandlerTest extends AbstractHandlerTestCase { private Cache $config; - private static function getKeyArray() + /** + * @return list + */ + private static function getKeyArray(): array { return [ self::$key1, diff --git a/tests/system/Cache/Handlers/RedisHandlerTest.php b/tests/system/Cache/Handlers/RedisHandlerTest.php index 0eee45f5704f..812985e65e8d 100644 --- a/tests/system/Cache/Handlers/RedisHandlerTest.php +++ b/tests/system/Cache/Handlers/RedisHandlerTest.php @@ -28,7 +28,10 @@ final class RedisHandlerTest extends AbstractHandlerTestCase { private Cache $config; - private static function getKeyArray() + /** + * @return list + */ + private static function getKeyArray(): array { return [ self::$key1, diff --git a/tests/system/Commands/CreateDatabaseTest.php b/tests/system/Commands/CreateDatabaseTest.php index 6bf93f4a2eb3..af5b6d3b1682 100644 --- a/tests/system/Commands/CreateDatabaseTest.php +++ b/tests/system/Commands/CreateDatabaseTest.php @@ -64,7 +64,7 @@ private function dropDatabase(): void } } - protected function getBuffer() + protected function getBuffer(): string { return $this->getStreamFilterBuffer(); } diff --git a/tests/system/Commands/FilterCheckTest.php b/tests/system/Commands/FilterCheckTest.php index 82826e599d78..6bc594ba1831 100644 --- a/tests/system/Commands/FilterCheckTest.php +++ b/tests/system/Commands/FilterCheckTest.php @@ -37,7 +37,7 @@ protected function tearDown(): void parent::tearDown(); } - protected function getBuffer() + protected function getBuffer(): string { return $this->getStreamFilterBuffer(); } diff --git a/tests/system/Commands/HelpCommandTest.php b/tests/system/Commands/HelpCommandTest.php index 7ce07d8129fb..519f5ab33f65 100644 --- a/tests/system/Commands/HelpCommandTest.php +++ b/tests/system/Commands/HelpCommandTest.php @@ -25,7 +25,7 @@ final class HelpCommandTest extends CIUnitTestCase { use StreamFilterTrait; - protected function getBuffer() + protected function getBuffer(): string { return $this->getStreamFilterBuffer(); } diff --git a/tests/system/Commands/InfoCacheTest.php b/tests/system/Commands/InfoCacheTest.php index 1c3ad93db5f0..e8cc409356f5 100644 --- a/tests/system/Commands/InfoCacheTest.php +++ b/tests/system/Commands/InfoCacheTest.php @@ -41,7 +41,7 @@ protected function tearDown(): void config('Cache')->handler = 'file'; } - protected function getBuffer() + protected function getBuffer(): string { return $this->getStreamFilterBuffer(); } diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index 5f3dba1796c1..94455b826826 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -40,7 +40,7 @@ protected function tearDown(): void parent::tearDown(); } - protected function getBuffer() + protected function getBuffer(): string { return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()); } diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index eea619e1b229..e519ca19d9bc 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -42,7 +42,7 @@ protected function tearDown(): void /** * @see https://regex101.com/r/l3lHfR/1 */ - protected function getBuffer() + protected function getBuffer(): string { return preg_replace_callback('/(\|\s*[^|]+\s*\|\s*)(.*?)(\s*\|\s*[^|]+\s*\|)/', static function (array $matches): string { $matches[2] = str_replace(DIRECTORY_SEPARATOR, '/', $matches[2]); diff --git a/tests/system/Config/FactoriesTest.php b/tests/system/Config/FactoriesTest.php index ed7b15526749..06013e49ca31 100644 --- a/tests/system/Config/FactoriesTest.php +++ b/tests/system/Config/FactoriesTest.php @@ -41,7 +41,7 @@ protected function setUp(): void Factories::reset(); } - protected function getFactoriesStaticProperty(...$params) + protected function getFactoriesStaticProperty(...$params): mixed { // First parameter is the actual property $name = array_shift($params); @@ -425,7 +425,14 @@ public function testDefineAndGet(): void $this->assertInstanceOf(EntityModel::class, $model); } - public function testGetComponentInstances() + /** + * @return array{ + * options: array, + * aliases: array, + * instances: array, + * } + */ + public function testGetComponentInstances(): array { Factories::config('App'); Factories::config(Database::class); @@ -439,6 +446,19 @@ public function testGetComponentInstances() return $data; } + /** + * @param array{ + * options: array, + * aliases: array, + * instances: array, + * } $data + * + * @return array{ + * options: array, + * aliases: array, + * instances: array, + * } + */ #[Depends('testGetComponentInstances')] public function testSetComponentInstances(array $data) { @@ -456,6 +476,13 @@ public function testSetComponentInstances(array $data) return $data; } + /** + * @param array{ + * options: array, + * aliases: array, + * instances: array, + * } $data + */ #[Depends('testSetComponentInstances')] public function testIsUpdated(array $data): void { diff --git a/tests/system/Entity/EntityTest.php b/tests/system/Entity/EntityTest.php index 5f575d67957c..92ed11aa36b6 100644 --- a/tests/system/Entity/EntityTest.php +++ b/tests/system/Entity/EntityTest.php @@ -1094,7 +1094,7 @@ public function testJsonSerializableEntity(): void $this->assertSame(json_encode($entity->toArray()), json_encode($entity)); } - protected function getEntity() + private function getEntity(): object { return new class () extends Entity { protected $attributes = [ @@ -1132,7 +1132,7 @@ public function getFakeBar(): string }; } - protected function getNewSetterGetterEntity() + private function getNewSetterGetterEntity(): object { return new class () extends Entity { protected $attributes = [ @@ -1178,7 +1178,7 @@ public function _getBar(): string }; } - protected function getMappedEntity() + private function getMappedEntity(): object { return new class () extends Entity { protected $attributes = [ @@ -1208,7 +1208,7 @@ protected function getSimple(): string }; } - protected function getSwappedEntity() + private function getSwappedEntity(): object { return new class () extends Entity { protected $attributes = [ @@ -1227,7 +1227,7 @@ protected function getSwappedEntity() }; } - protected function getSimpleSwappedEntity() + private function getSimpleSwappedEntity(): object { return new class () extends Entity { protected $attributes = [ @@ -1245,7 +1245,7 @@ protected function getSimpleSwappedEntity() }; } - protected function getCastEntity($data = null): Entity + private function getCastEntity($data = null): object { return new class ($data) extends Entity { protected $attributes = [ @@ -1303,7 +1303,7 @@ public function setSeventh(string $seventh): void }; } - protected function getCastNullableEntity() + private function getCastNullableEntity(): object { return new class () extends Entity { protected $attributes = [ @@ -1332,7 +1332,7 @@ protected function getCastNullableEntity() }; } - protected function getCustomCastEntity() + private function getCustomCastEntity(): object { return new class () extends Entity { protected $attributes = [ diff --git a/tests/system/Filters/fixtures/InvalidClass.php b/tests/system/Filters/fixtures/InvalidClass.php index 9d727ed1b90f..2cb90e1c571a 100644 --- a/tests/system/Filters/fixtures/InvalidClass.php +++ b/tests/system/Filters/fixtures/InvalidClass.php @@ -15,7 +15,7 @@ class InvalidClass { - public function index() + public function index(): string { return 'bad'; } diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index c4e6688ef11f..a9657804f489 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -54,7 +54,7 @@ protected function prepare(bool $CSPEnabled = true): void $this->csp = $this->response->getCSP(); } - protected function work(string $parm = 'Hello') + protected function work(string $parm = 'Hello'): bool { $body = $parm; $this->response->setBody($body); diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index 2d43c775f949..f0e1564db5b7 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -334,8 +334,7 @@ public function testFailedMoveBecauseOfFalseReturned(): void * * This overwrite is for testing the move operation. */ - -function is_uploaded_file($filename) +function is_uploaded_file($filename): bool { if (! is_file($filename)) { file_put_contents($filename, 'data'); @@ -349,8 +348,7 @@ function is_uploaded_file($filename) * * This overwrite is for testing the move operation. */ - -function move_uploaded_file($filename, $destination, ?bool $setReturnValue = null) +function move_uploaded_file($filename, $destination, ?bool $setReturnValue = null): bool { static $return = true; diff --git a/tests/system/RESTful/ResourceControllerTest.php b/tests/system/RESTful/ResourceControllerTest.php index e51e6c41f694..b7b16325952b 100644 --- a/tests/system/RESTful/ResourceControllerTest.php +++ b/tests/system/RESTful/ResourceControllerTest.php @@ -367,7 +367,7 @@ public function testXMLFormatOutput(): void $this->assertSame($expected, $result); } - private function invoke(object $controller, string $method, array $args = []) + private function invoke(object $controller, string $method, array $args = []): object { $method = self::getPrivateMethodInvoker($controller, $method); diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index ca70b315f5b6..bc7a30197b88 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -35,7 +35,7 @@ protected function setUp(): void $this->resetFactories(); } - protected function getCollector(array $config = [], array $files = [], $moduleConfig = null) + protected function getCollector(array $config = [], array $files = [], $moduleConfig = null): RouteCollection { $defaults = [ 'Config' => APPPATH . 'Config', diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index fbfdb94442b1..6b5270e24fef 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -40,7 +40,7 @@ protected function setUp(): void $this->resetFactories(); } - protected function getCollector(array $config = [], array $files = [], $moduleConfig = null) + protected function getCollector(array $config = [], array $files = [], $moduleConfig = null): RouteCollection { $defaults = [ 'Config' => APPPATH . 'Config', diff --git a/tests/system/Session/Handlers/Database/AbstractHandlerTestCase.php b/tests/system/Session/Handlers/Database/AbstractHandlerTestCase.php index ad27d88bfb76..842824c4a76a 100644 --- a/tests/system/Session/Handlers/Database/AbstractHandlerTestCase.php +++ b/tests/system/Session/Handlers/Database/AbstractHandlerTestCase.php @@ -44,7 +44,7 @@ protected function setUp(): void } } - abstract protected function getInstance($options = []); + abstract protected function getInstance($options = []): DatabaseHandler; public function testOpen(): void { diff --git a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php index 0b364c7f6559..281ac419c5f5 100644 --- a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php +++ b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php @@ -32,7 +32,7 @@ protected function setUp(): void } } - protected function getInstance($options = []) + protected function getInstance($options = []): MySQLiHandler { $defaults = [ 'driver' => $this->sessionDriver, diff --git a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php index 21fb96b96244..80ec37fbc240 100644 --- a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php +++ b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php @@ -32,7 +32,7 @@ protected function setUp(): void } } - protected function getInstance($options = []) + protected function getInstance($options = []): PostgreHandler { $defaults = [ 'driver' => $this->sessionDriver, diff --git a/tests/system/Session/Handlers/Database/RedisHandlerTest.php b/tests/system/Session/Handlers/Database/RedisHandlerTest.php index f7e3a5558a13..19efb98cd50d 100644 --- a/tests/system/Session/Handlers/Database/RedisHandlerTest.php +++ b/tests/system/Session/Handlers/Database/RedisHandlerTest.php @@ -32,7 +32,7 @@ final class RedisHandlerTest extends CIUnitTestCase private string $sessionSavePath = 'tcp://127.0.0.1:6379'; private string $userIpAddress = '127.0.0.1'; - protected function getInstance($options = []) + protected function getInstance($options = []): RedisHandler { $defaults = [ 'driver' => $this->sessionDriver, diff --git a/tests/system/Session/SessionTest.php b/tests/system/Session/SessionTest.php index d469c595cd4f..78aec295b718 100644 --- a/tests/system/Session/SessionTest.php +++ b/tests/system/Session/SessionTest.php @@ -44,7 +44,7 @@ protected function setUp(): void $_SESSION = []; } - protected function getInstance($options = []) + protected function getInstance($options = []): MockSession { $defaults = [ 'driver' => FileHandler::class, @@ -209,7 +209,7 @@ public function testGetAsProperty(): void $session->set('foo', 'bar'); - $this->assertSame('bar', $session->foo); + $this->assertSame('bar', $session->foo); // @phpstan-ignore property.notFound } public function testGetAsNormal(): void @@ -248,7 +248,7 @@ public function testIssetReturnsTrueOnSuccess(): void $session->start(); $_SESSION['foo'] = 'bar'; - $issetReturn = isset($session->foo); + $issetReturn = isset($session->foo); // @phpstan-ignore property.notFound $this->assertTrue($issetReturn); } @@ -259,7 +259,7 @@ public function testIssetReturnsFalseOnNotFound(): void $session->start(); $_SESSION['foo'] = 'bar'; - $issetReturn = isset($session->bar); + $issetReturn = isset($session->bar); // @phpstan-ignore property.notFound $this->assertFalse($issetReturn); } @@ -316,7 +316,7 @@ public function testSetMagicMethod(): void $session = $this->getInstance(); $session->start(); - $session->foo = 'bar'; + $session->foo = 'bar'; // @phpstan-ignore property.notFound $this->assertArrayHasKey('foo', $_SESSION); $this->assertSame('bar', $_SESSION['foo']); diff --git a/tests/system/Test/BootstrapFCPATHTest.php b/tests/system/Test/BootstrapFCPATHTest.php index d58bb847360d..cc03ef99b1b7 100644 --- a/tests/system/Test/BootstrapFCPATHTest.php +++ b/tests/system/Test/BootstrapFCPATHTest.php @@ -16,8 +16,6 @@ use PHPUnit\Framework\Attributes\Group; /** - * Class BootstrapFCPATHTest - * * This test confirms that the bootstrap.php * will set the correct FCPATH regardless of the current directory * @@ -57,7 +55,7 @@ public function testSetFCPATH(): void $this->assertSame($correctPath, $result1); } - private function correctFCPATH() + private function correctFCPATH(): string { return realpath(__DIR__ . '/../../../public') . DIRECTORY_SEPARATOR; } @@ -88,7 +86,7 @@ private function deleteFiles(): void } } - private function fileContents() + private function fileContents(): string { $fileContents = ''; $fileContents .= 'currentDir . "' . '/../../../system/Test/bootstrap.php';" . PHP_EOL; $fileContents .= '// return value of FCPATH' . PHP_EOL; - return $fileContents . ('echo FCPATH;' . PHP_EOL); + return $fileContents . 'echo FCPATH;' . PHP_EOL; } + /** + * @return false|string + */ private function readOutput(string $file) { ob_start(); diff --git a/tests/system/Validation/DatabaseRelatedRulesTest.php b/tests/system/Validation/DatabaseRelatedRulesTest.php index d683320e968b..1b6445c47f08 100644 --- a/tests/system/Validation/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/DatabaseRelatedRulesTest.php @@ -23,6 +23,13 @@ #[Group('DatabaseLive')] final class DatabaseRelatedRulesTest extends StrictDatabaseRelatedRulesTest { + /** + * @var array{ + * ruleSets: list, + * groupA: array, + * groupA_errors: array>, + * } + */ protected array $config = [ 'ruleSets' => [ Rules::class, @@ -41,7 +48,7 @@ final class DatabaseRelatedRulesTest extends StrictDatabaseRelatedRulesTest ], ]; - protected function createRules() + protected function createRules(): object { return new Rules(); } diff --git a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php index 83f45514682c..43e25d8e7a8a 100644 --- a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php @@ -33,6 +33,14 @@ class DatabaseRelatedRulesTest extends CIUnitTestCase use DatabaseTestTrait; protected Validation $validation; + + /** + * @var array{ + * ruleSets: list, + * groupA: array, + * groupA_errors: array>, + * } + */ protected array $config = [ 'ruleSets' => [ Rules::class, @@ -58,7 +66,7 @@ protected function setUp(): void $this->validation->reset(); } - protected function createRules() + protected function createRules(): object { return new Rules(); } diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index 621b20e1103f..0dfe4663fb52 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -362,7 +362,7 @@ public function testClosureRuleWithLabel(): void * * @param mixed $value */ - public function rule1($value) + public function rule1($value): bool { return $value === 'abc'; } @@ -394,11 +394,9 @@ public function testCallableRule(): void } /** - * Validation rule1 - * - * @param mixed $value + * Validation rule2 */ - public function rule2($value, array $data, ?string &$error, string $field) + public function rule2(mixed $value, array $data, ?string &$error, string $field): bool { if ($value !== 'abc') { $error = 'The ' . $field . ' value is not "abc"'; diff --git a/tests/system/View/ParserPluginTest.php b/tests/system/View/ParserPluginTest.php index 770bf3afebab..440c0146b393 100644 --- a/tests/system/View/ParserPluginTest.php +++ b/tests/system/View/ParserPluginTest.php @@ -138,7 +138,7 @@ public function testValidationErrorsList(): void $this->assertSame($this->setHints($this->validator->listErrors()), $this->setHints($this->parser->renderString($template))); } - public function setHints($output) + public function setHints(string $output): string { return preg_replace('/(