clockwork icon indicating copy to clipboard operation
clockwork copied to clipboard

Fix bug in SQL-based search

Open UlrichEckhardt opened this issue 1 year ago • 2 comments

Using PHPStan static analyzer, it found an undefined variable $field in SqlSearch::resolveExactCondition(). This bug is a remnant from a refactoring that took place in #361.

The attached commit should fix that and reduce the complexity of the code a bit.

UlrichEckhardt avatar Jan 19 '24 19:01 UlrichEckhardt

Hey, thanks for the PR. This looks nice, but is there any reason why are we making the closure static?

itsgoingd avatar Jan 21 '24 19:01 itsgoingd

A non-static closure holds a reference to $this. This reference causes a very slight overhead and also it is not necessary. Removing the reference to $this therefore makes the code a bit faster and clearer. I just consider making closures static best practice, it doesn't change the way this works.

UlrichEckhardt avatar Jan 21 '24 19:01 UlrichEckhardt