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
Show file tree
Hide file tree
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>
Expand Down Expand Up @@ -64,9 +64,6 @@
</PossiblyUnusedMethod>
</file>
<file src="src/Pattern/CaptureCache.php">
<DocblockTypeContradiction>
<code>$perm !== false</code>
</DocblockTypeContradiction>
<MissingClosureParamType>
<code>$content</code>
</MissingClosureParamType>
Expand All @@ -76,8 +73,6 @@
</MissingReturnType>
<MixedArgument>
<code>$content</code>
<code>$perm</code>
<code>$perm</code>
</MixedArgument>
<PossiblyInvalidMethodCall>
<code>isFile</code>
Expand Down Expand Up @@ -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>
gsteel marked this conversation as resolved.
Show resolved Hide resolved
<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>
Expand Down Expand Up @@ -363,6 +413,9 @@
<DocblockTypeContradiction>
<code>is_array($options)</code>
</DocblockTypeContradiction>
<InvalidArgument>
gsteel marked this conversation as resolved.
Show resolved Hide resolved
<code><![CDATA[new ArrayObject([$optionName => $optionValue])]]></code>
</InvalidArgument>
<InvalidReturnStatement>
<code>$array</code>
</InvalidReturnStatement>
Expand Down Expand Up @@ -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>
Expand Down
8 changes: 1 addition & 7 deletions src/Pattern/CaptureCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)) {
gsteel marked this conversation as resolved.
Show resolved Hide resolved
$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
Expand Down
4 changes: 2 additions & 2 deletions src/Pattern/PatternOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down Expand Up @@ -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"
);
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ abstract class AbstractAdapter implements StorageInterface, PluginAwareInterface
*/
public function __construct($options = null)
{
if ($options) {
if ($options !== null) {
$this->setOptions($options);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Plugin/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion test/Pattern/CaptureCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions test/Psr/CacheItemPool/CacheItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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

protected function setUp(): void
Expand Down
2 changes: 1 addition & 1 deletion test/Psr/SimpleCache/SimpleCacheDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
5 changes: 0 additions & 5 deletions test/Storage/Adapter/AbstractMetadataCapableAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test/Storage/Adapter/AdapterOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down