Skip to content

Commit b92fcc1

Browse files
committed
Upgrade phpstan version
1 parent 3ccced1 commit b92fcc1

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

composer.json

+4-9
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
"friendsofphp/php-cs-fixer": "^3.53",
2626
"jetbrains/phpstorm-attributes": "^1.0",
2727
"monolog/monolog": "^3.7",
28-
"phpstan/extension-installer": "^1.4",
29-
"phpstan/phpstan": "^1.11",
30-
"phpstan/phpstan-strict-rules": "^1.6",
28+
"phpstan/phpstan": "^2.0",
29+
"phpstan/phpstan-strict-rules": "^2.0",
30+
"phpstan/phpstan-deprecation-rules": "^2.0",
3131
"phpunit/phpunit": "^10.5|^11.0",
32-
"rector/rector": "^1.1",
3332
"symfony/cache": "^5.4|^6.0|^7.0",
3433
"symfony/expression-language": "^5.4|^6.0|^7.0",
3534
"symfony/property-access": "^5.4|^6.0|^7.0",
@@ -74,11 +73,7 @@
7473

7574
"phpcs": "@phpcs:check",
7675
"phpcs:check": "php-cs-fixer fix --config=.php-cs-fixer.php --allow-risky=yes --dry-run --verbose --diff",
77-
"phpcs:fix": "php-cs-fixer fix --config=.php-cs-fixer.php --allow-risky=yes --verbose --diff",
78-
79-
"rector": "@rector:check",
80-
"rector:check": "rector --dry-run --config=rector.php",
81-
"rector:fix": "rector --config=rector.php"
76+
"phpcs:fix": "php-cs-fixer fix --config=.php-cs-fixer.php --allow-risky=yes --verbose --diff"
8277
},
8378
"minimum-stability": "dev",
8479
"prefer-stable": true

phpstan.neon

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
includes:
22
- phar://phpstan.phar/conf/bleedingEdge.neon
3+
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
4+
- vendor/phpstan/phpstan-strict-rules/rules.neon
35
parameters:
4-
level: 9
6+
level: max
57
strictRules:
68
allRules: true
79
fileExtensions:

rector.php

-15
This file was deleted.

src/Type/StringType.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@
99

1010
class StringType implements TypeInterface
1111
{
12+
/** @var string */
1213
protected const NULL_TO_STRING = '';
14+
/** @var string */
1315
protected const TRUE_TO_STRING = 'true';
16+
/** @var string */
1417
protected const FALSE_TO_STRING = 'false';
18+
/** @var string */
1519
protected const NAN_TO_STRING = 'nan';
20+
/** @var string */
1621
protected const INF_TO_STRING = 'inf';
1722

1823
public function match(mixed $value, Context $context): bool
@@ -56,16 +61,16 @@ protected function convertToString(mixed $value, Context $context): string
5661
$value === \INF => static::INF_TO_STRING,
5762
$value === -\INF => '-' . static::INF_TO_STRING,
5863
// Non-zero float number
59-
\str_contains($result = (string) $value, '.') => $result,
64+
\str_contains($result = (string)$value, '.') => $result,
6065
// Integer-like float number
6166
default => \number_format($value, 1, '.', ''),
6267
},
6368
// Int
6469
\is_int($value),
6570
// Stringable
66-
$value instanceof \Stringable => (string) $value,
71+
$value instanceof \Stringable => (string)$value,
6772
// Enum
68-
$value instanceof \BackedEnum => (string) $value->value,
73+
$value instanceof \BackedEnum => (string)$value->value,
6974
default => throw InvalidValueException::createFromContext(
7075
value: $value,
7176
context: $context,

0 commit comments

Comments
 (0)