Repository navigation
Fix SimpleEquation operator handling and filter error source resolution - #35
Merged
Merged
Conversation
…or in SimpleEquationMod
Adding IN/NOT_IN made the operator match exhaustive, so PHPStan flagged the last enum arm as an always-true comparison and the trailing default arm as redundant. Keep the default arm as a runtime safety net for operators added to the enum later and ignore the error inline.
ericges
added a commit
that referenced
this pull request
Sep 7, 2026
The fix from #35 added these arms to `SimpleEquationElement::__invoke()` on `main`. This branch had already moved that `match` into `SimpleEquationFilterType::buildQuery()`, so the rebase dropped them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two exceptions that could surface when using
SimpleEquationElement/ theequationengine mod, completes the operator coverage of the element, and cleans up how a filter's error source is resolved.Changes
SimpleEquationMod— operator resolutionThe mod passed
$options['operator']straight through toSimpleEquationElement::define(), which expects aSqlEquationOperator. When the mod is invoked with a raw operator string (i.e. without theOptionsResolvernormalizer having run on the options), this ended in aTypeError. The operator is now resolved viaSqlEquationOperator::match()inside__invoke(), with an explicitInvalidArgumentExceptionwhen it cannot be matched.SimpleEquationElement— missingIN/NOT_INarmsBoth operators exist in
SqlEquationOperatorbut had no expression mapping, so they silently fell into thedefault => nullarm and the filter was rejected as unsupported. They now map to$qb->expr()->in()/notIn().That made the match exhaustive over all enum cases, so PHPStan flagged the last arm as an always-true comparison. The
default => nullarm is kept as a runtime safety net for operators added to the enum later and the error is ignored inline (@phpstan-ignore match.alwaysTrue); sincereportUnmatchedIgnoredErrorsis on, the annotation cannot rot — it becomes an error itself once the default arm is reachable again.Filter error source handling
FilterModel::getFilterIdentifier()returned a bare id, and each caller prefixed it with a hardcodedtl_flare_filter.id=. It now returns the fully qualified%table%.id=%id%itself, derived fromstatic::$strTable.That lets both call sites collapse to a single null-safe expression, which also fixes a real bug:
FilterExecutor::createCallbackException()dereferenced a possibly-nulldata source while building the exception for another error, masking the original failure. Inlined filters (no data source) now reportfilter inlinedas their source in bothFilterExecutorandInteractiveProjector.Also adds the missing trailing newline to the touched files.
Notes
No test suite exists in this repo, so the changes were verified by reading through the call paths;
make phpstanis clean.