final class TextPattern
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

A string the analyzer knows in part: resolved runs of text with gaps between them.

A pattern with no gaps is an exact string. One with gaps describes the shape of every string the expression can produce, which is what the catalog reports when a query is assembled from values that are not statically known.

Properties§

public list<TextSegment> $segments

Methods§

public static function fromText(string $text): self

A pattern that resolves to exactly the given characters.

Parameters

$textstring

Returns

self
Test cases 262
Called from 1
Calls 2
public static function fromHole(TextHole $hole): self

A pattern consisting of one unresolved gap.

Parameters

Returns

self
Test cases 69
Called from 4
Calls 1
public static function fromSegments(list<TextSegment> $segments): self

A pattern built from arbitrary segments, coalescing adjacent literals.

Parameters

$segmentslist<TextSegment>

Returns

self
Test cases 23
Called from 4
Calls 3
public function concat(self $other): self

The pattern produced by writing this one and then the other.

Parameters

$otherself

Returns

self
Calls 2
public function render(string $holeText): string

The pattern rendered with a caller-chosen stand-in for every gap.

Reading placeholders out of partially resolved SQL needs a stand-in that lexes as an ordinary word, so that a gap inside a quoted string does not end the string it sits in.

Parameters

$holeTextstring

Returns

string
Called from 4
public function equals(self $other): bool

Whether the two patterns describe the same string shape.

Parameters

$otherself

Returns

bool
Called from 1
Calls 2
public function isEmpty(): bool

Whether the pattern contributes no characters at all.

Returns

bool

Private surface 1§

Implementation details, listed for orientation only.

private function __construct(public list<TextSegment> $segments)

Test cases 339§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 15
Other tests reaching this symbol 324

Relations§

Static calls 9
Method calls 14
Type declarations 26