Skip to content

Commit

Permalink
Merge pull request #246 from laminas/renovate/vimeo-psalm-5.x
Browse files Browse the repository at this point in the history
Update dependency vimeo/psalm to v5
  • Loading branch information
Ocramius committed Dec 5, 2022
2 parents a3c29d2 + f9e1bb9 commit e3bdbd0
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 206 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"phpbench/phpbench": "^1.0",
"phpunit/phpunit": "^9.5.23",
"psalm/plugin-phpunit": "^0.18.0",
"vimeo/psalm": "^4.24"
"vimeo/psalm": "^5.0"
},
"conflict": {
"symfony/console": "<5.1"
Expand Down
199 changes: 72 additions & 127 deletions composer.lock

Large diffs are not rendered by default.

117 changes: 47 additions & 70 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="4.29.0@7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3">
<files psalm-version="5.1.0@4defa177c89397c5e14737a80fe4896584130674">
<file src="src/Command/DeprecatedStorageFactoryConfigurationCheckCommand.php">
<MixedArgument occurrences="2">
<code>$cacheConfiguration</code>
Expand Down Expand Up @@ -43,9 +43,10 @@
</MixedAssignment>
</file>
<file src="src/Pattern/CaptureCache.php">
<DocblockTypeContradiction occurrences="2">
<code>$perm === false</code>
<code>$perm === false</code>
<DocblockTypeContradiction occurrences="3">
<code>$perm !== false</code>
<code>$perm !== false</code>
<code>decoct($perm)</code>
</DocblockTypeContradiction>
<MissingClosureParamType occurrences="1">
<code>$content</code>
Expand All @@ -66,19 +67,18 @@
<PossiblyNullOperand occurrences="1">
<code>$publicDir</code>
</PossiblyNullOperand>
<RedundantCondition occurrences="2">
<code>$perm === false</code>
<code>0775</code>
</RedundantCondition>
<RedundantConditionGivenDocblockType occurrences="3">
<RedundantCondition occurrences="3">
<code>$perm</code>
<code>$perm !== false</code>
<code>decoct($perm)</code>
</RedundantCondition>
<RedundantConditionGivenDocblockType occurrences="2">
<code>$perm === false</code>
<code>0775</code>
</RedundantConditionGivenDocblockType>
<TypeDoesNotContainType occurrences="3">
<code>$perm !== false</code>
<code>$perm !== false</code>
<code>decoct($perm)</code>
<TypeDoesNotContainType occurrences="2">
<code>$perm === false</code>
<code>$perm === false</code>
</TypeDoesNotContainType>
</file>
<file src="src/Pattern/ObjectCache.php">
Expand Down Expand Up @@ -115,9 +115,8 @@
<MixedMethodCall occurrences="1">
<code>$method</code>
</MixedMethodCall>
<MixedReturnStatement occurrences="2">
<MixedReturnStatement occurrences="1">
<code>$this-&gt;call('__isset', [$name])</code>
<code>$this-&gt;call('__toString')</code>
</MixedReturnStatement>
<ParamNameMismatch occurrences="2">
<code>$method</code>
Expand Down Expand Up @@ -156,9 +155,6 @@
<code>$filePermission</code>
<code>$umask</code>
</PossiblyInvalidPropertyAssignmentValue>
<PossiblyNullArgument occurrences="1">
<code>$this-&gt;getObject()</code>
</PossiblyNullArgument>
<RedundantCastGivenDocblockType occurrences="6">
<code>(bool) $cacheOutput</code>
<code>(bool) $fileLocking</code>
Expand Down Expand Up @@ -188,8 +184,7 @@
</UndefinedInterfaceMethod>
</file>
<file src="src/Psr/SimpleCache/SimpleCacheDecorator.php">
<DocblockTypeContradiction occurrences="2">
<code>is_object($ttl)</code>
<DocblockTypeContradiction occurrences="1">
<code>null === $ttl</code>
</DocblockTypeContradiction>
<MixedArgument occurrences="2">
Expand All @@ -208,11 +203,18 @@
<code>$ttl</code>
<code>$ttl</code>
</PossiblyNullArgument>
<RedundantConditionGivenDocblockType occurrences="2">
<RedundantConditionGivenDocblockType occurrences="1">
<code>null !== $this-&gt;storage-&gt;removeItem($key)</code>
<code>var_export($ttl, true)</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="src/Service/StorageAdapterFactory.php">
<InvalidArgument occurrences="1">
<code>$pluginConfiguration</code>
</InvalidArgument>
<InvalidArrayOffset occurrences="1">
<code>$pluginConfiguration['priority']</code>
</InvalidArrayOffset>
</file>
<file src="src/Service/StorageAdapterFactoryFactory.php">
<MixedArgument occurrences="2">
<code>$container-&gt;get(AdapterPluginManager::class)</code>
Expand All @@ -228,25 +230,24 @@
<ArgumentTypeCoercion occurrences="1">
<code>$plugin</code>
</ArgumentTypeCoercion>
<InvalidArgument occurrences="8">
<code>$args['success']</code>
<code>$args['success']</code>
<code>'casToken'</code>
<code>'casToken'</code>
<code>'success'</code>
<code>'success'</code>
<code>'success'</code>
<code>'success'</code>
</InvalidArgument>
<InvalidNullableReturnType occurrences="1">
<code>bool</code>
</InvalidNullableReturnType>
<InvalidScalarArgument occurrences="4">
<code>$args['key']</code>
<code>$args['key']</code>
<code>$args['value']</code>
<code>$args['value']</code>
</InvalidScalarArgument>
<MixedArgument occurrences="20">
<code>$args['key']</code>
<MixedArgument occurrences="15">
<code>$args['key']</code>
<code>$args['key']</code>
<code>$args['key']</code>
<code>$args['key']</code>
<code>$args['key']</code>
<code>$args['key']</code>
<code>$args['success']</code>
<code>$args['success']</code>
<code>$handle</code>
<code>$keyValuePairs</code>
<code>$keyValuePairs</code>
Expand All @@ -267,8 +268,7 @@
<code>$normalizedKey</code>
<code>$normalizedKey</code>
</MixedArgumentTypeCoercion>
<MixedAssignment occurrences="43">
<code>$args['casToken']</code>
<MixedAssignment occurrences="42">
<code>$handle</code>
<code>$normalizedKey</code>
<code>$normalizedKey</code>
Expand Down Expand Up @@ -391,11 +391,12 @@
<NullableReturnStatement occurrences="1">
<code>$success</code>
</NullableReturnStatement>
<PossiblyNullArgument occurrences="3">
<code>$args['key']</code>
<PossiblyInvalidArgument occurrences="4">
<code>$args['key']</code>
<code>$args['key']</code>
</PossiblyNullArgument>
<code>$args['value']</code>
<code>$args['value']</code>
</PossiblyInvalidArgument>
<PropertyNotSetInConstructor occurrences="1">
<code>$pluginRegistry</code>
</PropertyNotSetInConstructor>
Expand Down Expand Up @@ -424,24 +425,17 @@
<code>$letter</code>
<code>$value</code>
</MixedAssignment>
<PossiblyInvalidArgument occurrences="1">
<code>$options</code>
</PossiblyInvalidArgument>
<RawObjectIteration occurrences="1">
<code>$this</code>
</RawObjectIteration>
<RedundantCastGivenDocblockType occurrences="5">
<RedundantCastGivenDocblockType occurrences="4">
<code>(bool) $readable</code>
<code>(bool) $writable</code>
<code>(float) $ttl</code>
<code>(string) $keyPattern</code>
<code>(string) $namespace</code>
</RedundantCastGivenDocblockType>
</file>
<file src="src/Storage/Adapter/KeyListIterator.php">
<MixedPropertyTypeCoercion occurrences="1">
<code>$keys</code>
</MixedPropertyTypeCoercion>
<RedundantCastGivenDocblockType occurrences="1">
<code>(int) $mode</code>
</RedundantCastGivenDocblockType>
Expand Down Expand Up @@ -509,7 +503,8 @@
<InvalidReturnType occurrences="1">
<code>StorageInterface</code>
</InvalidReturnType>
<MoreSpecificImplementedParamType occurrences="1">
<MoreSpecificImplementedParamType occurrences="2">
<code>$target</code>
<code>$target</code>
</MoreSpecificImplementedParamType>
<PropertyNotSetInConstructor occurrences="2">
Expand Down Expand Up @@ -673,7 +668,10 @@
</PropertyNotSetInConstructor>
</file>
<file src="test/Pattern/AbstractCommonStoragePatternTest.php">
<NonInvariantDocblockPropertyType occurrences="1">
<NonInvariantDocblockPropertyType occurrences="4">
<code>$pattern</code>
<code>$pattern</code>
<code>$pattern</code>
<code>$pattern</code>
</NonInvariantDocblockPropertyType>
</file>
Expand Down Expand Up @@ -757,9 +755,6 @@
<code>$this-&gt;pattern-&gt;property</code>
<code>$this-&gt;pattern-&gt;unknownProperty</code>
</NoInterfaceProperties>
<PossiblyNullArgument occurrences="1">
<code>$this-&gt;options-&gt;getObject()</code>
</PossiblyNullArgument>
<PossiblyNullPropertyFetch occurrences="2">
<code>$this-&gt;options-&gt;getObject()-&gt;property</code>
<code>$this-&gt;options-&gt;getObject()-&gt;property</code>
Expand Down Expand Up @@ -824,21 +819,6 @@
<code>isHit</code>
<code>set</code>
</MixedMethodCall>
<PossiblyInvalidArgument occurrences="1">
<code>$items</code>
</PossiblyInvalidArgument>
<UndefinedInterfaceMethod occurrences="10">
<code>$items</code>
<code>$items</code>
<code>$items</code>
<code>$items</code>
<code>$items</code>
<code>$items</code>
<code>$saved</code>
<code>$saved</code>
<code>$saved</code>
<code>$saved</code>
</UndefinedInterfaceMethod>
</file>
<file src="test/Psr/CacheItemPool/CacheItemTest.php">
<InvalidArgument occurrences="2">
Expand Down Expand Up @@ -884,9 +864,6 @@
</MixedInferredReturnType>
</file>
<file src="test/Storage/Adapter/AbstractAdapterTest.php">
<InvalidScalarArgument occurrences="1">
<code>'123'</code>
</InvalidScalarArgument>
<MissingClosureParamType occurrences="1">
<code>$event</code>
</MissingClosureParamType>
Expand Down
1 change: 0 additions & 1 deletion src/Psr/MaximumKeyLengthTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ private function memoizeMaximumKeyLengthCapability(StorageInterface $storage, Ca
));
}

/** @psalm-suppress PropertyTypeCoercion The result of this will always be > 0 */
$this->maximumKeyLength = min($maximumKeyLength, self::$pcreMaximumQuantifierLength - 1);
}

Expand Down
9 changes: 5 additions & 4 deletions src/Storage/Adapter/AdapterOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ public function getReadable()
/**
* Set time to live.
*
* @param int|float $ttl
* @return AdapterOptions Provides a fluent interface
* @param numeric $ttl
* @return $this
*/
public function setTtl($ttl)
{
Expand All @@ -219,7 +219,7 @@ public function getTtl()
* Enable/Disable writing data to cache.
*
* @param bool $writable
* @return AdapterOptions Provides a fluent interface
* @return $this
*/
public function setWritable($writable)
{
Expand Down Expand Up @@ -259,7 +259,8 @@ protected function triggerOptionEvent($optionName, mixed $optionValue)
/**
* Validates and normalize a TTL.
*
* @param int|float $ttl
* @param numeric $ttl
* @param-out int|float $ttl
* @throws Exception\InvalidArgumentException
* @return void
*/
Expand Down
5 changes: 4 additions & 1 deletion src/Storage/Adapter/KeyListIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

/**
* @see ReturnTypeWillChange
*
* @template-covariant TValue
* @template-implements IteratorInterface<string, TValue>
*/
class KeyListIterator implements IteratorInterface, Countable
{
Expand Down Expand Up @@ -71,7 +74,7 @@ public function getMode()
* Set iterator mode
*
* @param int $mode
* @return KeyListIterator Provides a fluent interface
* @return $this
*/
public function setMode($mode)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Storage/IterableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

/**
* @method IteratorInterface getIterator() Get the storage iterator
* @template-covariant TKey
* @template-covariant TValue
* @template-extends IteratorAggregate<TKey, TValue>
*/
interface IterableInterface extends IteratorAggregate
{
Expand Down
5 changes: 5 additions & 0 deletions src/Storage/IteratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

use Iterator;

/**
* @template-covariant TKey
* @template-covariant TValue
* @template-extends Iterator<TKey, TValue>
*/
interface IteratorInterface extends Iterator
{
public const CURRENT_AS_SELF = 0;
Expand Down
3 changes: 2 additions & 1 deletion test/Pattern/AbstractCommonStoragePatternTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace LaminasTest\Cache\Pattern;

use Laminas\Cache\Pattern\PatternInterface;
use Laminas\Cache\Pattern\StorageCapableInterface;
use Laminas\Cache\Storage\StorageInterface;

Expand All @@ -17,7 +18,7 @@ abstract class AbstractCommonStoragePatternTest extends AbstractCommonPatternTes
/** @var StorageInterface */
protected $storage;

/** @var StorageCapableInterface */
/** @var PatternInterface&StorageCapableInterface */
protected $pattern;

protected function setUp(): void
Expand Down
3 changes: 2 additions & 1 deletion test/Pattern/OutputCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public function testStartEndCacheHit(): void
$key = 'testStartEndCacheHit';

// fill cache
$this->pattern->getStorage()->setItem($key, $output);
$storage = $this->pattern->getStorage();
$storage->setItem($key, $output);

ob_start();
self::assertTrue($this->pattern->start($key));
Expand Down

0 comments on commit e3bdbd0

Please sign in to comment.