final class LexemeConstraint
Public API: explicitly declared with @visibility public.

A constructive set of token spellings, independent of their position in a statement.

Constrain an identifier without fixing other identifiersdoctest
$names = \SqlFaker\Generation\Plan\LexemeConstraint::oneOf('users', 'orders');
    $names->accepts('users') // => true
    $names->accepts('products') // => false

Methods§

public function __construct(
    private list<string> $values,
    private int $minimum = 0,
    private int $maximum = PHP_INT_MAX,
)

An empty spelling set selects the integer interval instead.

Parameters

$valueslist<string>
$minimumint
$maximumint

Throws

InvalidArgumentException When the integer interval is empty or negative
Calls 1
  • new InvalidArgumentException line 30
public static function oneOf(string $first, string ...$others): self

Keeps every supplied spelling reachable, including quoted names and literals.

Parameters

$firststring
$othersstring

Returns

self
Test cases 21
Calls 3
public function choose(Closure(positive-int): int $choose): string

Parameters

$chooseClosure(positive-int): int

Returns

string
Test cases 1
Calls 3
public function accepts(string $value): bool

Checks an exact spelling without coercing quoted strings into numbers.

Parameters

$valuestring

Returns

bool
Called from 1
Calls 4
public function intersect(self $other): self

Intersects conditions constructively, without generating and rejecting samples.

Parameters

$otherself

Returns

self

Throws

InvalidArgumentException When the conditions have no common spelling
Calls 9

Private surface 3§

Implementation details, listed for orientation only.

private list<string> $values
private int $minimum = 0
private int $maximum = PHP_INT_MAX

Test cases 25§

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

Dedicated tests 8
Other tests reaching this symbol 17

Relations§

Type declarations 2