Skip to content

Commit

Permalink
Merge pull request #82 from laminas/renovate/vimeo-psalm-5.x
Browse files Browse the repository at this point in the history
Update dependency vimeo/psalm to v5, improved exception messages for invalid inputs
  • Loading branch information
Ocramius authored Jan 9, 2023
2 parents 4941dd5 + 8a34dfb commit e97663a
Show file tree
Hide file tree
Showing 9 changed files with 456 additions and 481 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"require-dev": {
"ext-json": "*",
"laminas/laminas-coding-standard": "~2.5.0",
"phpunit/phpunit": "^9.5.26",
"psalm/plugin-phpunit": "^0.18.0",
"phpunit/phpunit": "^9.5.27",
"psalm/plugin-phpunit": "^0.18.4",
"psr/http-message": "^1.0.1",
"vimeo/psalm": "^4.29.0",
"vimeo/psalm": "^5.4",
"webmozart/assert": "^1.11"
},
"suggest": {
Expand Down
517 changes: 299 additions & 218 deletions composer.lock

Large diffs are not rendered by default.

203 changes: 47 additions & 156 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.28.0@52e96bea381e6cb07a672aefec791a5817694a26">
<files psalm-version="5.4.0@62db5d4f6a7ae0a20f7cc5a4952d730272fc0863">
<file src="src/ArrayInput.php">
<DeprecatedInterface occurrences="1">
<code>ArrayInput</code>
</DeprecatedInterface>
<DeprecatedMethod occurrences="6">
<code>allowEmpty</code>
<code>allowEmpty</code>
<code>continueIfEmpty</code>
<code>continueIfEmpty</code>
<code>continueIfEmpty</code>
<code>injectNotEmptyValidator</code>
</DeprecatedMethod>
<DocblockTypeContradiction occurrences="1">
<code>is_array($value)</code>
</DocblockTypeContradiction>
Expand All @@ -28,14 +17,18 @@
<code>$value</code>
<code>$value</code>
</MixedAssignment>
<MoreSpecificImplementedParamType occurrences="1">
<MoreSpecificImplementedParamType occurrences="2">
<code>$value</code>
<code>$value</code>
</MoreSpecificImplementedParamType>
<NonInvariantDocblockPropertyType occurrences="1">
<code>$value</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="src/BaseInputFilter.php">
<DocblockTypeContradiction occurrences="1">
<code>$input instanceof InputInterface &amp;&amp; (empty($name) || is_int($name))</code>
</DocblockTypeContradiction>
<InvalidReturnStatement occurrences="1">
<code>$messages</code>
</InvalidReturnStatement>
Expand Down Expand Up @@ -71,10 +64,12 @@
</TooManyArguments>
</file>
<file src="src/CollectionInputFilter.php">
<ImplementedParamTypeMismatch occurrences="1">
<ImplementedParamTypeMismatch occurrences="2">
<code>$name</code>
<code>$name</code>
</ImplementedParamTypeMismatch>
<ImplementedReturnTypeMismatch occurrences="1">
<ImplementedReturnTypeMismatch occurrences="2">
<code>array&lt;array-key, array&lt;string, array&lt;array-key, string&gt;&gt;&gt;</code>
<code>array&lt;array-key, array&lt;string, array&lt;array-key, string&gt;&gt;&gt;</code>
</ImplementedReturnTypeMismatch>
<InvalidArgument occurrences="1">
Expand All @@ -87,12 +82,12 @@
<code>$this-&gt;invalidInputs</code>
<code>$this-&gt;validInputs</code>
</InvalidPropertyAssignmentValue>
<LessSpecificImplementedReturnType occurrences="1">
<LessSpecificImplementedReturnType occurrences="2">
<code>array&lt;array-key, array&gt;</code>
<code>array&lt;array-key, array&gt;</code>
</LessSpecificImplementedReturnType>
<MixedArgument occurrences="1">
<code>$data</code>
<code>$data</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$data</code>
Expand Down Expand Up @@ -146,30 +141,18 @@
</PossiblyUndefinedMethod>
</file>
<file src="src/FileInput.php">
<DeprecatedInterface occurrences="1">
<code>FileInput</code>
</DeprecatedInterface>
<DeprecatedMethod occurrences="2">
<code>allowEmpty</code>
<code>continueIfEmpty</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="1">
<code>$this-&gt;notEmptyValidator</code>
</DeprecatedProperty>
<InvalidPropertyAssignmentValue occurrences="1">
<code>$this-&gt;prepareRequiredValidationFailureMessage()</code>
</InvalidPropertyAssignmentValue>
<MixedAssignment occurrences="1">
<code>$rawValue</code>
</MixedAssignment>
<MoreSpecificImplementedParamType occurrences="1">
<MoreSpecificImplementedParamType occurrences="2">
<code>$value</code>
<code>$value</code>
</MoreSpecificImplementedParamType>
</file>
<file src="src/FileInput/HttpServerFileInputDecorator.php">
<DeprecatedInterface occurrences="1">
<code>HttpServerFileInputDecorator</code>
</DeprecatedInterface>
<MixedAssignment occurrences="5">
<code>$fileData</code>
<code>$newValue[]</code>
Expand All @@ -183,9 +166,6 @@
</RedundantCondition>
</file>
<file src="src/FileInput/PsrFileInputDecorator.php">
<DeprecatedInterface occurrences="1">
<code>PsrFileInputDecorator</code>
</DeprecatedInterface>
<MixedArgument occurrences="1">
<code>$rawValue[0]</code>
</MixedArgument>
Expand All @@ -211,28 +191,6 @@
</MoreSpecificImplementedParamType>
</file>
<file src="src/Input.php">
<DeprecatedInterface occurrences="1">
<code>Input</code>
</DeprecatedInterface>
<DeprecatedMethod occurrences="8">
<code>allowEmpty</code>
<code>allowEmpty</code>
<code>allowEmpty</code>
<code>continueIfEmpty</code>
<code>continueIfEmpty</code>
<code>injectNotEmptyValidator</code>
<code>setAllowEmpty</code>
<code>setContinueIfEmpty</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="7">
<code>$this-&gt;allowEmpty</code>
<code>$this-&gt;allowEmpty</code>
<code>$this-&gt;continueIfEmpty</code>
<code>$this-&gt;continueIfEmpty</code>
<code>$this-&gt;notEmptyValidator</code>
<code>$this-&gt;notEmptyValidator</code>
<code>$this-&gt;notEmptyValidator</code>
</DeprecatedProperty>
<DocblockTypeContradiction occurrences="1">
<code>is_array($this-&gt;errorMessage)</code>
</DocblockTypeContradiction>
Expand Down Expand Up @@ -273,8 +231,9 @@
<MixedArgument occurrences="1">
<code>$config</code>
</MixedArgument>
<MixedArrayAccess occurrences="1">
<MixedArrayAccess occurrences="2">
<code>$allConfig['input_filter_specs']</code>
<code>$allConfig['input_filter_specs'][$rName]</code>
</MixedArrayAccess>
<MixedAssignment occurrences="2">
<code>$allConfig</code>
Expand All @@ -290,13 +249,15 @@
</ParamNameMismatch>
</file>
<file src="src/InputFilterPluginManager.php">
<MethodSignatureMismatch occurrences="1">
<MethodSignatureMismatch occurrences="2">
<code>InputFilterPluginManager</code>
<code>InputFilterPluginManager</code>
</MethodSignatureMismatch>
<NonInvariantDocblockPropertyType occurrences="1">
<code>$factories</code>
</NonInvariantDocblockPropertyType>
<PropertyTypeCoercion occurrences="1">
<PropertyTypeCoercion occurrences="2">
<code>$this-&gt;initializers</code>
<code>$this-&gt;initializers</code>
</PropertyTypeCoercion>
</file>
Expand All @@ -314,11 +275,15 @@
</UndefinedDocblockClass>
</file>
<file src="src/OptionalInputFilter.php">
<ImplementedReturnTypeMismatch occurrences="1">
<ImplementedReturnTypeMismatch occurrences="2">
<code>array&lt;string, mixed&gt;|null</code>
<code>array&lt;string, mixed&gt;|null</code>
</ImplementedReturnTypeMismatch>
</file>
<file src="test/ArrayInputTest.php">
<ArgumentTypeCoercion occurrences="1">
<code>$valueMap</code>
</ArgumentTypeCoercion>
<ImplementedReturnTypeMismatch occurrences="2">
<code>string[]</code>
</ImplementedReturnTypeMismatch>
Expand Down Expand Up @@ -364,93 +329,67 @@
</RedundantCondition>
</file>
<file src="test/BaseInputFilterTest.php">
<InvalidArgument occurrences="3">
<code>$input</code>
<code>$input</code>
<InvalidArgument occurrences="1">
<code>['nested' =&gt; ['nested-input1', 'nested-input2']]</code>
</InvalidArgument>
<InvalidDocblock occurrences="1">
<code>public function addMethodArgumentsProvider(): array</code>
</InvalidDocblock>
<LessSpecificReturnStatement occurrences="1"/>
<MissingClosureParamType occurrences="7">
<code>$context</code>
<code>$context</code>
<code>$data</code>
<code>$data</code>
<MissingClosureParamType occurrences="2">
<code>$inputTypeData</code>
<code>$inputTypeData</code>
<code>$set</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="3"/>
<MixedArgument occurrences="6">
<code>$data</code>
<MissingClosureReturnType occurrences="2">
<code>static fn($inputTypeData) =&gt; $inputTypeData[1]</code>
<code>static fn($inputTypeData) =&gt; $inputTypeData[2]</code>
</MissingClosureReturnType>
<MixedArgument occurrences="4">
<code>$dataTypes['Traversable']($data)</code>
<code>$input</code>
<code>$input</code>
<code>$set[5]</code>
<code>$set[6]</code>
</MixedArgument>
<MixedArgumentTypeCoercion occurrences="6">
<code>$inputName</code>
<code>$inputName</code>
<code>$inputName</code>
<MixedArgumentTypeCoercion occurrences="3">
<code>$msg</code>
<code>$msg</code>
<code>$name</code>
</MixedArgumentTypeCoercion>
<MixedArrayAccess occurrences="12">
<MixedArrayAccess occurrences="5">
<code>$filter1-&gt;getValues()['nested']['nestedField1']</code>
<code>$filter1-&gt;getValues()['nested']['nestedField1']</code>
<code>$filter1-&gt;getValues()['nested']['nestedField1']</code>
<code>$inputTypeData[1]</code>
<code>$inputTypeData[2]</code>
<code>$set[0]</code>
<code>$set[0]</code>
<code>$set[2]</code>
<code>$set[5]</code>
<code>$set[5]</code>
<code>$set[6]</code>
<code>$set[6]</code>
</MixedArrayAccess>
<MixedArrayAssignment occurrences="3">
<code>$set[0]</code>
<code>$set[5]</code>
<code>$set[6]</code>
</MixedArrayAssignment>
<MixedArrayOffset occurrences="3">
<code>$set[0][$name]</code>
<code>$set[5][$name]</code>
<code>$set[6][$name]</code>
</MixedArrayOffset>
<MixedAssignment occurrences="12">
<code>$createMock</code>
</MixedArrayAssignment>
<MixedAssignment occurrences="9">
<code>$expectedRawValue</code>
<code>$expectedValue</code>
<code>$input</code>
<code>$input</code>
<code>$input</code>
<code>$name</code>
<code>$set[0][$name]</code>
<code>$set[5][$name]</code>
<code>$set[6][$name]</code>
<code>$tmpTemplate[2]</code>
<code>$tmpTemplate[3]</code>
</MixedAssignment>
<MixedFunctionCall occurrences="1">
<code>$createMock($set[2])</code>
</MixedFunctionCall>
<MixedInferredReturnType occurrences="1"/>
<MixedReturnTypeCoercion occurrences="2">
<code>$dataSets</code>
</MixedReturnTypeCoercion>
<MoreSpecificReturnType occurrences="1">
<code>array&lt;string, array{0: InputInterface, 1: null|string, 2: MockObject&amp;InputInterface}&gt;</code>
</MoreSpecificReturnType>
<NullArgument occurrences="1">
<code>null</code>
</NullArgument>
<PossiblyNullArgument occurrences="2">
<PossiblyInvalidArgument occurrences="3">
<code>$input</code>
<code>$input</code>
<code>$input</code>
</PossiblyInvalidArgument>
<PossiblyNullArgument occurrences="5">
<code>$expectedInputName</code>
<code>$expectedInputName</code>
<code>$expectedInputName</code>
<code>$expectedInputName</code>
<code>$expectedInputName</code>
</PossiblyNullArgument>
Expand All @@ -460,50 +399,7 @@
<code>isRequired</code>
</PossiblyUndefinedMethod>
</file>
<file src="test/CollectionInputFilterTest.php">
<ArgumentTypeCoercion occurrences="1">
<code>$expectedType</code>
</ArgumentTypeCoercion>
<InvalidArgument occurrences="1">
<code>testDataVsValid</code>
</InvalidArgument>
<InvalidReturnStatement occurrences="2"/>
<InvalidReturnType occurrences="2">
<code>array&lt;string, array{0: null|int, 1: bool}&gt;</code>
</InvalidReturnType>
<MissingClosureParamType occurrences="1">
<code>$set</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="3"/>
<MixedArgumentTypeCoercion occurrences="1">
<code>$inputFilter</code>
</MixedArgumentTypeCoercion>
<MixedArrayAccess occurrences="1">
<code>$set[3]</code>
</MixedArrayAccess>
<MixedArrayAssignment occurrences="1">
<code>$set[3]</code>
</MixedArrayAssignment>
<MixedAssignment occurrences="2">
<code>$inputFilter</code>
<code>$set[3]</code>
</MixedAssignment>
<MixedFunctionCall occurrences="1">
<code>$set[3]()</code>
</MixedFunctionCall>
<MixedReturnTypeCoercion occurrences="2">
<code>$dataSets</code>
</MixedReturnTypeCoercion>
</file>
<file src="test/FactoryTest.php">
<DeprecatedMethod occurrences="5">
<code>allowEmpty</code>
<code>allowEmpty</code>
<code>allowEmpty</code>
<code>allowEmpty</code>
<code>continueIfEmpty</code>
</DeprecatedMethod>
<InvalidArgument occurrences="1"/>
<PossiblyNullReference occurrences="2">
<code>getPluginManager</code>
<code>getPluginManager</code>
Expand Down Expand Up @@ -553,10 +449,10 @@
</TypeDoesNotContainType>
</file>
<file src="test/InputFilterAwareTraitTest.php">
<InvalidScalarArgument occurrences="2">
<InvalidArgument occurrences="2">
<code>InputFilterAwareTrait::class</code>
<code>InputFilterAwareTrait::class</code>
</InvalidScalarArgument>
</InvalidArgument>
<MixedMethodCall occurrences="4">
<code>getInputFilter</code>
<code>getInputFilter</code>
Expand Down Expand Up @@ -624,9 +520,4 @@
<code>isArray</code>
</RedundantCondition>
</file>
<file src="test/TestAsset/CustomInput.php">
<DeprecatedInterface occurrences="1">
<code>CustomInput</code>
</DeprecatedInterface>
</file>
</files>
Loading

0 comments on commit e97663a

Please sign in to comment.