Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.x' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdw committed Aug 12, 2024
2 parents 1b5c6ef + e1b64a0 commit 00b4a56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;

use function in_array;

class StorageDynamicStaticMethodReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension
{
use HasContainer;
Expand All @@ -25,7 +27,7 @@ public function getClass(): string

public function isStaticMethodSupported(MethodReflection $methodReflection): bool
{
return $methodReflection->getName() === 'disk' || $methodReflection->getName() === 'drive';
return in_array($methodReflection->getName(), ['disk', 'drive', 'cloud'], strict: true);
}

public function getTypeFromStaticMethodCall(
Expand Down
2 changes: 2 additions & 0 deletions tests/Type/data/facades.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function test(): void

assertType('Illuminate\Filesystem\FilesystemAdapter', Storage::disk());
assertType('Illuminate\Filesystem\FilesystemAdapter', Storage::drive());
assertType('Illuminate\Filesystem\FilesystemAdapter', Storage::cloud());
assertType('bool', Storage::disk()->deleteDirectory('foo'));
assertType('bool', Storage::drive()->deleteDirectory('foo'));
assertType('bool', Storage::cloud()->deleteDirectory('foo'));
assertType('string|false', Storage::putFile('foo', 'foo/bar'));
assertType('mixed', Redis::get('foo'));

Expand Down

0 comments on commit 00b4a56

Please sign in to comment.