Skip to content

Commit b897039

Browse files
committed
dev: phpstan helpers
1 parent 152a7a1 commit b897039

4 files changed

Lines changed: 33 additions & 41 deletions

File tree

phpstan-baseline.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,51 +1246,11 @@
12461246
'count' => 1,
12471247
'path' => __DIR__ . '/system/HTTP/UserAgent.php',
12481248
];
1249-
$ignoreErrors[] = [
1250-
'message' => '#^Function delete_cookie\\(\\) has no return type specified\\.$#',
1251-
'count' => 1,
1252-
'path' => __DIR__ . '/system/Helpers/cookie_helper.php',
1253-
];
1254-
$ignoreErrors[] = [
1255-
'message' => '#^Function set_cookie\\(\\) has no return type specified\\.$#',
1256-
'count' => 1,
1257-
'path' => __DIR__ . '/system/Helpers/cookie_helper.php',
1258-
];
12591249
$ignoreErrors[] = [
12601250
'message' => '#^Right side of && is always true\\.$#',
12611251
'count' => 1,
12621252
'path' => __DIR__ . '/system/Helpers/filesystem_helper.php',
12631253
];
1264-
$ignoreErrors[] = [
1265-
'message' => '#^Function d\\(\\) has no return type specified\\.$#',
1266-
'count' => 1,
1267-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1268-
];
1269-
$ignoreErrors[] = [
1270-
'message' => '#^Function d\\(\\) has parameter \\$vars with no type specified\\.$#',
1271-
'count' => 1,
1272-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1273-
];
1274-
$ignoreErrors[] = [
1275-
'message' => '#^Function dd\\(\\) has no return type specified\\.$#',
1276-
'count' => 2,
1277-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1278-
];
1279-
$ignoreErrors[] = [
1280-
'message' => '#^Function dd\\(\\) has parameter \\$vars with no type specified\\.$#',
1281-
'count' => 1,
1282-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1283-
];
1284-
$ignoreErrors[] = [
1285-
'message' => '#^Function trace\\(\\) has no return type specified\\.$#',
1286-
'count' => 2,
1287-
'path' => __DIR__ . '/system/Helpers/kint_helper.php',
1288-
];
1289-
$ignoreErrors[] = [
1290-
'message' => '#^Function mock\\(\\) has no return type specified\\.$#',
1291-
'count' => 1,
1292-
'path' => __DIR__ . '/system/Helpers/test_helper.php',
1293-
];
12941254
$ignoreErrors[] = [
12951255
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#',
12961256
'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+
* @return void
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 int
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)