Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix PHPDocs for View #8848

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
237 changes: 1 addition & 236 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -8996,236 +8981,26 @@
'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,
'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,
'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' => '#^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,
'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' => '#^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,
Expand Down Expand Up @@ -15866,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,
Expand Down Expand Up @@ -15992,15 +15762,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,
Expand Down
13 changes: 7 additions & 6 deletions system/View/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion system/View/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Loading
Loading