Skip to content

auth()->user() / Auth::user() do not resolve to the configured model on Laravel 13 (0.9.0) #298

Description

@entity

The 0.9.0 release notes say the authenticated user resolves to the model configured in config/auth.php. On a Laravel 13 / PHP 8.5 project with a stock auth configuration ('model' => env('AUTH_MODEL', User::class), default web guard with the session driver and users provider), none of the spellings resolve to the configured model:

  • auth()->user()Method 'user' not found on class 'Illuminate\Contracts\Auth\Factory' (unknown_member)
  • Auth::user()-><modelMethod>()Method '…' not found on class 'Illuminate\Contracts\Auth\Authenticatable'
  • $request->user() → types as mixed (silent, but no model members available)

To reproduce: run phpantom_lsp analyze routes/web.php against any file containing auth()->user(). The same diagnostics appear via the LSP in Zed (PHP extension, phpantom 0.9.0). Writing the model as a fully qualified class name in the config makes no difference, and there is no .phpantom.toml present.

Possibly relevant: Laravel 13's auth() helper has a native AuthFactory|Guard return type in addition to the conditional @return docblock. The diagnostic naming Factory suggests the conditional docblock's null branch is being resolved correctly, but the configured-model special case never engages.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions