Larastan: Call to protected static method in Storage facade

Created on 6 Oct 2018  路  4Comments  路  Source: nunomaduro/larastan

  • Larastan Version: 0.3.1
  • --level used: 0

Description:

I try to analyse my project and get error:
Call to protected static method get() of class Illuminate\Filesystem\FilesystemManager

Laravel code where the issue was found:

...
use Illuminate\Support\Facades\Storage;
...
$myFile = Storage::get($path); // <- at this line
false positive

Most helpful comment

Storage::drive()->get() and it clears the error.

All 4 comments

It appears this would be an issue with phpstan not correctly parsing @mixin, but instead using @see for links. The Storage facade has @see \Illuminate\Filesystem\FilesystemManager, and that manager then has @mixin \Illuminate\Contracts\Filesystem\Filesystem, which it appears phpstan fails to interpret correctly (as @mixin is not officially a support docblock annotation). Using @see in the Laravel framework might be the proper fix here

Storage::drive()->get() and it clears the error.

Since the Storage facade now has get and other methods defined using PHPDoc annotations, this particular issue no longer exists. Since there is also a similar issue for Facades that use a manager pattern, I suppose this issue can be closed. What do you think @canvural ?

@Daanra Yeah looks those annotations are in both 6.x and 7.x so we can close this issue :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gitetsu picture gitetsu  路  4Comments

bogdankharchenko picture bogdankharchenko  路  4Comments

hailwood picture hailwood  路  4Comments

JeroenVanOort picture JeroenVanOort  路  3Comments

zlodes picture zlodes  路  3Comments