Skip to content

Commit d88ad38

Browse files
committed
docs: fix PHPDocs for View
1 parent 02ada60 commit d88ad38

File tree

4 files changed

+17
-66
lines changed

4 files changed

+17
-66
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8936,21 +8936,6 @@
89368936
'count' => 1,
89378937
'path' => __DIR__ . '/system/View/Cell.php',
89388938
];
8939-
$ignoreErrors[] = [
8940-
'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
8941-
'count' => 1,
8942-
'path' => __DIR__ . '/system/View/Cell.php',
8943-
];
8944-
$ignoreErrors[] = [
8945-
'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) return type has no value type specified in iterable type array\\.$#',
8946-
'count' => 1,
8947-
'path' => __DIR__ . '/system/View/Cell.php',
8948-
];
8949-
$ignoreErrors[] = [
8950-
'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:render\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
8951-
'count' => 1,
8952-
'path' => __DIR__ . '/system/View/Cell.php',
8953-
];
89548939
$ignoreErrors[] = [
89558940
'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:renderCell\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#',
89568941
'count' => 1,
@@ -8996,11 +8981,6 @@
89968981
'count' => 1,
89978982
'path' => __DIR__ . '/system/View/Cells/Cell.php',
89988983
];
8999-
$ignoreErrors[] = [
9000-
'message' => '#^Method CodeIgniter\\\\View\\\\Filters\\:\\:default\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#',
9001-
'count' => 1,
9002-
'path' => __DIR__ . '/system/View/Filters.php',
9003-
];
90048984
$ignoreErrors[] = [
90058985
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:addPlugin\\(\\) has parameter \\$callback with no signature specified for callable\\.$#',
90068986
'count' => 1,
@@ -9021,36 +9001,6 @@
90219001
'count' => 1,
90229002
'path' => __DIR__ . '/system/View/Table.php',
90239003
];
9024-
$ignoreErrors[] = [
9025-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#',
9026-
'count' => 1,
9027-
'path' => __DIR__ . '/system/View/View.php',
9028-
];
9029-
$ignoreErrors[] = [
9030-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getPerformanceData\\(\\) return type has no value type specified in iterable type array\\.$#',
9031-
'count' => 1,
9032-
'path' => __DIR__ . '/system/View/View.php',
9033-
];
9034-
$ignoreErrors[] = [
9035-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:include\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9036-
'count' => 1,
9037-
'path' => __DIR__ . '/system/View/View.php',
9038-
];
9039-
$ignoreErrors[] = [
9040-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$performanceData type has no value type specified in iterable type array\\.$#',
9041-
'count' => 1,
9042-
'path' => __DIR__ . '/system/View/View.php',
9043-
];
9044-
$ignoreErrors[] = [
9045-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$renderVars type has no value type specified in iterable type array\\.$#',
9046-
'count' => 1,
9047-
'path' => __DIR__ . '/system/View/View.php',
9048-
];
9049-
$ignoreErrors[] = [
9050-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$sections type has no value type specified in iterable type array\\.$#',
9051-
'count' => 1,
9052-
'path' => __DIR__ . '/system/View/View.php',
9053-
];
90549004
$ignoreErrors[] = [
90559005
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
90569006
'count' => 2,
@@ -15691,11 +15641,6 @@
1569115641
'count' => 1,
1569215642
'path' => __DIR__ . '/tests/system/Validation/ValidationTest.php',
1569315643
];
15694-
$ignoreErrors[] = [
15695-
'message' => '#^Parameter \\#1 \\$params of method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) expects array\\|string\\|null, float given\\.$#',
15696-
'count' => 1,
15697-
'path' => __DIR__ . '/tests/system/View/CellTest.php',
15698-
];
1569915644
$ignoreErrors[] = [
1570015645
'message' => '#^Property CodeIgniter\\\\View\\\\DecoratorsTest\\:\\:\\$loader \\(CodeIgniter\\\\Autoloader\\\\FileLocator\\) does not accept CodeIgniter\\\\Autoloader\\\\FileLocatorInterface\\.$#',
1570115646
'count' => 1,

system/View/Cell.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ public function __construct(CacheInterface $cache)
6868
/**
6969
* Render a cell, returning its body as a string.
7070
*
71-
* @param string $library Cell class and method name.
72-
* @param array|string|null $params Parameters to pass to the method.
73-
* @param int $ttl Number of seconds to cache the cell.
74-
* @param string|null $cacheName Cache item name.
71+
* @param string $library Cell class and method name.
72+
* @param array<string, string>|string|null $params Parameters to pass to the method.
73+
* @param int $ttl Number of seconds to cache the cell.
74+
* @param string|null $cacheName Cache item name.
7575
*
7676
* @throws ReflectionException
7777
*/
@@ -117,9 +117,10 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
117117
* If a string, it should be in the format "key1=value key2=value".
118118
* It will be split and returned as an array.
119119
*
120-
* @param array|string|null $params
120+
* @param array<string, string>|string|null $params
121+
* @phpstan-param array<string, string>|string|float|null $params
121122
*
122-
* @return array
123+
* @return array<string, string>
123124
*/
124125
public function prepareParams($params)
125126
{

system/View/Filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function date_modify($value, string $adjustment)
6767
/**
6868
* Returns the given default value if $value is empty or undefined.
6969
*
70-
* @param array|bool|float|int|object|resource|string|null $value
70+
* @param bool|float|int|list<string>|object|resource|string|null $value
7171
*/
7272
public static function default($value, string $default): string
7373
{

system/View/View.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class View implements RendererInterface
5555
/**
5656
* Data for rendering including Caching and Debug Toolbar data.
5757
*
58-
* @var array
58+
* @var array<string, mixed>
5959
*/
6060
protected $renderVars = [];
6161

@@ -86,7 +86,7 @@ class View implements RendererInterface
8686
* Cache stats about our performance here,
8787
* when CI_DEBUG = true
8888
*
89-
* @var array
89+
* @var list<float|string>
9090
*/
9191
protected $performanceData = [];
9292

@@ -120,7 +120,7 @@ class View implements RendererInterface
120120
/**
121121
* Holds the sections and their data.
122122
*
123-
* @var array
123+
* @var array<string, list<string>>
124124
*/
125125
protected $sections = [];
126126

@@ -393,6 +393,8 @@ public function resetData(): RendererInterface
393393

394394
/**
395395
* Returns the current data that will be displayed in the view.
396+
*
397+
* @return array<string, mixed>
396398
*/
397399
public function getData(): array
398400
{
@@ -477,7 +479,8 @@ public function renderSection(string $sectionName, bool $saveData = false)
477479
/**
478480
* Used within layout views to include additional views.
479481
*
480-
* @param bool $saveData
482+
* @param array<string, mixed>|null $options
483+
* @param bool $saveData
481484
*/
482485
public function include(string $view, ?array $options = null, $saveData = true): string
483486
{
@@ -487,6 +490,8 @@ public function include(string $view, ?array $options = null, $saveData = true):
487490
/**
488491
* Returns the performance data that might have been collected
489492
* during the execution. Used primarily in the Debug Toolbar.
493+
*
494+
* @return list<float|string>
490495
*/
491496
public function getPerformanceData(): array
492497
{

0 commit comments

Comments
 (0)