AsFilterResultOperation
extends BaseOperation
in package
Terminal-only operation: wrap the chain's final value into a `{name => value}` map that the dispatcher merges into handler kwargs. Returns `null` (rejection) only when the final value is `null` or an empty `iterable` — `false`, `0`, `''` are still accepting values carrying a payload.
Direct port of aiogram's local extension AsFilterResultOperation
in aiogram/utils/magic_filter.py:9-18. The PHP-side bridge
(MagicFilterAsFilter::__invoke) consumes the result.
Accepts both PHP arrays and any iterable (Traversable) for the
empty-check to match upstream's isinstance(value, Iterable) and not value
semantics. We probe Traversable lazily by iterating once.
Tags
Table of Contents
Properties
- $name : string
Methods
- __construct() : mixed
- important() : bool
- `true` for operations that must always evaluate even when an earlier step in the chain raised `RejectOperations`. The canonical example is `~F->message->text` (`ImportantFunctionOperation` wrapping logical NOT): if `text` is missing we want the negation to still flip the `null` result to `true` rather than collapse to `false`.
- resolve() : mixed
- Evaluate this operation.
Properties
$name read-only
public
string
$name
Methods
__construct()
public
__construct(string $name) : mixed
Parameters
- $name : string
important()
`true` for operations that must always evaluate even when an earlier step in the chain raised `RejectOperations`. The canonical example is `~F->message->text` (`ImportantFunctionOperation` wrapping logical NOT): if `text` is missing we want the negation to still flip the `null` result to `true` rather than collapse to `false`.
public
important() : bool
Subclasses opt in by extending ImportantBaseOperation or by
overriding this method directly.
Return values
boolresolve()
Evaluate this operation.
public
resolve(mixed $value, mixed $initialValue) : mixed
Parameters
- $value : mixed
-
The current running value (output of the previous operation, or the original subject for the first step).
- $initialValue : mixed
-
The original subject passed to
MagicFilter::resolve. Used by combinator / comparator operations that need to resolve a nestedMagicFilteragainst the root rather than the current intermediate value.