Caleb White

Results 344 comments of Caleb White

I don't care for this. Scopes, like computed attributes, should be protected as they are not supposed to be called directly on the class.

> and as such, Larastan should support that I still disagree---PHPStan / Larastan is often much stricter than what is technically allowed in PHP / Laravel. This is no different...

I would be okay with adding something about it in the docs, but the scope discovery doesn't happen in a place that's easy to report an error in Larastan

[rector-laravel](https://github.com/driftingly/rector-laravel) can now automatically make model attributes and scopes `protected` for you: https://github.com/driftingly/rector-laravel/pull/370

@i-bajrai, please create a new issue, and show the full code

This should work: ```php Order::with(['customer' => function (Relation $q): void { /** @var BelongsTo $q */ $q->withTrashed(); }])->get();

That's not possible until `*DynamicParameterTypeExtension`s are added to PHPStan: https://github.com/phpstan/phpstan/issues/11707#issuecomment-2358932350

Can you provide a more complete example? I've been using the shorter syntax for months with no issues

No, but I do run Larastan on the factories and seeders

It might be possible, but not easily. The easiest thing to do is just narrow the type ```php $comment = Comment::query() ->whereHas('post') ->firstOrFail(); assert($comment->post !== null); ```