final class Facts
    uses Snapshot
Public API: explicitly declared with @visibility public.

Every context-dependent fact an operation derived, keyed by the statement node it is about.

Facts are established when the operation is constructed and never filled in later. A node of another operation has no fact here.

Reading the fact of a nested expressiondoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 + NULL');
    $query->facts->scalar($query->field(0)->expression->right)->type instanceof \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\NullOnly // => true

Properties§

public list<Table> $declarations
public list<Diagnostic> $diagnostics
public QueryFact|null $output

Methods§

public function __construct(
    list<array{Scalar, ScalarFact}> $scalars,
    list<array{Node, RelationFact}> $relations,
    list<array{Query, QueryFact}> $queries,
    list<Table> $declarations,
    public QueryFact|null $output,
    list<Diagnostic> $diagnostics,
)

Parameters

$scalarslist<array{Scalar, ScalarFact}>The fact of each scalar expression
$relationslist<array{Node, RelationFact}>The fact of each relation occurrence and table use
$querieslist<array{Query, QueryFact}>The fact of each query
$declarationslist<Table>The relation declarations the statement provides
$outputQueryFact|nullThe rows the statement returns, when it returns rows
$diagnosticslist<Diagnostic>The semantic problems of the statement
Calls 4
public function index<TNode of object, TFact of object>(list<array{TNode, TFact}> $pairs): array<int, array{TNode, TFact}>
public function scalar(Scalar $node): ScalarFact

Answers the facts of a scalar expression of this operation.

Parameters

$nodeScalar

Returns

Calls 2
public function relation(Node $node): RelationFact

Answers the facts of a relation occurrence or table use of this operation.

Parameters

$nodeNode
Calls 2
public function query(Query $node): QueryFact

Answers the facts of a query of this operation.

Parameters

$nodeQuery

Returns

Calls 2
public function covers(Node $node): bool

Tells whether a node has a fact of any kind in this operation.

Parameters

$nodeNode

Returns

bool
Calls 1

Private surface 3§

Implementation details, listed for orientation only.

private array<int, array{Scalar, ScalarFact}> $scalars
private array<int, array{Node, RelationFact}> $relations
private array<int, array{Query, QueryFact}> $queries

Relations§

Instantiated in 1
Type declarations 2