psalm / psalm-plugin-laravel

A Psalm plugin for Laravel
MIT License
301 stars 71 forks source link

Dynamic analysis for Auth calls #326

Closed alies-dev closed 1 year ago

alies-dev commented 1 year ago

Fixes #184

In this PR I added 3 handlers handlers that provide types for the following cases:

// Request
$request->user();
$request->user('guard-name');

// Auth
Auth::user();

// Guard
Auth::guard('guard-name')->user();

and some other less often used.

TODO:

return $guard->user();



______

Previous implementation attempts:
 - https://github.com/psalm/psalm-plugin-laravel/pull/217
tm1000 commented 1 year ago