laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

Support `Model::on` method

Open MatanYadaev opened this issue 2 years ago • 0 comments

Versions:

  • ide-helper Version: 2.10.0
  • Laravel Version: 8.50.0
  • PHP Version: 8.0.8

Summary:

When using Model::on(...)->first() PHPStorm doesn't know the real type of the returned instance.

// PHPStorm know that the returned instance is `User|Builder|Model`
$user1 = User::first();
// PHPStorm know that the returned instance is `Builder|Model` but not `User`
$user2 = User::on('read_replica')->first();

MatanYadaev avatar Jul 25 '21 10:07 MatanYadaev