Skip to content

Commit e0a1094

Browse files
authored
Merge pull request #7770 from ping-yee/230804-phpstan-honeypot-i18n
Dev: Remove the `Honeypot` and `I18n` ignore errors in phpstan-baseline.php
2 parents 0e70713 + 163e1c4 commit e0a1094

File tree

4 files changed

+28
-50
lines changed

4 files changed

+28
-50
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,56 +1146,6 @@
11461146
'count' => 1,
11471147
'path' => __DIR__ . '/system/Helpers/filesystem_helper.php',
11481148
];
1149-
$ignoreErrors[] = [
1150-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#',
1151-
'count' => 1,
1152-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1153-
];
1154-
$ignoreErrors[] = [
1155-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoNameField\\(\\) has no return type specified\\.$#',
1156-
'count' => 1,
1157-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1158-
];
1159-
$ignoreErrors[] = [
1160-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoTemplate\\(\\) has no return type specified\\.$#',
1161-
'count' => 1,
1162-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1163-
];
1164-
$ignoreErrors[] = [
1165-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:isBot\\(\\) has no return type specified\\.$#',
1166-
'count' => 1,
1167-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1168-
];
1169-
$ignoreErrors[] = [
1170-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:attachHoneypot\\(\\) has no return type specified\\.$#',
1171-
'count' => 1,
1172-
'path' => __DIR__ . '/system/Honeypot/Honeypot.php',
1173-
];
1174-
$ignoreErrors[] = [
1175-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:hasContent\\(\\) has no return type specified\\.$#',
1176-
'count' => 1,
1177-
'path' => __DIR__ . '/system/Honeypot/Honeypot.php',
1178-
];
1179-
$ignoreErrors[] = [
1180-
'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:setTestNow\\(\\) has no return type specified\\.$#',
1181-
'count' => 1,
1182-
'path' => __DIR__ . '/system/I18n/Time.php',
1183-
];
1184-
$ignoreErrors[] = [
1185-
'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#',
1186-
'count' => 1,
1187-
'path' => __DIR__ . '/system/I18n/Time.php',
1188-
];
1189-
$ignoreErrors[] = [
1190-
'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:setTestNow\\(\\) has no return type specified\\.$#',
1191-
'count' => 1,
1192-
'path' => __DIR__ . '/system/I18n/TimeLegacy.php',
1193-
];
1194-
$ignoreErrors[] = [
1195-
'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#',
1196-
'count' => 1,
1197-
'path' => __DIR__ . '/system/I18n/TimeLegacy.php',
1198-
];
11991149
$ignoreErrors[] = [
12001150
'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#',
12011151
'count' => 1,

system/Honeypot/Exceptions/HoneypotException.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,41 @@
1616

1717
class HoneypotException extends ConfigException implements ExceptionInterface
1818
{
19+
/**
20+
* Thrown when the template value of config is empty.
21+
*
22+
* @return static
23+
*/
1924
public static function forNoTemplate()
2025
{
2126
return new static(lang('Honeypot.noTemplate'));
2227
}
2328

29+
/**
30+
* Thrown when the name value of config is empty.
31+
*
32+
* @return static
33+
*/
2434
public static function forNoNameField()
2535
{
2636
return new static(lang('Honeypot.noNameField'));
2737
}
2838

39+
/**
40+
* Thrown when the hidden value of config is false.
41+
*
42+
* @return static
43+
*/
2944
public static function forNoHiddenValue()
3045
{
3146
return new static(lang('Honeypot.noHiddenValue'));
3247
}
3348

49+
/**
50+
* Thrown when there are no data in the request of honeypot field.
51+
*
52+
* @return static
53+
*/
3454
public static function isBot()
3555
{
3656
return new static(lang('Honeypot.theClientIsABot'));

system/Honeypot/Honeypot.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public function __construct(HoneypotConfig $config)
5959

6060
/**
6161
* Checks the request if honeypot field has data.
62+
*
63+
* @return bool
6264
*/
6365
public function hasContent(RequestInterface $request)
6466
{
@@ -69,6 +71,8 @@ public function hasContent(RequestInterface $request)
6971

7072
/**
7173
* Attaches Honeypot template to response.
74+
*
75+
* @return void
7276
*/
7377
public function attachHoneypot(ResponseInterface $response)
7478
{

system/I18n/TimeTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ public function toDateTime()
320320
* @param DateTimeInterface|self|string|null $datetime
321321
* @param DateTimeZone|string|null $timezone
322322
*
323+
* @return void
324+
*
323325
* @throws Exception
324326
*/
325327
public static function setTestNow($datetime = null, $timezone = null, ?string $locale = null)
@@ -845,6 +847,8 @@ public function subYears(int $years)
845847
/**
846848
* Returns the localized value of the date in the format 'Y-m-d H:i:s'
847849
*
850+
* @return false|string
851+
*
848852
* @throws Exception
849853
*/
850854
public function toDateTimeString()

0 commit comments

Comments
 (0)