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

Dev: Remove the Helpers ignore errors in phpstan-baseline.php #7776

Closed
wants to merge 2 commits into from
Closed
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
40 changes: 0 additions & 40 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -1246,51 +1246,11 @@
'count' => 1,
'path' => __DIR__ . '/system/HTTP/UserAgent.php',
];
$ignoreErrors[] = [
'message' => '#^Function delete_cookie\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Helpers/cookie_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Function set_cookie\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Helpers/cookie_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Right side of && is always true\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Helpers/filesystem_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Function d\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Function d\\(\\) has parameter \\$vars with no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Function dd\\(\\) has no return type specified\\.$#',
'count' => 2,
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Function dd\\(\\) has parameter \\$vars with no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Function trace\\(\\) has no return type specified\\.$#',
'count' => 2,
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Function mock\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Helpers/test_helper.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#',
'count' => 1,
Expand Down
4 changes: 4 additions & 0 deletions system/Helpers/cookie_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* @param bool|null $httpOnly True makes the cookie accessible via http(s) only (no javascript)
* @param string|null $sameSite The cookie SameSite value
*
* @return void
*
* @see \CodeIgniter\HTTP\Response::setCookie()
*/
function set_cookie(
Expand Down Expand Up @@ -91,6 +93,8 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '')
* @param string $path the cookie path
* @param string $prefix the cookie prefix
*
* @return void
*
* @see \CodeIgniter\HTTP\Response::deleteCookie()
*/
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = '')
Expand Down
16 changes: 15 additions & 1 deletion system/Helpers/kint_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
/**
* Prints a Kint debug report and exits.
*
* @param array ...$vars
* @param mixed $vars
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param mixed $vars
* @param array ...$vars

Dont use mixed, we want specify type. Applies to all

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #6310

*
* @return void
*
* @codeCoverageIgnore Can't be tested ... exits
*/
Expand All @@ -40,6 +42,13 @@ function dd(...$vars)

if (! function_exists('d') && ! class_exists(Kint::class)) {
// In case that Kint is not loaded.
/**
* d function
*
* @param mixed $vars
*
* @return void
*/
function d(...$vars)
{
return 0;
Expand All @@ -58,6 +67,11 @@ function trace()
}
} else {
// In case that Kint is not loaded.
/**
* trace function
*
* @return void
*/
function trace()
{
return 0;
Expand Down
2 changes: 2 additions & 0 deletions system/Helpers/test_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function fake($model, ?array $overrides = null, $persist = true)
* Used within our test suite to mock certain system tools.
*
* @param string $className Fully qualified class name
*
* @return void
*/
function mock(string $className)
{
Expand Down