Skip to content

Commit 6c22cce

Browse files
authored
Merge pull request #7777 from jinny8813/0804_phpstan_helpers
Dev: Remove the Helpers ignore errors in phpstan-baseline.php
2 parents 0881e8a + 3c805e4 commit 6c22cce

File tree

4 files changed

+33
-41
lines changed

4 files changed

+33
-41
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,51 +1141,11 @@
11411141
'count' => 1,
11421142
'path' => __DIR__ . '/system/HTTP/UserAgent.php',
11431143
];
1144-
$ignoreErrors[] = [
1145-
'message' => '#^Function delete_cookie\\(\\) has no return type specified\\.$#',
1146-
'count' => 1,
1147-
'path' => __DIR__ . '/system/Helpers/cookie_helper.php',
1148-
];
1149-
$ignoreErrors[] = [
1150-
'message' => '#^Function set_cookie\\(\\) has no return type specified\\.$#',
1151-
'count' => 1,
1152-
'path' => __DIR__ . '/system/Helpers/cookie_helper.php',
1153-
];
11541144
$ignoreErrors[] = [
11551145
'message' => '#^Right side of && is always true\\.$#',
11561146
'count' => 1,
11571147
'path' => __DIR__ . '/system/Helpers/filesystem_helper.php',
11581148
];
1159-
$ignoreErrors[] = [
1160-
'message' => '#^Function d\\(\\) has no return type specified\\.$#',
1161-
'count' => 1,
1162-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1163-
];
1164-
$ignoreErrors[] = [
1165-
'message' => '#^Function d\\(\\) has parameter \\$vars with no type specified\\.$#',
1166-
'count' => 1,
1167-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1168-
];
1169-
$ignoreErrors[] = [
1170-
'message' => '#^Function dd\\(\\) has no return type specified\\.$#',
1171-
'count' => 2,
1172-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1173-
];
1174-
$ignoreErrors[] = [
1175-
'message' => '#^Function dd\\(\\) has parameter \\$vars with no type specified\\.$#',
1176-
'count' => 1,
1177-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1178-
];
1179-
$ignoreErrors[] = [
1180-
'message' => '#^Function trace\\(\\) has no return type specified\\.$#',
1181-
'count' => 2,
1182-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1183-
];
1184-
$ignoreErrors[] = [
1185-
'message' => '#^Function mock\\(\\) has no return type specified\\.$#',
1186-
'count' => 1,
1187-
'path' => __DIR__ . '/system/Helpers/test_helper.php',
1188-
];
11891149
$ignoreErrors[] = [
11901150
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#',
11911151
'count' => 1,

system/Helpers/cookie_helper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* @param bool|null $httpOnly True makes the cookie accessible via http(s) only (no javascript)
3535
* @param string|null $sameSite The cookie SameSite value
3636
*
37+
* @return void
38+
*
3739
* @see \CodeIgniter\HTTP\Response::setCookie()
3840
*/
3941
function set_cookie(
@@ -91,6 +93,8 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '')
9193
* @param string $path the cookie path
9294
* @param string $prefix the cookie prefix
9395
*
96+
* @return void
97+
*
9498
* @see \CodeIgniter\HTTP\Response::deleteCookie()
9599
*/
96100
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = '')

system/Helpers/kint_helper.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
/**
1717
* Prints a Kint debug report and exits.
1818
*
19-
* @param array ...$vars
19+
* @param array $vars
20+
*
21+
* @phpstan-return never
2022
*
2123
* @codeCoverageIgnore Can't be tested ... exits
2224
*/
@@ -31,6 +33,13 @@ function dd(...$vars)
3133
}
3234
} else {
3335
// In case that Kint is not loaded.
36+
/**
37+
* dd function
38+
*
39+
* @param array $vars
40+
*
41+
* @return int
42+
*/
3443
function dd(...$vars)
3544
{
3645
return 0;
@@ -40,6 +49,13 @@ function dd(...$vars)
4049

4150
if (! function_exists('d') && ! class_exists(Kint::class)) {
4251
// In case that Kint is not loaded.
52+
/**
53+
* d function
54+
*
55+
* @param array $vars
56+
*
57+
* @return int
58+
*/
4359
function d(...$vars)
4460
{
4561
return 0;
@@ -51,13 +67,23 @@ function d(...$vars)
5167
/**
5268
* Provides a backtrace to the current execution point, from Kint.
5369
*/
70+
/**
71+
* trace function
72+
*
73+
* @return void
74+
*/
5475
function trace()
5576
{
5677
Kint::$aliases[] = 'trace';
5778
Kint::trace();
5879
}
5980
} else {
6081
// In case that Kint is not loaded.
82+
/**
83+
* trace function
84+
*
85+
* @return int
86+
*/
6187
function trace()
6288
{
6389
return 0;

system/Helpers/test_helper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function fake($model, ?array $overrides = null, $persist = true)
4747
* Used within our test suite to mock certain system tools.
4848
*
4949
* @param string $className Fully qualified class name
50+
*
51+
* @return object
5052
*/
5153
function mock(string $className)
5254
{

0 commit comments

Comments
 (0)