Skip to content

Commit a826f93

Browse files
committed
Dev: Remove the Security and Validation ignore errors in phpstan-baseline.php
1 parent 6ec3a09 commit a826f93

5 files changed

Lines changed: 15 additions & 69 deletions

File tree

phpstan-baseline.php

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,26 +1746,6 @@
17461746
'count' => 1,
17471747
'path' => __DIR__ . '/system/Router/RouterInterface.php',
17481748
];
1749-
$ignoreErrors[] = [
1750-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forDisallowedAction\\(\\) has no return type specified\\.$#',
1751-
'count' => 1,
1752-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1753-
];
1754-
$ignoreErrors[] = [
1755-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidControlChars\\(\\) has no return type specified\\.$#',
1756-
'count' => 1,
1757-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1758-
];
1759-
$ignoreErrors[] = [
1760-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidSameSite\\(\\) has no return type specified\\.$#',
1761-
'count' => 1,
1762-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1763-
];
1764-
$ignoreErrors[] = [
1765-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidUTF8Chars\\(\\) has no return type specified\\.$#',
1766-
'count' => 1,
1767-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1768-
];
17691749
$ignoreErrors[] = [
17701750
'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forEmptySavepath\\(\\) has no return type specified\\.$#',
17711751
'count' => 1,
@@ -2531,51 +2511,11 @@
25312511
'count' => 1,
25322512
'path' => __DIR__ . '/system/Throttle/Throttler.php',
25332513
];
2534-
$ignoreErrors[] = [
2535-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forGroupNotArray\\(\\) has no return type specified\\.$#',
2536-
'count' => 1,
2537-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2538-
];
2539-
$ignoreErrors[] = [
2540-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forGroupNotFound\\(\\) has no return type specified\\.$#',
2541-
'count' => 1,
2542-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2543-
];
2544-
$ignoreErrors[] = [
2545-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forInvalidTemplate\\(\\) has no return type specified\\.$#',
2546-
'count' => 1,
2547-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2548-
];
2549-
$ignoreErrors[] = [
2550-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forNoRuleSets\\(\\) has no return type specified\\.$#',
2551-
'count' => 1,
2552-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2553-
];
2554-
$ignoreErrors[] = [
2555-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forRuleNotFound\\(\\) has no return type specified\\.$#',
2556-
'count' => 1,
2557-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2558-
];
25592514
$ignoreErrors[] = [
25602515
'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:isClosure\\(\\) has parameter \\$rule with no signature specified for Closure\\.$#',
25612516
'count' => 1,
25622517
'path' => __DIR__ . '/system/Validation/Validation.php',
25632518
];
2564-
$ignoreErrors[] = [
2565-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:loadRuleSets\\(\\) has no return type specified\\.$#',
2566-
'count' => 1,
2567-
'path' => __DIR__ . '/system/Validation/Validation.php',
2568-
];
2569-
$ignoreErrors[] = [
2570-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:setRuleGroup\\(\\) has no return type specified\\.$#',
2571-
'count' => 1,
2572-
'path' => __DIR__ . '/system/Validation/Validation.php',
2573-
];
2574-
$ignoreErrors[] = [
2575-
'message' => '#^Method CodeIgniter\\\\Validation\\\\ValidationInterface\\:\\:setRuleGroup\\(\\) has no return type specified\\.$#',
2576-
'count' => 1,
2577-
'path' => __DIR__ . '/system/Validation/ValidationInterface.php',
2578-
];
25792519
$ignoreErrors[] = [
25802520
'message' => '#^Call to an undefined static method CodeIgniter\\\\Config\\\\Factories\\:\\:cells\\(\\)\\.$#',
25812521
'count' => 1,

system/Security/Exceptions/SecurityException.php

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

1717
class SecurityException extends FrameworkException implements HTTPExceptionInterface
1818
{
19-
public static function forDisallowedAction()
19+
public static function forDisallowedAction(): SecurityException
2020
{
2121
return new static(lang('Security.disallowedAction'), 403);
2222
}
2323

24-
public static function forInvalidUTF8Chars(string $source, string $string)
24+
public static function forInvalidUTF8Chars(string $source, string $string): SecurityException
2525
{
2626
return new static(
2727
'Invalid UTF-8 characters in ' . $source . ': ' . $string,
2828
400
2929
);
3030
}
3131

32-
public static function forInvalidControlChars(string $source, string $string)
32+
public static function forInvalidControlChars(string $source, string $string): SecurityException
3333
{
3434
return new static(
3535
'Invalid Control characters in ' . $source . ': ' . $string,
@@ -42,7 +42,7 @@ public static function forInvalidControlChars(string $source, string $string)
4242
*
4343
* @codeCoverageIgnore
4444
*/
45-
public static function forInvalidSameSite(string $samesite)
45+
public static function forInvalidSameSite(string $samesite): SecurityException
4646
{
4747
return new static(lang('Security.invalidSameSite', [$samesite]));
4848
}

system/Validation/Exceptions/ValidationException.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@
1515

1616
class ValidationException extends FrameworkException
1717
{
18-
public static function forRuleNotFound(?string $rule = null)
18+
public static function forRuleNotFound(?string $rule = null): ValidationException
1919
{
2020
return new static(lang('Validation.ruleNotFound', [$rule]));
2121
}
2222

23-
public static function forGroupNotFound(?string $group = null)
23+
public static function forGroupNotFound(?string $group = null): ValidationException
2424
{
2525
return new static(lang('Validation.groupNotFound', [$group]));
2626
}
2727

28-
public static function forGroupNotArray(?string $group = null)
28+
public static function forGroupNotArray(?string $group = null): ValidationException
2929
{
3030
return new static(lang('Validation.groupNotArray', [$group]));
3131
}
3232

33-
public static function forInvalidTemplate(?string $template = null)
33+
public static function forInvalidTemplate(?string $template = null): ValidationException
3434
{
3535
return new static(lang('Validation.invalidTemplate', [$template]));
3636
}
3737

38-
public static function forNoRuleSets()
38+
public static function forNoRuleSets(): ValidationException
3939
{
4040
return new static(lang('Validation.noRuleSets'));
4141
}

system/Validation/Validation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ public function getRuleGroup(string $group): array
593593
*
594594
* @param string $group Group.
595595
*
596+
* @return void
597+
*
596598
* @throws ValidationException If group not found.
597599
*/
598600
public function setRuleGroup(string $group)
@@ -645,6 +647,8 @@ public function showError(string $field, string $template = 'single'): string
645647
/**
646648
* Loads all of the rulesets classes that have been defined in the
647649
* Config\Validation and stores them locally so we can use them.
650+
*
651+
* @return void
648652
*/
649653
protected function loadRuleSets()
650654
{

system/Validation/ValidationInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public function getRuleGroup(string $group): array;
9292
* Set rule group.
9393
*
9494
* @param string $group Group.
95+
*
96+
* @return void
9597
*/
9698
public function setRuleGroup(string $group);
9799

0 commit comments

Comments
 (0)