Skip to content

Commit

Permalink
Update phpstan to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
bram123 committed Dec 30, 2024
1 parent 1b77f76 commit 2833d43
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"lock": false
},
"autoload": {
"psr-4": {
Expand All @@ -30,12 +31,15 @@
"squizlabs/php_codesniffer": "^3.6",
"phpmd/phpmd": "^2.14",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpstan/extension-installer": "^1.3"
},
"scripts": {
"baseline": ["@baseline:phpstan", "@baseline:phpmd"],
"baseline:phpstan": "phpstan --generate-baseline",
"baseline:phpmd": "phpmd src,tests xml phpmd.xml.dist --generate-baseline",
"check": ["@check:phpstan", "@check:phpmd", "@check:phpcs"],
"check:phpstan": "phpstan analyse",
"check:phpmd": "phpmd src,tests text phpmd.xml.dist --suffixes php",
Expand Down
4 changes: 4 additions & 0 deletions phpmd.baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<phpmd-baseline>
<violation rule="PHPMD\Rule\CyclomaticComplexity" file="src/Constraint/ConstraintResolver.php" method="resolveConstraint"/>
</phpmd-baseline>
15 changes: 14 additions & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
parameters:
ignoreErrors:
-
message: "#^Method DigitalRevolution\\\\SymfonyValidationShorthand\\\\Rule\\\\RuleParser\\:\\:parseParameters\\(\\) should return array\\<string\\> but returns array\\<int, string\\|null\\>\\.$#"
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\.$#'
identifier: argument.type
count: 1
path: src/Constraint/ConstraintCollectionBuilder.php

-
message: '#^Parameter \#1 \$constraints of class Symfony\\Component\\Validator\\Constraints\\All constructor expects array\<mixed\>\|null, array\<Symfony\\Component\\Validator\\Constraint\>\|Symfony\\Component\\Validator\\Constraint given\.$#'
identifier: argument.type
count: 2
path: src/Constraint/ConstraintCollectionBuilder.php

-
message: '#^Method DigitalRevolution\\SymfonyValidationShorthand\\Rule\\RuleParser\:\:parseParameters\(\) should return array\<string\> but returns list\<string\|null\>\.$#'
identifier: return.type
count: 1
path: src/Rule/RuleParser.php
1 change: 0 additions & 1 deletion src/Constraint/ConstraintResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function resolveRuleList(RuleList $ruleList): array

/**
* @throws InvalidRuleException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
private function resolveConstraint(RuleList $ruleList, Rule $rule): Constraint
{
Expand Down
1 change: 1 addition & 0 deletions src/Constraint/Type/BooleanValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

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

protected const ERROR_NAMES = [
Expand Down
4 changes: 3 additions & 1 deletion src/Constraint/Type/FloatNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

class FloatNumber extends Constraint
{
/** @var string */
public const INVALID_DECIMAL_ERROR = 'f7dfa2ce-5efa-40d4-a8ba-f02968039c28';
public const INVALID_VALUE_TYPE = '24e24f8a-fe44-4865-8cec-53c419ac0e87';
/** @var string */
public const INVALID_VALUE_TYPE = '24e24f8a-fe44-4865-8cec-53c419ac0e87';

protected const ERROR_NAMES = [
self::INVALID_DECIMAL_ERROR => 'INVALID_DECIMAL_ERROR',
Expand Down
1 change: 1 addition & 0 deletions src/Constraint/Type/InConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

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

protected const ERROR_NAMES = [
Expand Down
4 changes: 3 additions & 1 deletion src/Constraint/Type/IntegerNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

class IntegerNumber extends Constraint
{
/** @var string */
public const INVALID_NUMBER_ERROR = 'fd2ba819-b3ad-4643-ae18-137817d63de9';
public const INVALID_VALUE_TYPE = 'af5ee700-4222-468a-8ff3-c3b394fc500b';
/** @var string */
public const INVALID_VALUE_TYPE = 'af5ee700-4222-468a-8ff3-c3b394fc500b';

protected const ERROR_NAMES = [
self::INVALID_NUMBER_ERROR => 'INVALID_NUMBER_ERROR',
Expand Down

0 comments on commit 2833d43

Please sign in to comment.