Skip to content

Commit

Permalink
Minor type inference improvements
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jan 4, 2024
1 parent 5d67df5 commit 82c13c5
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 153 deletions.
144 changes: 48 additions & 96 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.15.0@5c774aca4746caf3d239d9c8cadb9f882ca29352">
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
<file src="src/AbstractDateDropdown.php">
<MissingReturnType>
<code>filterable</code>
Expand Down Expand Up @@ -129,36 +129,21 @@
</file>
<file src="src/Compress.php">
<DocblockTypeContradiction>
<code>! is_array($options)</code>
<code><![CDATA[! is_array($options) && ! $options instanceof Traversable]]></code>
<code>is_string($adapter)</code>
</DocblockTypeContradiction>
<LessSpecificImplementedReturnType>
<code>mixed</code>
</LessSpecificImplementedReturnType>
<MissingPropertyType>
<code>$adapter</code>
<code>$adapterOptions</code>
</MissingPropertyType>
<MixedArgument>
<code>$adapter</code>
<code>$adapter</code>
<code>$key</code>
<code><![CDATA[$this->adapter]]></code>
</MixedArgument>
<MixedArgumentTypeCoercion>
<code>$options</code>
</MixedArgumentTypeCoercion>
<MixedAssignment>
<code>$adapter</code>
<code>$key</code>
<code>$value</code>
</MixedAssignment>
<MixedInferredReturnType>
<code>array</code>
</MixedInferredReturnType>
<MixedMethodCall>
<code>new $adapter($options)</code>
</MixedMethodCall>
<MixedReturnStatement>
<code><![CDATA[$this->adapterOptions]]></code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$options</code>
</MoreSpecificImplementedParamType>
Expand Down Expand Up @@ -436,17 +421,6 @@
</MixedArgumentTypeCoercion>
</file>
<file src="src/Decompress.php">
<DocblockTypeContradiction>
<code>! is_string($value)</code>
</DocblockTypeContradiction>
<MixedReturnStatement>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
<code>$value</code>
<code>$value</code>
</MoreSpecificImplementedParamType>
<PossiblyNullArgument>
<code>$value</code>
</PossiblyNullArgument>
Expand All @@ -469,11 +443,13 @@
</MixedMethodCall>
<MixedReturnStatement>
<code><![CDATA[$this->adapter->decrypt($value)]]></code>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
</MoreSpecificImplementedParamType>
<NoValue>
<code>return $value;</code>
</NoValue>
</file>
<file src="src/DenyList.php">
<PossiblyUnusedMethod>
Expand All @@ -486,6 +462,7 @@
</file>
<file src="src/Encrypt.php">
<DeprecatedInterface>
<code>Encrypt</code>
<code>Encrypt\EncryptionAlgorithmInterface</code>
</DeprecatedInterface>
<DocblockTypeContradiction>
Expand Down Expand Up @@ -524,16 +501,21 @@
<MixedReturnStatement>
<code><![CDATA[$this->adapter->encrypt($value)]]></code>
<code><![CDATA[$this->adapter->toString()]]></code>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
</MoreSpecificImplementedParamType>
<NoValue>
<code>return $value;</code>
</NoValue>
<PossiblyUnusedMethod>
<code>__call</code>
<code>getAdapter</code>
<code>getAdapterInstance</code>
</PossiblyUnusedMethod>
<RedundantCondition>
<code><![CDATA[! is_string($value) && ! is_numeric($value)]]></code>
</RedundantCondition>
</file>
<file src="src/Encrypt/BlockCipher.php">
<DeprecatedInterface>
Expand All @@ -560,6 +542,10 @@
<code><![CDATA[$this->encryption]]></code>
<code>$value</code>
</MixedArgument>
<MixedArgumentTypeCoercion>
<code><![CDATA[$this->compression]]></code>
<code><![CDATA[$this->compression]]></code>
</MixedArgumentTypeCoercion>
<MixedArrayAccess>
<code><![CDATA[$options['algorithm']]]></code>
<code><![CDATA[$options['algorithm']]]></code>
Expand All @@ -577,18 +563,22 @@
<code><![CDATA[$this->encryption['vector']]]></code>
</MixedArrayAssignment>
<MixedAssignment>
<code>$decrypted</code>
<code>$options</code>
<code>$value</code>
</MixedAssignment>
<MixedInferredReturnType>
<code>array</code>
<code>string</code>
<code>string</code>
<code>string</code>
</MixedInferredReturnType>
<MixedOperand>
<code><![CDATA[$this->encryption]]></code>
</MixedOperand>
<MixedReturnStatement>
<code>$decrypted</code>
<code>$decrypted</code>
<code><![CDATA[$this->encryption]]></code>
<code><![CDATA[$this->encryption['key']]]></code>
<code><![CDATA[$this->encryption['vector']]]></code>
Expand Down Expand Up @@ -621,6 +611,10 @@
</PossiblyUnusedMethod>
</file>
<file src="src/Encrypt/Openssl.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->compression]]></code>
<code><![CDATA[$this->compression]]></code>
</ArgumentTypeCoercion>
<DeprecatedInterface>
<code>Openssl</code>
</DeprecatedInterface>
Expand Down Expand Up @@ -652,6 +646,7 @@
</MixedArrayTypeCoercion>
<MixedAssignment>
<code>$count</code>
<code>$decrypted</code>
<code>$envKey</code>
<code>$i</code>
<code>$i</code>
Expand All @@ -663,13 +658,20 @@
<code>$option</code>
<code>$option</code>
</MixedAssignment>
<MixedInferredReturnType>
<code>string</code>
</MixedInferredReturnType>
<MixedOperand>
<code><![CDATA[$header['size']]]></code>
<code>$i</code>
</MixedOperand>
<MixedPropertyTypeCoercion>
<code><![CDATA[$this->keys]]></code>
</MixedPropertyTypeCoercion>
<MixedReturnStatement>
<code>$decrypted</code>
<code>$decrypted</code>
</MixedReturnStatement>
<PossiblyUnusedMethod>
<code>__construct</code>
<code>getCompression</code>
Expand All @@ -693,6 +695,9 @@
<code>Filter\Decrypt</code>
<code>parent::filter($content)</code>
</DeprecatedClass>
<DeprecatedInterface>
<code>Decrypt</code>
</DeprecatedInterface>
<DocblockTypeContradiction>
<code><![CDATA[! is_scalar($value) && ! is_array($value)]]></code>
</DocblockTypeContradiction>
Expand Down Expand Up @@ -722,11 +727,13 @@
<code><![CDATA[$this->filename]]></code>
<code><![CDATA[$this->filename]]></code>
<code>$uploadData</code>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
</MoreSpecificImplementedParamType>
<NoValue>
<code>return $value;</code>
</NoValue>
<PossiblyNullPropertyAssignmentValue>
<code>$filename</code>
</PossiblyNullPropertyAssignmentValue>
Expand All @@ -749,6 +756,9 @@
<code>Filter\Encrypt</code>
<code>parent::filter($content)</code>
</DeprecatedClass>
<DeprecatedInterface>
<code>Encrypt</code>
</DeprecatedInterface>
<DocblockTypeContradiction>
<code><![CDATA[! is_scalar($value) && ! is_array($value)]]></code>
</DocblockTypeContradiction>
Expand Down Expand Up @@ -777,11 +787,13 @@
<code><![CDATA[$this->filename]]></code>
<code><![CDATA[$this->filename]]></code>
<code>$uploadData</code>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
</MoreSpecificImplementedParamType>
<NoValue>
<code>return $value;</code>
</NoValue>
<PossiblyNullPropertyAssignmentValue>
<code>$filename</code>
</PossiblyNullPropertyAssignmentValue>
Expand Down Expand Up @@ -809,7 +821,6 @@
</file>
<file src="src/File/Rename.php">
<DocblockTypeContradiction>
<code><![CDATA[! is_scalar($value) && ! is_array($value)]]></code>
<code>is_array($options)</code>
<code>is_array($options)</code>
</DocblockTypeContradiction>
Expand All @@ -834,7 +845,6 @@
<code><![CDATA[$file['target']]]></code>
<code><![CDATA[$file['target']]]></code>
<code>$value</code>
<code>$value</code>
</MixedArgument>
<MixedArgumentTypeCoercion>
<code>$options</code>
Expand All @@ -855,18 +865,10 @@
</MixedAssignment>
<MixedInferredReturnType>
<code>string</code>
<code>string|array</code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code><![CDATA[$file['target']]]></code>
<code><![CDATA[$file['target']]]></code>
<code>$uploadData</code>
<code>$uploadData</code>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
</MoreSpecificImplementedParamType>
<PossiblyUndefinedArrayOffset>
<code><![CDATA[$rename['randomize']]]></code>
</PossiblyUndefinedArrayOffset>
Expand Down Expand Up @@ -987,31 +989,9 @@
</RedundantCastGivenDocblockType>
</file>
<file src="src/File/UpperCase.php">
<DocblockTypeContradiction>
<code><![CDATA[! is_scalar($value) && ! is_array($value)]]></code>
</DocblockTypeContradiction>
<MixedArgument>
<code>$value</code>
<code>$value</code>
<code>$value</code>
<code>$value</code>
</MixedArgument>
<MixedAssignment>
<code>$value</code>
</MixedAssignment>
<MixedInferredReturnType>
<code>string|array</code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code>$uploadData</code>
<code>$value</code>
<code>$value</code>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
<code>$value</code>
</MoreSpecificImplementedParamType>
<PossiblyUndefinedVariable>
<code>$uploadData</code>
</PossiblyUndefinedVariable>
Expand Down Expand Up @@ -1312,37 +1292,23 @@
</PossiblyUndefinedArrayOffset>
</file>
<file src="src/StripTags.php">
<DocblockTypeContradiction>
<code>is_scalar($value)</code>
</DocblockTypeContradiction>
<MixedArgument>
<code><![CDATA[$options['allowAttribs']]]></code>
<code><![CDATA[$options['allowTags']]]></code>
<code><![CDATA[$this->tagsAllowed[$tagName]]]></code>
</MixedArgument>
<MixedArrayAssignment>
<code><![CDATA[$this->tagsAllowed[$tagName][$attributeName]]]></code>
</MixedArrayAssignment>
<MixedAssignment>
<code>$attribute</code>
<code>$attribute</code>
<code>$element</code>
<code><![CDATA[$temp['allowAttribs']]]></code>
<code><![CDATA[$temp['allowComments']]]></code>
<code><![CDATA[$temp['allowTags']]]></code>
</MixedAssignment>
<MoreSpecificImplementedParamType>
<code>$value</code>
</MoreSpecificImplementedParamType>
<PossiblyUndefinedVariable>
<code>$temp</code>
</PossiblyUndefinedVariable>
<RedundantCastGivenDocblockType>
<code>(string) $value</code>
<code>(string) $value</code>
</RedundantCastGivenDocblockType>
<RedundantConditionGivenDocblockType>
<code>is_array($options)</code>
<code>is_string($attribute)</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="src/ToNull.php">
Expand Down Expand Up @@ -1404,9 +1370,6 @@
<DocblockTypeContradiction>
<code>is_string($separator)</code>
</DocblockTypeContradiction>
<MixedOperand>
<code>$separator</code>
</MixedOperand>
<PossiblyInvalidArgument>
<code>$separator</code>
</PossiblyInvalidArgument>
Expand Down Expand Up @@ -1613,9 +1576,6 @@
<code>getArchive</code>
<code>getArchive</code>
</UndefinedInterfaceMethod>
<UnusedVariable>
<code>$adapter</code>
</UnusedVariable>
</file>
<file src="test/DataUnitFormatterTest.php">
<PossiblyUnusedMethod>
Expand All @@ -1639,16 +1599,9 @@
</PossiblyUnusedMethod>
</file>
<file src="test/DecompressTest.php">
<MixedArgument>
<code>$compressed</code>
<code>$input</code>
</MixedArgument>
<MixedAssignment>
<code>$compressed</code>
</MixedAssignment>
<NullArgument>
<code>null</code>
</NullArgument>
<PossiblyUnusedMethod>
<code>returnUnfilteredDataProvider</code>
</PossiblyUnusedMethod>
Expand Down Expand Up @@ -1885,7 +1838,6 @@
<file src="test/StripTagsTest.php">
<MixedArgument>
<code>$filtered</code>
<code>$input</code>
</MixedArgument>
<MixedAssignment>
<code>$filtered</code>
Expand Down
Loading

0 comments on commit 82c13c5

Please sign in to comment.