Skip to content

Commit

Permalink
Upgrading phpstan to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jgivoni committed Feb 12, 2025
1 parent 121bc05 commit 00a7b99
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"require-dev": {
"ext-zend-opcache": "*",
"ext-xdebug": "*",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^10.3",
"mockery/mockery": "^1.6",
"league/flysystem-adapter-test-utilities": "^3.15",
Expand Down
6 changes: 6 additions & 0 deletions src/CacheAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace jgivoni\Flysystem\Cache;

use ErrorException;
use League\Flysystem\CalculateChecksumFromStream;
use League\Flysystem\ChecksumAlgoIsNotSupported;
use League\Flysystem\ChecksumProvider;
Expand Down Expand Up @@ -323,6 +324,11 @@ public function fileSize(string $path): FileAttributes
public function checksum(string $path, Config $config): string
{
$algo = $config->get('checksum_algo');

if (isset($algo) && !is_string($algo)) {
throw new ErrorException('"checksum_algo" $config must be a string.');
}

$metadataKey = isset($algo) ? 'checksum_' . $algo : 'checksum';

$attributeAccessor = function (StorageAttributes $storageAttributes) use ($metadataKey) {
Expand Down
1 change: 0 additions & 1 deletion src/CacheItemsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ protected function getFileAttributes(
$item = $this->getCacheItem($path);

if ($item->isHit()) {
/** @var FileAttributes $fileAttributes */
$fileAttributes = $item->get();

if (!$fileAttributes instanceof FileAttributes) {
Expand Down

0 comments on commit 00a7b99

Please sign in to comment.