Skip to content

Commit 4e0719b

Browse files
authored
Merge pull request #8848 from ddevsr/fix-phpdocs-view
docs: fix PHPDocs for `View`
2 parents 4100729 + 93267da commit 4e0719b

File tree

7 files changed

+85
-290
lines changed

7 files changed

+85
-290
lines changed

phpstan-baseline.php

Lines changed: 1 addition & 236 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,236 +8981,26 @@
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,
90078987
'path' => __DIR__ . '/system/View/Parser.php',
90088988
];
9009-
$ignoreErrors[] = [
9010-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:applyFilters\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#',
9011-
'count' => 1,
9012-
'path' => __DIR__ . '/system/View/Parser.php',
9013-
];
9014-
$ignoreErrors[] = [
9015-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:objectToArray\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#',
9016-
'count' => 1,
9017-
'path' => __DIR__ . '/system/View/Parser.php',
9018-
];
9019-
$ignoreErrors[] = [
9020-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:objectToArray\\(\\) return type has no value type specified in iterable type array\\.$#',
9021-
'count' => 1,
9022-
'path' => __DIR__ . '/system/View/Parser.php',
9023-
];
9024-
$ignoreErrors[] = [
9025-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
9026-
'count' => 1,
9027-
'path' => __DIR__ . '/system/View/Parser.php',
9028-
];
9029-
$ignoreErrors[] = [
9030-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parse\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9031-
'count' => 1,
9032-
'path' => __DIR__ . '/system/View/Parser.php',
9033-
];
9034-
$ignoreErrors[] = [
9035-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parsePair\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
9036-
'count' => 1,
9037-
'path' => __DIR__ . '/system/View/Parser.php',
9038-
];
9039-
$ignoreErrors[] = [
9040-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parsePair\\(\\) return type has no value type specified in iterable type array\\.$#',
9041-
'count' => 1,
9042-
'path' => __DIR__ . '/system/View/Parser.php',
9043-
];
9044-
$ignoreErrors[] = [
9045-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parseSingle\\(\\) return type has no value type specified in iterable type array\\.$#',
9046-
'count' => 1,
9047-
'path' => __DIR__ . '/system/View/Parser.php',
9048-
];
9049-
$ignoreErrors[] = [
9050-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:prepareReplacement\\(\\) has parameter \\$matches with no value type specified in iterable type array\\.$#',
9051-
'count' => 1,
9052-
'path' => __DIR__ . '/system/View/Parser.php',
9053-
];
9054-
$ignoreErrors[] = [
9055-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9056-
'count' => 1,
9057-
'path' => __DIR__ . '/system/View/Parser.php',
9058-
];
9059-
$ignoreErrors[] = [
9060-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9061-
'count' => 1,
9062-
'path' => __DIR__ . '/system/View/Parser.php',
9063-
];
90648989
$ignoreErrors[] = [
90658990
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:replaceSingle\\(\\) has parameter \\$pattern with no value type specified in iterable type array\\.$#',
90668991
'count' => 1,
90678992
'path' => __DIR__ . '/system/View/Parser.php',
90688993
];
9069-
$ignoreErrors[] = [
9070-
'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
9071-
'count' => 1,
9072-
'path' => __DIR__ . '/system/View/Parser.php',
9073-
];
9074-
$ignoreErrors[] = [
9075-
'message' => '#^Property CodeIgniter\\\\View\\\\Parser\\:\\:\\$dataContexts type has no value type specified in iterable type array\\.$#',
9076-
'count' => 1,
9077-
'path' => __DIR__ . '/system/View/Parser.php',
9078-
];
9079-
$ignoreErrors[] = [
9080-
'message' => '#^Property CodeIgniter\\\\View\\\\Parser\\:\\:\\$noparseBlocks type has no value type specified in iterable type array\\.$#',
9081-
'count' => 1,
9082-
'path' => __DIR__ . '/system/View/Parser.php',
9083-
];
9084-
$ignoreErrors[] = [
9085-
'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9086-
'count' => 1,
9087-
'path' => __DIR__ . '/system/View/RendererInterface.php',
9088-
];
9089-
$ignoreErrors[] = [
9090-
'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9091-
'count' => 1,
9092-
'path' => __DIR__ . '/system/View/RendererInterface.php',
9093-
];
9094-
$ignoreErrors[] = [
9095-
'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
9096-
'count' => 1,
9097-
'path' => __DIR__ . '/system/View/RendererInterface.php',
9098-
];
9099-
$ignoreErrors[] = [
9100-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#',
9101-
'count' => 1,
9102-
'path' => __DIR__ . '/system/View/Table.php',
9103-
];
9104-
$ignoreErrors[] = [
9105-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_defaultTemplate\\(\\) return type has no value type specified in iterable type array\\.$#',
9106-
'count' => 1,
9107-
'path' => __DIR__ . '/system/View/Table.php',
9108-
];
9109-
$ignoreErrors[] = [
9110-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_prepArgs\\(\\) has parameter \\$args with no value type specified in iterable type array\\.$#',
9111-
'count' => 1,
9112-
'path' => __DIR__ . '/system/View/Table.php',
9113-
];
9114-
$ignoreErrors[] = [
9115-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_prepArgs\\(\\) return type has no value type specified in iterable type array\\.$#',
9116-
'count' => 1,
9117-
'path' => __DIR__ . '/system/View/Table.php',
9118-
];
9119-
$ignoreErrors[] = [
9120-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_setFromArray\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
9121-
'count' => 1,
9122-
'path' => __DIR__ . '/system/View/Table.php',
9123-
];
9124-
$ignoreErrors[] = [
9125-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:generate\\(\\) has parameter \\$tableData with no value type specified in iterable type array\\.$#',
9126-
'count' => 1,
9127-
'path' => __DIR__ . '/system/View/Table.php',
9128-
];
9129-
$ignoreErrors[] = [
9130-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#',
9131-
'count' => 1,
9132-
'path' => __DIR__ . '/system/View/Table.php',
9133-
];
9134-
$ignoreErrors[] = [
9135-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) return type has no value type specified in iterable type array\\.$#',
9136-
'count' => 1,
9137-
'path' => __DIR__ . '/system/View/Table.php',
9138-
];
9139-
$ignoreErrors[] = [
9140-
'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:setTemplate\\(\\) has parameter \\$template with no value type specified in iterable type array\\.$#',
9141-
'count' => 1,
9142-
'path' => __DIR__ . '/system/View/Table.php',
9143-
];
91448994
$ignoreErrors[] = [
91458995
'message' => '#^Only booleans are allowed in an if condition, string\\|null given\\.$#',
91468996
'count' => 1,
91478997
'path' => __DIR__ . '/system/View/Table.php',
91488998
];
9149-
$ignoreErrors[] = [
9150-
'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$footing type has no value type specified in iterable type array\\.$#',
9151-
'count' => 1,
9152-
'path' => __DIR__ . '/system/View/Table.php',
9153-
];
91548999
$ignoreErrors[] = [
91559000
'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$function type has no signature specified for callable\\.$#',
91569001
'count' => 1,
91579002
'path' => __DIR__ . '/system/View/Table.php',
91589003
];
9159-
$ignoreErrors[] = [
9160-
'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$heading type has no value type specified in iterable type array\\.$#',
9161-
'count' => 1,
9162-
'path' => __DIR__ . '/system/View/Table.php',
9163-
];
9164-
$ignoreErrors[] = [
9165-
'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$rows type has no value type specified in iterable type array\\.$#',
9166-
'count' => 1,
9167-
'path' => __DIR__ . '/system/View/Table.php',
9168-
];
9169-
$ignoreErrors[] = [
9170-
'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$template type has no value type specified in iterable type array\\.$#',
9171-
'count' => 1,
9172-
'path' => __DIR__ . '/system/View/Table.php',
9173-
];
9174-
$ignoreErrors[] = [
9175-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#',
9176-
'count' => 1,
9177-
'path' => __DIR__ . '/system/View/View.php',
9178-
];
9179-
$ignoreErrors[] = [
9180-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getPerformanceData\\(\\) return type has no value type specified in iterable type array\\.$#',
9181-
'count' => 1,
9182-
'path' => __DIR__ . '/system/View/View.php',
9183-
];
9184-
$ignoreErrors[] = [
9185-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:include\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9186-
'count' => 1,
9187-
'path' => __DIR__ . '/system/View/View.php',
9188-
];
9189-
$ignoreErrors[] = [
9190-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9191-
'count' => 1,
9192-
'path' => __DIR__ . '/system/View/View.php',
9193-
];
9194-
$ignoreErrors[] = [
9195-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
9196-
'count' => 1,
9197-
'path' => __DIR__ . '/system/View/View.php',
9198-
];
9199-
$ignoreErrors[] = [
9200-
'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#',
9201-
'count' => 1,
9202-
'path' => __DIR__ . '/system/View/View.php',
9203-
];
9204-
$ignoreErrors[] = [
9205-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$data type has no value type specified in iterable type array\\.$#',
9206-
'count' => 1,
9207-
'path' => __DIR__ . '/system/View/View.php',
9208-
];
9209-
$ignoreErrors[] = [
9210-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$performanceData type has no value type specified in iterable type array\\.$#',
9211-
'count' => 1,
9212-
'path' => __DIR__ . '/system/View/View.php',
9213-
];
9214-
$ignoreErrors[] = [
9215-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$renderVars type has no value type specified in iterable type array\\.$#',
9216-
'count' => 1,
9217-
'path' => __DIR__ . '/system/View/View.php',
9218-
];
9219-
$ignoreErrors[] = [
9220-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$sections type has no value type specified in iterable type array\\.$#',
9221-
'count' => 1,
9222-
'path' => __DIR__ . '/system/View/View.php',
9223-
];
9224-
$ignoreErrors[] = [
9225-
'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$tempData type has no value type specified in iterable type array\\.$#',
9226-
'count' => 1,
9227-
'path' => __DIR__ . '/system/View/View.php',
9228-
];
92299004
$ignoreErrors[] = [
92309005
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
92319006
'count' => 2,
@@ -15866,11 +15641,6 @@
1586615641
'count' => 1,
1586715642
'path' => __DIR__ . '/tests/system/Validation/ValidationTest.php',
1586815643
];
15869-
$ignoreErrors[] = [
15870-
'message' => '#^Parameter \\#1 \\$params of method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) expects array\\|string\\|null, float given\\.$#',
15871-
'count' => 1,
15872-
'path' => __DIR__ . '/tests/system/View/CellTest.php',
15873-
];
1587415644
$ignoreErrors[] = [
1587515645
'message' => '#^Property CodeIgniter\\\\View\\\\DecoratorsTest\\:\\:\\$loader \\(CodeIgniter\\\\Autoloader\\\\FileLocator\\) does not accept CodeIgniter\\\\Autoloader\\\\FileLocatorInterface\\.$#',
1587615646
'count' => 1,
@@ -15992,15 +15762,10 @@
1599215762
'path' => __DIR__ . '/tests/system/View/TableTest.php',
1599315763
];
1599415764
$ignoreErrors[] = [
15995-
'message' => '#^Parameter \\#1 \\$array of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects array, string given\\.$#',
15765+
'message' => '#^Parameter \\#1 \\$array of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects array\\<int, string\\>, string given\\.$#',
1599615766
'count' => 1,
1599715767
'path' => __DIR__ . '/tests/system/View/TableTest.php',
1599815768
];
15999-
$ignoreErrors[] = [
16000-
'message' => '#^Parameter \\#1 \\$template of method CodeIgniter\\\\View\\\\Table\\:\\:setTemplate\\(\\) expects array, string given\\.$#',
16001-
'count' => 2,
16002-
'path' => __DIR__ . '/tests/system/View/TableTest.php',
16003-
];
1600415769
$ignoreErrors[] = [
1600515770
'message' => '#^Parameter \\#2 \\$columnLimit of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects int, string given\\.$#',
1600615771
'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
{

0 commit comments

Comments
 (0)