Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vimeo/psalm to v5.20.0 #290

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 130 additions & 126 deletions composer.lock

Large diffs are not rendered by default.

71 changes: 59 additions & 12 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.20.0@3f284e96c9d9be6fe6b15c79416e1d1903dcfef4">
<file src="src/Command/DeprecatedStorageFactoryConfigurationCheckCommand.php">
<MixedArgument>
<code>$cacheConfiguration</code>
@@ -64,9 +64,6 @@
</PossiblyUnusedMethod>
</file>
<file src="src/Pattern/CaptureCache.php">
<DocblockTypeContradiction>
<code>$perm !== false</code>
</DocblockTypeContradiction>
<MissingClosureParamType>
<code>$content</code>
</MissingClosureParamType>
@@ -76,8 +73,6 @@
</MissingReturnType>
<MixedArgument>
<code>$content</code>
<code>$perm</code>
<code>$perm</code>
</MixedArgument>
<PossiblyInvalidMethodCall>
<code>isFile</code>
@@ -228,11 +223,66 @@
<code>StoragePluginFactory</code>
</PossiblyUnusedReturnValue>
</file>
<file src="src/Storage/AbstractMetadataCapableAdapter.php">
<InvalidArgument>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
</InvalidArgument>
</file>
<file src="src/Storage/Adapter/AbstractAdapter.php">
<ArgumentTypeCoercion>
<code>$plugin</code>
</ArgumentTypeCoercion>
<InvalidArgument>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code><![CDATA[$args['success']]]></code>
<code><![CDATA[$args['success']]]></code>
<code><![CDATA['casToken']]></code>
@@ -363,6 +413,9 @@
<DocblockTypeContradiction>
<code>is_array($options)</code>
</DocblockTypeContradiction>
<InvalidArgument>
<code><![CDATA[new ArrayObject([$optionName => $optionValue])]]></code>
</InvalidArgument>
<InvalidReturnStatement>
<code>$array</code>
</InvalidReturnStatement>
@@ -839,12 +892,6 @@
</PossiblyUnusedMethod>
</file>
<file src="test/Storage/Adapter/AdapterOptionsTest.php">
<MixedArgument>
<code>$calledArgs</code>
</MixedArgument>
<MixedArrayAccess>
<code>$calledArgs[0]</code>
</MixedArrayAccess>
<PossiblyNullReference>
<code>getKeyPattern</code>
<code>getTtl</code>
8 changes: 1 addition & 7 deletions src/Pattern/CaptureCache.php
Original file line number Diff line number Diff line change
@@ -269,7 +269,7 @@ protected function putFileContent($file, $data)

$umask = $umask !== false ? umask($umask) : false;
$rs = file_put_contents($file, $data, $locking ? LOCK_EX : 0);
if ($umask) {
if ($umask !== false) {
umask($umask);
}

@@ -325,12 +325,6 @@ protected function createDirectoryStructure($pathname)
$err = ErrorHandler::stop();
throw new Exception\RuntimeException("mkdir('{$pathname}', 0{$oct}, true) failed", 0, $err);
}

if ($perm !== false && ! chmod($pathname, $perm)) {
$oct = decoct($perm);
$err = ErrorHandler::stop();
throw new Exception\RuntimeException("chmod('{$pathname}', 0{$oct}) failed", 0, $err);
}
} else {
// built-in mkdir function sets permission together with current umask
// which doesn't work well on multo threaded webservers
4 changes: 2 additions & 2 deletions src/Pattern/PatternOptions.php
Original file line number Diff line number Diff line change
@@ -269,7 +269,7 @@ public function setUmask($umask)
}

// validate
if ($umask & 0700) {
if (($umask & 0700) !== 0) {
throw new Exception\InvalidArgumentException(
'Invalid umask: need permission to execute, read and write by owner'
);
@@ -351,7 +351,7 @@ public function setFilePermission($filePermission)
);
}

if ($filePermission & 0111) {
if (($filePermission & 0111) !== 0) {
throw new Exception\InvalidArgumentException(
"Invalid file permission: Files shouldn't be executable"
);
2 changes: 1 addition & 1 deletion src/Storage/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ abstract class AbstractAdapter implements StorageInterface, PluginAwareInterface
*/
public function __construct($options = null)
{
if ($options) {
if ($options !== null) {
$this->setOptions($options);
}
}
2 changes: 1 addition & 1 deletion src/Storage/Plugin/ExceptionHandler.php
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ public function onException(ExceptionEvent $event)
{
$options = $this->getOptions();
$callback = $options->getExceptionCallback();
if ($callback) {
if ($callback !== null) {
call_user_func($callback, $event->getException());
}

2 changes: 1 addition & 1 deletion test/Pattern/CaptureCacheTest.php
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ public function setUp(): void
$this->umask = umask();

$this->tmpCacheDir = @tempnam(sys_get_temp_dir(), 'laminas_cache_test_');
if (! $this->tmpCacheDir) {
if ($this->tmpCacheDir === false) {
$err = error_get_last();
self::fail("Can't create temporary cache directory-file: {$err['message']}");
} elseif (! @unlink($this->tmpCacheDir)) {
1 change: 1 addition & 0 deletions test/Psr/CacheItemPool/CacheItemTest.php
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@

class CacheItemTest extends TestCase
{
/** @var non-empty-string */
private string $tz;

protected function setUp(): void
2 changes: 1 addition & 1 deletion test/Psr/SimpleCache/SimpleCacheDecoratorTest.php
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ private function getMockCapabilities(
int $minTtl = 60,
int $maxKeyLength = -1
): Capabilities {
$supportedDataTypes = $supportedDataTypes ?: $this->requiredTypes;
$supportedDataTypes = $supportedDataTypes ?? $this->requiredTypes;
$capabilities = $this->createMock(Capabilities::class);
$capabilities
->method('getSupportedDatatypes')
5 changes: 0 additions & 5 deletions test/Storage/Adapter/AbstractMetadataCapableAdapterTest.php
Original file line number Diff line number Diff line change
@@ -18,10 +18,8 @@
use function array_map;
use function array_merge;
use function array_unique;
use function assert;
use function call_user_func_array;
use function count;
use function is_array;
use function ucfirst;

final class AbstractMetadataCapableAdapterTest extends TestCase
@@ -94,7 +92,6 @@ public function testEventHandlingSimple(

$eventList = [];
$eventHandler = static function (Event $event) use (&$eventList): void {
assert(is_array($eventList));
$eventList[] = $event->getName();
};
$eventManager = $storage->getEventManager();
@@ -132,7 +129,6 @@ public function testEventHandlingCatchException(

$eventList = [];
$eventHandler = static function (Event $event) use (&$eventList): void {
assert(is_array($eventList));
$eventList[] = $event->getName();
if ($event instanceof Cache\Storage\ExceptionEvent) {
$event->setThrowException(false);
@@ -173,7 +169,6 @@ public function testEventHandlingStopInPre(

$eventList = [];
$eventHandler = static function (Event $event) use (&$eventList): void {
assert(is_array($eventList));
$eventList[] = $event->getName();
};
$eventManager = $storage->getEventManager();
2 changes: 1 addition & 1 deletion test/Storage/Adapter/AdapterOptionsTest.php
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ public function testTriggerOptionEvent(): void
// trigger by changing an option
$this->options->setWritable(false);

// assert (hopefully) called listener and arguments
self::assertIsArray($calledArgs);
self::assertCount(1, $calledArgs, '"option" event was not triggered or got a wrong number of arguments');
/** @var Event|null $event */
$event = $calledArgs[0] ?? null;