Skip to content

Commit

Permalink
Merge pull request #356 from gsteel/v3/refactor-file-count
Browse files Browse the repository at this point in the history
Refactor file `Count` validator
  • Loading branch information
gsteel authored Jul 11, 2024
2 parents 28b579e + 3777855 commit 3320ab8
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 482 deletions.
3 changes: 1 addition & 2 deletions docs/book/v3/validators/file/count.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ $validator = new Laminas\Validator\File\Count([
'max' => 5,
]);

// Setting to the $_FILES superglobal; could also use the laminas-http
// request's `getFiles()` or PSR-7 ServerRequest's `getUploadedFiles()`.
// Setting to the $_FILES superglobal or PSR-7 ServerRequest's `getUploadedFiles()`.
$files = $_FILES;

if ($validator->isValid($files)) {
Expand Down
55 changes: 1 addition & 54 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<code><![CDATA[$this->options]]></code>
<code><![CDATA[$this->options]]></code>
<code><![CDATA[$this->options]]></code>
<code><![CDATA[$this->options]]></code>
</UndefinedThisPropertyAssignment>
</file>
<file src="src/Barcode/Code128.php">
Expand Down Expand Up @@ -89,55 +90,6 @@
<code><![CDATA[isValid]]></code>
</TooManyArguments>
</file>
<file src="src/File/Count.php">
<DocblockTypeContradiction>
<code><![CDATA[is_string($options)]]></code>
</DocblockTypeContradiction>
<MixedArgumentTypeCoercion>
<code><![CDATA[$options]]></code>
</MixedArgumentTypeCoercion>
<MixedArrayOffset>
<code><![CDATA[$this->files[$name]]]></code>
<code><![CDATA[$this->files[$name]]]></code>
</MixedArrayOffset>
<MixedAssignment>
<code><![CDATA[$max]]></code>
<code><![CDATA[$min]]></code>
<code><![CDATA[$name]]></code>
</MixedAssignment>
<MixedInferredReturnType>
<code><![CDATA[int]]></code>
<code><![CDATA[int]]></code>
</MixedInferredReturnType>
<MixedOperand>
<code><![CDATA[$file['destination']]]></code>
<code><![CDATA[$file['name']]]></code>
</MixedOperand>
<MixedReturnStatement>
<code><![CDATA[$this->options['max']]]></code>
<code><![CDATA[$this->options['min']]]></code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code><![CDATA[$value]]></code>
</MoreSpecificImplementedParamType>
<PossiblyInvalidArgument>
<code><![CDATA[$value]]></code>
</PossiblyInvalidArgument>
<PossiblyInvalidCast>
<code><![CDATA[$value]]></code>
</PossiblyInvalidCast>
<PropertyNotSetInConstructor>
<code><![CDATA[$count]]></code>
<code><![CDATA[$files]]></code>
</PropertyNotSetInConstructor>
<RedundantConditionGivenDocblockType>
<code><![CDATA[$this->getMax() !== null]]></code>
<code><![CDATA[$this->getMax() !== null]]></code>
<code><![CDATA[$this->getMin() !== null]]></code>
<code><![CDATA[$this->getMin() !== null]]></code>
<code><![CDATA[is_string($file)]]></code>
</RedundantConditionGivenDocblockType>
</file>
<file src="src/File/ExcludeExtension.php">
<InvalidClassConstantType>
<code><![CDATA[FALSE_EXTENSION]]></code>
Expand Down Expand Up @@ -477,13 +429,8 @@
</PossiblyUnusedMethod>
</file>
<file src="test/File/CountTest.php">
<MixedArgument>
<code><![CDATA[$max]]></code>
<code><![CDATA[$min]]></code>
</MixedArgument>
<PossiblyUnusedMethod>
<code><![CDATA[basicDataProvider]]></code>
<code><![CDATA[invalidMinMaxValues]]></code>
</PossiblyUnusedMethod>
</file>
<file src="test/File/ExcludeExtensionTest.php">
Expand Down
Loading

0 comments on commit 3320ab8

Please sign in to comment.