Skip to content

Commit 103ce75

Browse files
authored
Update phpstan to v2 (#54)
1 parent 1b77f76 commit 103ce75

File tree

8 files changed

+28
-8
lines changed

8 files changed

+28
-8
lines changed

composer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"sort-packages": true,
99
"allow-plugins": {
1010
"phpstan/extension-installer": true
11-
}
11+
},
12+
"lock": false
1213
},
1314
"autoload": {
1415
"psr-4": {
@@ -30,12 +31,15 @@
3031
"squizlabs/php_codesniffer": "^3.6",
3132
"phpmd/phpmd": "^2.14",
3233
"phpunit/phpunit": "^9.5",
33-
"phpstan/phpstan": "^1.10",
34-
"phpstan/phpstan-phpunit": "^1.3",
35-
"phpstan/phpstan-strict-rules": "^1.5",
34+
"phpstan/phpstan": "^2.0",
35+
"phpstan/phpstan-phpunit": "^2.0",
36+
"phpstan/phpstan-strict-rules": "^2.0",
3637
"phpstan/extension-installer": "^1.3"
3738
},
3839
"scripts": {
40+
"baseline": ["@baseline:phpstan", "@baseline:phpmd"],
41+
"baseline:phpstan": "phpstan --generate-baseline",
42+
"baseline:phpmd": "phpmd src,tests xml phpmd.xml.dist --generate-baseline",
3943
"check": ["@check:phpstan", "@check:phpmd", "@check:phpcs"],
4044
"check:phpstan": "phpstan analyse",
4145
"check:phpmd": "phpmd src,tests text phpmd.xml.dist --suffixes php",

phpmd.baseline.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0"?>
2+
<phpmd-baseline>
3+
<violation rule="PHPMD\Rule\CyclomaticComplexity" file="src/Constraint/ConstraintResolver.php" method="resolveConstraint"/>
4+
</phpmd-baseline>

phpstan-baseline.neon

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Method DigitalRevolution\\\\SymfonyValidationShorthand\\\\Rule\\\\RuleParser\\:\\:parseParameters\\(\\) should return array\\<string\\> but returns array\\<int, string\\|null\\>\\.$#"
4+
message: '#^Parameter \#1 \$constraintTreeMap of method DigitalRevolution\\SymfonyValidationShorthand\\Constraint\\ConstraintCollectionBuilder\:\:createConstraintTree\(\) expects array\<int\|string, array\<DigitalRevolution\\SymfonyValidationShorthand\\Constraint\\ConstraintMapItem\>\|DigitalRevolution\\SymfonyValidationShorthand\\Constraint\\ConstraintMapItem\>, array\<mixed\> given\.$#'
5+
identifier: argument.type
6+
count: 1
7+
path: src/Constraint/ConstraintCollectionBuilder.php
8+
9+
-
10+
message: '#^Method DigitalRevolution\\SymfonyValidationShorthand\\Rule\\RuleParser\:\:parseParameters\(\) should return array\<string\> but returns list\<string\|null\>\.$#'
11+
identifier: return.type
512
count: 1
613
path: src/Rule/RuleParser.php

src/Constraint/ConstraintResolver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function resolveRuleList(RuleList $ruleList): array
5555

5656
/**
5757
* @throws InvalidRuleException
58-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
5958
*/
6059
private function resolveConstraint(RuleList $ruleList, Rule $rule): Constraint
6160
{

src/Constraint/Type/BooleanValue.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
class BooleanValue extends Constraint
99
{
10+
/** @var string */
1011
public const INVALID_BOOLEAN_ERROR = '83f4a7ef-a109-469e-941a-7fa757c73e22';
1112

1213
protected const ERROR_NAMES = [

src/Constraint/Type/FloatNumber.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
class FloatNumber extends Constraint
99
{
10+
/** @var string */
1011
public const INVALID_DECIMAL_ERROR = 'f7dfa2ce-5efa-40d4-a8ba-f02968039c28';
11-
public const INVALID_VALUE_TYPE = '24e24f8a-fe44-4865-8cec-53c419ac0e87';
12+
/** @var string */
13+
public const INVALID_VALUE_TYPE = '24e24f8a-fe44-4865-8cec-53c419ac0e87';
1214

1315
protected const ERROR_NAMES = [
1416
self::INVALID_DECIMAL_ERROR => 'INVALID_DECIMAL_ERROR',

src/Constraint/Type/InConstraint.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
class InConstraint extends Constraint
99
{
10+
/** @var string */
1011
public const NOT_IN_ERROR = '790265f3-05de-47d1-ae0a-1332f5299daf';
1112

1213
protected const ERROR_NAMES = [

src/Constraint/Type/IntegerNumber.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
class IntegerNumber extends Constraint
99
{
10+
/** @var string */
1011
public const INVALID_NUMBER_ERROR = 'fd2ba819-b3ad-4643-ae18-137817d63de9';
11-
public const INVALID_VALUE_TYPE = 'af5ee700-4222-468a-8ff3-c3b394fc500b';
12+
/** @var string */
13+
public const INVALID_VALUE_TYPE = 'af5ee700-4222-468a-8ff3-c3b394fc500b';
1214

1315
protected const ERROR_NAMES = [
1416
self::INVALID_NUMBER_ERROR => 'INVALID_NUMBER_ERROR',

0 commit comments

Comments
 (0)