Skip to content

Commit

Permalink
docs: fix PHPDocs for View
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevsr committed May 22, 2024
1 parent 02ada60 commit d88ad38
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 66 deletions.
55 changes: 0 additions & 55 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,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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
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
13 changes: 9 additions & 4 deletions system/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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 = [];

Expand Down Expand Up @@ -120,7 +120,7 @@ class View implements RendererInterface
/**
* Holds the sections and their data.
*
* @var array
* @var array<string, list<string>>
*/
protected $sections = [];

Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down

0 comments on commit d88ad38

Please sign in to comment.