laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.21k stars 10.9k forks source link

IDE autocomplete does not work for Storage::disk('someDisk')->url('...') #52617

Closed Wulfheart closed 2 weeks ago

Wulfheart commented 3 weeks ago

Laravel Version

v11.21.0

PHP Version

8.3.10

Database Driver & Version

No response

Description

When using Storage::disk('local')->u the ->url('...') method is not displayed in IDE autocompletion because it doesn't exist in the return type of Storage::disk().

image

Steps To Reproduce

Storage::disk('someDisk')->url('...')

https://github.com/laravel/framework/blob/b9cf7d3217732e9a0fa4f00e996b3f9cc5bf7abd/src/Illuminate/Support/Facades/Storage.php#L9 According to the docblocks in Illuminate\Support\Facades\Storage the disk method returns an instance of Illuminate\Filesystem\Filesystem. However, in php artisan tinker Storage::disk('local') returns Illuminate\Filesystem\FilesystemAdapter which has the url method. Unfortunately this is not reflected in the IDE.

driesvints commented 2 weeks ago

Heya, thanks for reporting.

If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem. Also see our contribution guide.

Thanks!

Wulfheart commented 2 weeks ago

Hey Dries, I don’t know how to fix this.