Skip to content

Commit

Permalink
More-phpstan-typing
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-worman committed Feb 6, 2025
1 parent 56f34b8 commit af8c3a6
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 195 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ coverage
composer.lock
docs-api
phpunit.xml
.phpunit.result.cache
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"style-fix": "php-cs-fixer fix --verbose",
"test": "phpunit",
"testOnly": "phpunit --colors --filter",
"phpstan": "@php phpstan"
"phpstan": "@php phpstan",
"phpstan-generate-baseline": "@php phpstan --generate-baseline"
}
}
190 changes: 5 additions & 185 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
parameters:
ignoreErrors:
-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:addError\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:addError\\(\\) has parameter \\$more with no value type specified in iterable type array\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:addErrors\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:addErrors\\(\\) has parameter \\$errors with no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -26,32 +16,7 @@ parameters:
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:getErrors\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:getErrors\\(\\) has parameter \\$errorContext with no type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:isValid\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:numErrors\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:numErrors\\(\\) has parameter \\$errorContext with no type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:reset\\(\\) has no return type specified\\.$#"
message: "#^Method JsonSchema\\\\Constraints\\\\BaseConstraint\\:\\:getErrors\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

Expand All @@ -65,11 +30,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Ternary operator condition is always true\\.$#"
count: 2
path: src/JsonSchema/Constraints/BaseConstraint.php

-
message: "#^Cannot access property \\$additionalItems on stdClass\\|null\\.$#"
count: 3
Expand All @@ -80,16 +40,6 @@ parameters:
count: 6
path: src/JsonSchema/Constraints/CollectionConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\CollectionConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/CollectionConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\CollectionConstraint\\:\\:validateItems\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/CollectionConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\CollectionConstraint\\:\\:validateItems\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -105,61 +55,11 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/CollectionConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ConstConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/ConstConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkArray\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkConst\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkEnum\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkFormat\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkNumber\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkObject\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkObject\\(\\) has parameter \\$appliedDefaults with no type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkString\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkType\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkUndefined\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Constraint\\:\\:checkUndefined\\(\\) has parameter \\$fromDefault with no type specified\\.$#"
count: 1
Expand All @@ -170,31 +70,16 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/Constraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ConstraintInterface\\:\\:addError\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/ConstraintInterface.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ConstraintInterface\\:\\:addError\\(\\) has parameter \\$more with no value type specified in iterable type array\\.$#"
count: 1
path: src/JsonSchema/Constraints/ConstraintInterface.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ConstraintInterface\\:\\:addErrors\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/ConstraintInterface.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ConstraintInterface\\:\\:addErrors\\(\\) has parameter \\$errors with no value type specified in iterable type array\\.$#"
count: 1
path: src/JsonSchema/Constraints/ConstraintInterface.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ConstraintInterface\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/ConstraintInterface.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ConstraintInterface\\:\\:getErrors\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -205,49 +90,24 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/ConstraintInterface.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\EnumConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/EnumConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:addConfig\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:createInstanceFor\\(\\) should return JsonSchema\\\\Constraints\\\\BaseConstraint&JsonSchema\\\\Constraints\\\\ConstraintInterface but returns object\\.$#"
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:getErrorContext\\(\\) should return 1\\|2 but returns int\\.$#"
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:getSchemaStorage\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:getTypeCheck\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:removeConfig\\(\\) has no return type specified\\.$#"
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:getConfig\\(\\) should return int\\<0, 511\\> but returns int\\.$#"
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:setConfig\\(\\) has no return type specified\\.$#"
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:getErrorContext\\(\\) should return 1\\|2 but returns int\\.$#"
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\Factory\\:\\:setErrorContext\\(\\) has no return type specified\\.$#"
count: 1
message: "#^Property JsonSchema\\\\Constraints\\\\Factory\\:\\:\\$checkMode \\(int\\<0, 511\\>\\) does not accept int\\.$#"
count: 2
path: src/JsonSchema/Constraints/Factory.php

-
Expand All @@ -265,11 +125,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/Factory.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/FormatConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\FormatConstraint\\:\\:validateColor\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -335,11 +190,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/FormatConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\NumberConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/NumberConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\NumberConstraint\\:\\:fmod\\(\\) has no return type specified\\.$#"
count: 1
Expand All @@ -365,11 +215,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/ObjectConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/ObjectConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\ObjectConstraint\\:\\:check\\(\\) has parameter \\$additionalProp with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -430,16 +275,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/ObjectConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\SchemaConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/SchemaConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\StringConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/StringConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\StringConstraint\\:\\:strlen\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -700,11 +535,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\TypeConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/TypeConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\TypeConstraint\\:\\:implodeWith\\(\\) has parameter \\$elements with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -755,11 +585,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/UndefinedConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:check\\(\\) has no return type specified\\.$#"
count: 1
path: src/JsonSchema/Constraints/UndefinedConstraint.php

-
message: "#^Method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:check\\(\\) has parameter \\$fromDefault with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -805,11 +630,6 @@ parameters:
count: 1
path: src/JsonSchema/Constraints/UndefinedConstraint.php

-
message: "#^Parameter \\#1 \\$requiredOnly of method JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:shouldApplyDefaultValue\\(\\) expects bool, int given\\.$#"
count: 3
path: src/JsonSchema/Constraints/UndefinedConstraint.php

-
message: "#^Property JsonSchema\\\\Constraints\\\\UndefinedConstraint\\:\\:\\$appliedDefaults type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
paths:
- ./src/
ignoreErrors: []
phpVersion: 70200

includes:
- phpstan-baseline.neon
Expand Down
Loading

0 comments on commit af8c3a6

Please sign in to comment.