From 02ada60fb3ade14bace81ab5a9614d69207f996a Mon Sep 17 00:00:00 2001
From: Denny Septian Panggabean <xamidimura@gmail.com>
Date: Thu, 2 May 2024 15:28:51 +0700
Subject: [PATCH 1/3] docs: fix PHPDocs View

---
 phpstan-baseline.php              | 182 +-----------------------------
 system/View/Parser.php            |  30 ++++-
 system/View/RendererInterface.php |  19 ++--
 system/View/Table.php             |  29 ++---
 system/View/View.php              |  32 +++---
 5 files changed, 68 insertions(+), 224 deletions(-)

diff --git a/phpstan-baseline.php b/phpstan-baseline.php
index c9b399ed3a8e..3c1ceaa90b39 100644
--- a/phpstan-baseline.php
+++ b/phpstan-baseline.php
@@ -9006,171 +9006,21 @@
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/Parser.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:applyFilters\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:objectToArray\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:objectToArray\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parse\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parsePair\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parsePair\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parseSingle\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:prepareReplacement\\(\\) has parameter \\$matches with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:replaceSingle\\(\\) has parameter \\$pattern with no value type specified in iterable type array\\.$#',
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/Parser.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\Parser\\:\\:\\$dataContexts type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\Parser\\:\\:\\$noparseBlocks type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Parser.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/RendererInterface.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/RendererInterface.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/RendererInterface.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_defaultTemplate\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_prepArgs\\(\\) has parameter \\$args with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_prepArgs\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_setFromArray\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:generate\\(\\) has parameter \\$tableData with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:setTemplate\\(\\) has parameter \\$template with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Only booleans are allowed in an if condition, string\\|null given\\.$#',
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/Table.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$footing type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$function type has no signature specified for callable\\.$#',
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/Table.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$heading type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$rows type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$template type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Table.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#',
 	'count' => 1,
@@ -9186,26 +9036,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/View.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$data type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$performanceData type has no value type specified in iterable type array\\.$#',
 	'count' => 1,
@@ -9221,11 +9051,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/View.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$tempData type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
 	'count' => 2,
@@ -15992,15 +15817,10 @@
 	'path' => __DIR__ . '/tests/system/View/TableTest.php',
 ];
 $ignoreErrors[] = [
-	'message' => '#^Parameter \\#1 \\$array of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects array, string given\\.$#',
+	'message' => '#^Parameter \\#1 \\$array of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects array\\<int, string\\>, string given\\.$#',
 	'count' => 1,
 	'path' => __DIR__ . '/tests/system/View/TableTest.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Parameter \\#1 \\$template of method CodeIgniter\\\\View\\\\Table\\:\\:setTemplate\\(\\) expects array, string given\\.$#',
-	'count' => 2,
-	'path' => __DIR__ . '/tests/system/View/TableTest.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Parameter \\#2 \\$columnLimit of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects int, string given\\.$#',
 	'count' => 1,
diff --git a/system/View/Parser.php b/system/View/Parser.php
index 085252102e6e..bbeb00f757c0 100644
--- a/system/View/Parser.php
+++ b/system/View/Parser.php
@@ -56,7 +56,7 @@ class Parser extends View
     /**
      * Stores extracted noparse blocks.
      *
-     * @var array
+     * @var list<string>
      */
     protected $noparseBlocks = [];
 
@@ -72,7 +72,7 @@ class Parser extends View
      * Stores the context for each data element
      * when set by `setData` so the context is respected.
      *
-     * @var array
+     * @var array<string, mixed>
      */
     protected $dataContexts = [];
 
@@ -99,6 +99,10 @@ public function __construct(
      *
      * Parses pseudo-variables contained in the specified template view,
      * replacing them with any data that has already been set.
+     *
+     * @param array<string, mixed>|null $options Reserved for 3rd-party uses since
+     *                                           it might be needed to pass additional info
+     *                                           to other template engines.
      */
     public function render(string $view, ?array $options = null, ?bool $saveData = null): string
     {
@@ -159,6 +163,10 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n
      *
      * Parses pseudo-variables contained in the specified string,
      * replacing them with any data that has already been set.
+     *
+     * @param array<string, mixed>|null $options Reserved for 3rd-party uses since
+     *                                           it might be needed to pass additional info
+     *                                           to other template engines.
      */
     public function renderString(string $template, ?array $options = null, ?bool $saveData = null): string
     {
@@ -190,6 +198,7 @@ public function renderString(string $template, ?array $options = null, ?bool $sa
      * so that the variable is correctly handled within the
      * parsing itself, and contexts (including raw) are respected.
      *
+     * @param         array<string, mixed>                      $data
      * @param         non-empty-string|null                     $context The context to escape it for.
      *                                                                   If 'raw', no escaping will happen.
      * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context
@@ -222,7 +231,8 @@ public function setData(array $data = [], ?string $context = null): RendererInte
      * Parses pseudo-variables contained in the specified template,
      * replacing them with the data in the second param
      *
-     * @param array $options Future options
+     * @param array<string, mixed> $data
+     * @param array<string, mixed> $options Future options
      */
     protected function parse(string $template, array $data = [], ?array $options = null): string
     {
@@ -266,6 +276,8 @@ protected function parse(string $template, array $data = [], ?array $options = n
 
     /**
      * Parse a single key/value, extracting it
+     *
+     * @return array<string, string>
      */
     protected function parseSingle(string $key, string $val): array
     {
@@ -280,6 +292,10 @@ protected function parseSingle(string $key, string $val): array
      * Parse a tag pair
      *
      * Parses tag pairs: {some_tag} string... {/some_tag}
+     *
+     * @param array<string, mixed> $data
+     *
+     * @return array<string, string>
      */
     protected function parsePair(string $variable, array $data, string $template): array
     {
@@ -533,6 +549,8 @@ protected function replaceSingle($pattern, $content, $template, bool $escape = f
 
     /**
      * Callback used during parse() to apply any filters to the value.
+     *
+     * @param list<string> $matches
      */
     protected function prepareReplacement(array $matches, string $replace, bool $escape = true): string
     {
@@ -586,6 +604,8 @@ public function shouldAddEscaping(string $key)
     /**
      * Given a set of filters, will apply each of the filters in turn
      * to $replace, and return the modified string.
+     *
+     * @param list<string> $filters
      */
     protected function applyFilters(string $replace, array $filters): string
     {
@@ -708,9 +728,9 @@ public function removePlugin(string $alias)
      * Converts an object to an array, respecting any
      * toArray() methods on an object.
      *
-     * @param array|bool|float|int|object|string|null $value
+     * @param array<string, mixed>|bool|float|int|object|string|null $value
      *
-     * @return array|bool|float|int|string|null
+     * @return array<string, mixed>|bool|float|int|string|null
      */
     protected function objectToArray($value)
     {
diff --git a/system/View/RendererInterface.php b/system/View/RendererInterface.php
index 62d3d7825060..5fdf8794f12d 100644
--- a/system/View/RendererInterface.php
+++ b/system/View/RendererInterface.php
@@ -24,10 +24,10 @@ interface RendererInterface
      * Builds the output based upon a file name and any
      * data that has already been set.
      *
-     * @param array|null $options  Reserved for 3rd-party uses since
-     *                             it might be needed to pass additional info
-     *                             to other template engines.
-     * @param bool       $saveData Whether to save data for subsequent calls
+     * @param array<string, mixed>|null $options  Reserved for 3rd-party uses since
+     *                                            it might be needed to pass additional info
+     *                                            to other template engines.
+     * @param bool                      $saveData Whether to save data for subsequent calls
      */
     public function render(string $view, ?array $options = null, bool $saveData = false): string;
 
@@ -35,17 +35,18 @@ public function render(string $view, ?array $options = null, bool $saveData = fa
      * Builds the output based upon a string and any
      * data that has already been set.
      *
-     * @param string     $view     The view contents
-     * @param array|null $options  Reserved for 3rd-party uses since
-     *                             it might be needed to pass additional info
-     *                             to other template engines.
-     * @param bool       $saveData Whether to save data for subsequent calls
+     * @param string                    $view     The view contents
+     * @param array<string, mixed>|null $options  Reserved for 3rd-party uses since
+     *                                            it might be needed to pass additional info
+     *                                            to other template engines.
+     * @param bool                      $saveData Whether to save data for subsequent calls
      */
     public function renderString(string $view, ?array $options = null, bool $saveData = false): string;
 
     /**
      * Sets several pieces of view data at once.
      *
+     * @param         array<string, mixed>                      $data
      * @param         non-empty-string|null                     $context The context to escape it for.
      *                                                                   If 'raw', no escaping will happen.
      * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context
diff --git a/system/View/Table.php b/system/View/Table.php
index 85770e31915d..60ccc509f9ae 100644
--- a/system/View/Table.php
+++ b/system/View/Table.php
@@ -27,21 +27,21 @@ class Table
     /**
      * Data for table rows
      *
-     * @var list<array>|list<list<array>>
+     * @var list<array<string, string>>|list<list<array<string, string>>>
      */
     public $rows = [];
 
     /**
      * Data for table heading
      *
-     * @var array
+     * @var array<int, mixed>
      */
     public $heading = [];
 
     /**
      * Data for table footing
      *
-     * @var array
+     * @var array<int, mixed>
      */
     public $footing = [];
 
@@ -62,7 +62,7 @@ class Table
     /**
      * Table layout template
      *
-     * @var array
+     * @var array<string, string>
      */
     public $template;
 
@@ -95,7 +95,7 @@ class Table
     /**
      * Set the template from the table config file if it exists
      *
-     * @param array $config (default: array())
+     * @param array<string, string> $config (default: array())
      */
     public function __construct($config = [])
     {
@@ -108,7 +108,8 @@ public function __construct($config = [])
     /**
      * Set the template
      *
-     * @param array $template
+     * @param         array<string, string>        $template
+     * @phpstan-param array<string, string>|string $template
      *
      * @return bool
      */
@@ -157,10 +158,10 @@ public function setFooting()
      * columns. This allows a single array with many elements to be
      * displayed in a table that has a fixed column count.
      *
-     * @param array $array
-     * @param int   $columnLimit
+     * @param list<string> $array
+     * @param int          $columnLimit
      *
-     * @return array|false
+     * @return array<int, mixed>|false
      */
     public function makeColumns($array = [], $columnLimit = 0)
     {
@@ -260,7 +261,9 @@ public function setSyncRowsWithHeading(bool $orderByKey)
      *
      * Ensures a standard associative array format for all cell data
      *
-     * @return array<string, array>|list<array>
+     * @param array<int, mixed> $args
+     *
+     * @return array<string, array<string, mixed>>|list<array<string, mixed>>
      */
     protected function _prepArgs(array $args)
     {
@@ -297,7 +300,7 @@ public function setCaption($caption)
     /**
      * Generate the table
      *
-     * @param array|BaseResult|null $tableData
+     * @param array<int, mixed>|BaseResult|null $tableData
      *
      * @return string
      */
@@ -472,7 +475,7 @@ protected function _setFromDBResult($object)
     /**
      * Set table data from an array
      *
-     * @param array $data
+     * @param array<int, mixed> $data
      *
      * @return void
      */
@@ -510,7 +513,7 @@ protected function _compileTemplate()
     /**
      * Default Template
      *
-     * @return array
+     * @return array<string, string>
      */
     protected function _defaultTemplate()
     {
diff --git a/system/View/View.php b/system/View/View.php
index cda3d64f6088..8f630d7b90f3 100644
--- a/system/View/View.php
+++ b/system/View/View.php
@@ -34,14 +34,14 @@ class View implements RendererInterface
     /**
      * Saved Data.
      *
-     * @var array
+     * @var array<string, mixed>
      */
     protected $data = [];
 
     /**
      * Data for the variables that are available in the Views.
      *
-     * @var array|null
+     * @var array<string, mixed>|null
      */
     protected $tempData;
 
@@ -165,13 +165,13 @@ public function __construct(
      *  - cache      Number of seconds to cache for
      *  - cache_name Name to use for cache
      *
-     * @param string     $view     File name of the view source
-     * @param array|null $options  Reserved for 3rd-party uses since
-     *                             it might be needed to pass additional info
-     *                             to other template engines.
-     * @param bool|null  $saveData If true, saves data for subsequent calls,
-     *                             if false, cleans the data after displaying,
-     *                             if null, uses the config setting.
+     * @param string                    $view     File name of the view source
+     * @param array<string, mixed>|null $options  Reserved for 3rd-party uses since
+     *                                            it might be needed to pass additional info
+     *                                            to other template engines.
+     * @param bool|null                 $saveData If true, saves data for subsequent calls,
+     *                                            if false, cleans the data after displaying,
+     *                                            if null, uses the config setting.
      */
     public function render(string $view, ?array $options = null, ?bool $saveData = null): string
     {
@@ -306,13 +306,13 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n
      * data that has already been set.
      * Cache does not apply, because there is no "key".
      *
-     * @param string     $view     The view contents
-     * @param array|null $options  Reserved for 3rd-party uses since
-     *                             it might be needed to pass additional info
-     *                             to other template engines.
-     * @param bool|null  $saveData If true, saves data for subsequent calls,
-     *                             if false, cleans the data after displaying,
-     *                             if null, uses the config setting.
+     * @param string                    $view     The view contents
+     * @param array<string, mixed>|null $options  Reserved for 3rd-party uses since
+     *                                            it might be needed to pass additional info
+     *                                            to other template engines.
+     * @param bool|null                 $saveData If true, saves data for subsequent calls,
+     *                                            if false, cleans the data after displaying,
+     *                                            if null, uses the config setting.
      */
     public function renderString(string $view, ?array $options = null, ?bool $saveData = null): string
     {

From d88ad38c8dbf1b95422b64f2a174fcef200c4b1b Mon Sep 17 00:00:00 2001
From: Denny Septian Panggabean <xamidimura@gmail.com>
Date: Fri, 3 May 2024 08:08:37 +0700
Subject: [PATCH 2/3] docs: fix PHPDocs for View

---
 phpstan-baseline.php    | 55 -----------------------------------------
 system/View/Cell.php    | 13 +++++-----
 system/View/Filters.php |  2 +-
 system/View/View.php    | 13 +++++++---
 4 files changed, 17 insertions(+), 66 deletions(-)

diff --git a/phpstan-baseline.php b/phpstan-baseline.php
index 3c1ceaa90b39..995190b9d740 100644
--- a/phpstan-baseline.php
+++ b/phpstan-baseline.php
@@ -8936,21 +8936,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/Cell.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Cell.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Cell.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:render\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Cell.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:renderCell\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
 	'count' => 1,
@@ -8996,11 +8981,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/Cells/Cell.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\Filters\\:\\:default\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/Filters.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:addPlugin\\(\\) has parameter \\$callback with no signature specified for callable\\.$#',
 	'count' => 1,
@@ -9021,36 +9001,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/system/View/Table.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getPerformanceData\\(\\) return type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:include\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$performanceData type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$renderVars type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
-$ignoreErrors[] = [
-	'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$sections type has no value type specified in iterable type array\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/system/View/View.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
 	'count' => 2,
@@ -15691,11 +15641,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/tests/system/Validation/ValidationTest.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Parameter \\#1 \\$params of method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) expects array\\|string\\|null, float given\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/tests/system/View/CellTest.php',
-];
 $ignoreErrors[] = [
 	'message' => '#^Property CodeIgniter\\\\View\\\\DecoratorsTest\\:\\:\\$loader \\(CodeIgniter\\\\Autoloader\\\\FileLocator\\) does not accept CodeIgniter\\\\Autoloader\\\\FileLocatorInterface\\.$#',
 	'count' => 1,
diff --git a/system/View/Cell.php b/system/View/Cell.php
index cafe13d161e0..28b249a60e1c 100644
--- a/system/View/Cell.php
+++ b/system/View/Cell.php
@@ -68,10 +68,10 @@ public function __construct(CacheInterface $cache)
     /**
      * Render a cell, returning its body as a string.
      *
-     * @param string            $library   Cell class and method name.
-     * @param array|string|null $params    Parameters to pass to the method.
-     * @param int               $ttl       Number of seconds to cache the cell.
-     * @param string|null       $cacheName Cache item name.
+     * @param string                            $library   Cell class and method name.
+     * @param array<string, string>|string|null $params    Parameters to pass to the method.
+     * @param int                               $ttl       Number of seconds to cache the cell.
+     * @param string|null                       $cacheName Cache item name.
      *
      * @throws ReflectionException
      */
@@ -117,9 +117,10 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
      * If a string, it should be in the format "key1=value key2=value".
      * It will be split and returned as an array.
      *
-     * @param array|string|null $params
+     * @param         array<string, string>|string|null       $params
+     * @phpstan-param array<string, string>|string|float|null $params
      *
-     * @return array
+     * @return array<string, string>
      */
     public function prepareParams($params)
     {
diff --git a/system/View/Filters.php b/system/View/Filters.php
index 56204c86c3d2..dde9ec6d663d 100644
--- a/system/View/Filters.php
+++ b/system/View/Filters.php
@@ -67,7 +67,7 @@ public static function date_modify($value, string $adjustment)
     /**
      * Returns the given default value if $value is empty or undefined.
      *
-     * @param array|bool|float|int|object|resource|string|null $value
+     * @param bool|float|int|list<string>|object|resource|string|null $value
      */
     public static function default($value, string $default): string
     {
diff --git a/system/View/View.php b/system/View/View.php
index 8f630d7b90f3..1aec11cab57b 100644
--- a/system/View/View.php
+++ b/system/View/View.php
@@ -55,7 +55,7 @@ class View implements RendererInterface
     /**
      * Data for rendering including Caching and Debug Toolbar data.
      *
-     * @var array
+     * @var array<string, mixed>
      */
     protected $renderVars = [];
 
@@ -86,7 +86,7 @@ class View implements RendererInterface
      * Cache stats about our performance here,
      * when CI_DEBUG = true
      *
-     * @var array
+     * @var list<float|string>
      */
     protected $performanceData = [];
 
@@ -120,7 +120,7 @@ class View implements RendererInterface
     /**
      * Holds the sections and their data.
      *
-     * @var array
+     * @var array<string, list<string>>
      */
     protected $sections = [];
 
@@ -393,6 +393,8 @@ public function resetData(): RendererInterface
 
     /**
      * Returns the current data that will be displayed in the view.
+     *
+     * @return array<string, mixed>
      */
     public function getData(): array
     {
@@ -477,7 +479,8 @@ public function renderSection(string $sectionName, bool $saveData = false)
     /**
      * Used within layout views to include additional views.
      *
-     * @param bool $saveData
+     * @param array<string, mixed>|null $options
+     * @param bool                      $saveData
      */
     public function include(string $view, ?array $options = null, $saveData = true): string
     {
@@ -487,6 +490,8 @@ public function include(string $view, ?array $options = null, $saveData = true):
     /**
      * Returns the performance data that might have been collected
      * during the execution. Used primarily in the Debug Toolbar.
+     *
+     * @return list<float|string>
      */
     public function getPerformanceData(): array
     {

From 93267dab39261b1f2ea0a46a1f86b3e49ba92979 Mon Sep 17 00:00:00 2001
From: Denny Septian Panggabean <xamidimura@gmail.com>
Date: Wed, 22 May 2024 15:19:25 +0700
Subject: [PATCH 3/3] docs: fix PHPDocs in View

---
 system/View/View.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/system/View/View.php b/system/View/View.php
index 1aec11cab57b..7b6bfea0bba5 100644
--- a/system/View/View.php
+++ b/system/View/View.php
@@ -86,7 +86,7 @@ class View implements RendererInterface
      * Cache stats about our performance here,
      * when CI_DEBUG = true
      *
-     * @var list<float|string>
+     * @var list<array{start: float, end: float, view: string}>
      */
     protected $performanceData = [];
 
@@ -491,7 +491,7 @@ public function include(string $view, ?array $options = null, $saveData = true):
      * Returns the performance data that might have been collected
      * during the execution. Used primarily in the Debug Toolbar.
      *
-     * @return list<float|string>
+     * @return list<array{start: float, end: float, view: string}>
      */
     public function getPerformanceData(): array
     {