The side effects of a function or method, as returned by getSideEffects().
A function has the named effects, such as io.output, and possibly any other
effect as much as $others says: No when the list is known to be complete,
Maybe when nothing is known, Yes when it has some effects that are not
named.
The called parameters are those flagged as pure unless the callable is
impure: the call has the side effects of the callable passed there. The
written parameters are those flagged as pure unless the parameter is passed,
and those named by a listed writes-args($a, $b): the call writes to the
argument passed there.
| Methods |
public
static
|
none(): self
|
#
|
public
static
|
all(): self
|
#
|
public
static
|
unknown(): self
|
#
|
public
static
|
create(
list<string> $effects,
TrinaryLogic $others,
array<string, TrinaryLogic> $calledParameters = [],
array<string, TrinaryLogic> $writtenParameters = [],
bool $readsWrittenArguments = false,
): self
$readsWrittenArguments says that a written parameter is passed by
reference and also read, like array_shift()'s $array: the call changes
what its next call returns.
$readsWrittenArguments says that a written parameter is passed by
reference and also read, like array_shift()'s $array: the call changes
what its next call returns.
|
#
|
public
|
hasAny(): TrinaryLogic
Maybe when only the called and written parameters can bring effects in.
Maybe when only the called and written parameters can bring effects in.
|
#
|
public
|
has(string $effect): TrinaryLogic
Whether the call has the effect, or one of its sub-effects: has('io') is
Yes for io.files. A listed parent effect makes a sub-effect Maybe.
Whether the call has the effect, or one of its sub-effects: has('io') is
Yes for io.files. A listed parent effect makes a sub-effect Maybe.
|
#
|
public
|
isDeterministic(): TrinaryLogic
Whether calling it again with the same arguments gives the same result.
A result that depends on global state is deterministic until the state
is written. A call that writes an argument it reads is not: the next call
gets the written value. The callables passed to the called parameters do
not count: a call only knows its own effects.
Whether calling it again with the same arguments gives the same result.
A result that depends on global state is deterministic until the state
is written. A call that writes an argument it reads is not: the next call
gets the written value. The callables passed to the called parameters do
not count: a call only knows its own effects.
|
#
|
public
|
hasOnly(list<string> $effects): TrinaryLogic
Whether every effect of the call is one of $effects or a sub-effect of
one: hasOnly(['nondeterministic']) is Yes for nondeterministic.time. A
listed parent of one of them, or unlisted effects that are only possible,
make it Maybe. The written parameters count as writes-args. The callables
passed to the called parameters do not count: a call only knows its own
effects.
Whether every effect of the call is one of $effects or a sub-effect of
one: hasOnly(['nondeterministic']) is Yes for nondeterministic.time. A
listed parent of one of them, or unlisted effects that are only possible,
make it Maybe. The written parameters count as writes-args. The callables
passed to the called parameters do not count: a call only knows its own
effects.
|
#
|
public
|
getEffectNames(): list<string>
The listed names, for messages, the reflection golden test, and telling
a listed effect from one only possible through unlisted effects.
The listed names, for messages, the reflection golden test, and telling
a listed effect from one only possible through unlisted effects.
|
#
|
public
|
getListedSubEffects(string $effect): list<string>|null
The listed sub-effects of $effect without its prefix, such as
['stat-cache'] for writes-global.stat-cache: the named parts of the
global state a call writes or reads. Null when $effect itself is listed,
[] when neither is. Unlisted effects do not count.
The listed sub-effects of $effect without its prefix, such as
['stat-cache'] for writes-global.stat-cache: the named parts of the
global state a call writes or reads. Null when $effect itself is listed,
[] when neither is. Unlisted effects do not count.
|
#
|
public
|
getCalledParameters(): array<string, TrinaryLogic>
|
#
|
public
|
getWrittenParameters(): array<string, TrinaryLogic>
|
#
|
public
|
writesParameter(string $parameterName): TrinaryLogic
Whether the call writes to the argument passed to the parameter. A
listed writes-args without parameters writes to every argument;
writes-args($a, $b) writes only to those, which are written parameters.
Whether the call writes to the argument passed to the parameter. A
listed writes-args without parameters writes to every argument;
writes-args($a, $b) writes only to those, which are written parameters.
|
#
|