Skip to content

Commit 16e2a2d

Browse files
committed
PHPStan level 8
1 parent b3d4db4 commit 16e2a2d

File tree

7 files changed

+7
-5
lines changed

7 files changed

+7
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"rector-setup": "cp composer.json composer.backup && composer require --dev rector/rector:^0.7 && mv composer.backup composer.json",
6565
"stan": "phpstan analyse",
6666
"stan-rebuild-baseline": "phpstan analyse --configuration phpstan.neon --error-format baselineNeon src/ > phpstan-baseline.neon",
67-
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^1.0.0 psalm/phar:^5.0 && mv composer.backup composer.json",
67+
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^2.0.0 psalm/phar:^5.0 && mv composer.backup composer.json",
6868
"test": "phpunit --stderr"
6969
}
7070
}

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 6
2+
level: 8
33
treatPhpDocTypesAsCertain: false
44
bootstrapFiles:
55
- tests/bootstrap.php

src/Validation/AuValidation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function postal(string $check): bool
5353
*/
5454
public static function phone(string $check): bool
5555
{
56-
$normalized = preg_replace('/(\s+|-|\(|\))/', '', preg_replace('/0011\s?61/', '+61', $check)); //remove spaces, parentheses and hyphens, convert full intl prefix.
56+
$normalized = (string)preg_replace('/(\s+|-|\(|\))/', '', (string)preg_replace('/0011\s?61/', '+61', $check)); //remove spaces, parentheses and hyphens, convert full intl prefix.
5757
$pattern = '/^(((0|\+61)[2378])(\d){8}|((0|\+61)[45](\d){2}|1300|1800|190[02])(\d){6}|(\+61)?180(\d){4}|(\+61)?13\d{4}|(\+61)?12[2-8](\d){1,7}|(\+61|0)14[12357](\d){6})$/';
5858

5959
return (bool)preg_match($pattern, $normalized);

src/Validation/BrValidation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public static function cnh(string $cnh): bool
192192
*/
193193
public static function cns(string $cns): bool
194194
{
195-
$cns = preg_replace('/[^0-9]/', '', $cns);
195+
$cns = (string)preg_replace('/[^0-9]/', '', $cns);
196196

197197
if (preg_match('/[1-2]\\d{10}00[0-1]\\d/', $cns) || preg_match('/[7-9]\\d{14}/', $cns)) {
198198
$len = strlen($cns);

src/Validation/FiValidation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public static function personId(string $check): bool
8585
}
8686
$list = array_values($list);
8787

88+
/** @phpstan-ignore-next-line */
8889
return $check[strlen($check) - 1] === $list[(int)(substr($check, 0, 6) . substr($check, 7, 3)) % 31];
8990
}
9091

src/Validation/JpValidation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function phone(string $check): bool
7272
*/
7373
public static function phoneDigits(string $check): bool
7474
{
75-
$check = preg_replace(['/[\s\-]/', '/\+81/'], ['', '0'], $check);
75+
$check = (string)preg_replace(['/[\s\-]/', '/\+81/'], ['', '0'], $check);
7676

7777
$pattern = '/^0(?:[1-9]0\d{8}|[1-9]{2}\d{7})$/';
7878

src/Validation/LocalizedValidation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public static function dateTime(string $string): bool
103103
*/
104104
public static function decimal(string $string): bool
105105
{
106+
/** @phpstan-ignore-next-line No-OP */
106107
return Number::parseFloat($string) !== false;
107108
}
108109
}

0 commit comments

Comments
 (0)