withFallback
Learn how to set a fallback for the evaluation.
This method sets a fallback value returned when the query cannot be evaluated.
Without a fallback, a failed evaluation throws a CroctException.
Signature
This method has the following signature:
public function withFallback(mixed $fallback): selfThis method returns a copy of the options with the change applied, leaving the original unchanged.
Example
Here is a basic example of how to use this method:
<?phpuse Croct\Plug\EvaluationOptions;
$options = EvaluationOptions::defaults()->withFallback(false);Parameters
The following list describes the supported parameters:
- fallbackmixed
The fallback value returned when the query cannot be evaluated.