Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with larastan: or I get the phpstan error, or I get a code quality score on Insights #687

Open
giacomomasseron opened this issue Jul 4, 2024 · 0 comments

Comments

@giacomomasseron
Copy link

giacomomasseron commented Jul 4, 2024

Q A
Bug report? no
Feature request? yes
Library version 2.11.0

Hi,
I use both insights and larastan together, and they go in kinda conflict.
I have this function that returns a specific Model:

public function newUser(): User
{
    return User::create([...]);
}

This code returns a larastan error:

Method App\UseCases\TestUseCase::handle() should return App\Models\Users\User but returns Illuminate\Database\Eloquent\Model.

If I change the code like this:

public function newUser(): User
{
    /** @var User $user */
    $user = User::create([]);
    return $user;
}

I do not get larastan error, but insights advices me to comeback to previous code.

Any thoughts about it? How can I solve it? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant