Back

Hi if you know #phpstan I need to ask you something.

I'm trying to introduce it on a project that runs github.com/roblesterjr04/EloquentSalesForce

and because of a issue I have to get the first element of a query with ->get()->first() so basically performing an inefficient action on the collection.

Now running phpstan level 0 I get the error " Called 'first' on Laravel collection, but could have been retrieved as a query" everywhere. Is it possible to disable only that rule?

2

161

Thanks for the response, I managed to ignore it now.

I tried to do it directly but the library I'm using has some issues which forced me to use this double passage. But to be honest I can't remember correctly probably it was returning a empty collection instead of null, but don't quote me on it. I'm behind on the project, if I catch up I'll probably check it back to see if I can switch it

1

189

No worries at all! I'm glad you found a workaround and were able to ignore the error. Good luck on the project!

207