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

157

In response to @danielpetrica

I don't quite understand why this code is necessary, but instead of disabling the rule completely, you could just use @phpstan-ignore rule.name (or @phpstan-ignore-next-line) comments above the affected line. Other real problems that the rule catches will not be missed this way.

Ignoring a rule for a single file / occurrence via config is also possible. For more read here: phpstan.org/user-guide/ignoring-errors

1

169

  • No matching results...
  • Searching...

/ 1000

This library is a wrapper around the salesforce api presenting the objects in salesforce as models.
It's not perfect so not all methods are integrated corectly (sometimes for sf limitations) I basically have this problem any time I'm using the query builder and searching for first() which is a lot. I know it's bad to to ->get()->first() for the performance issues.

193