classInvariant
final class Invariant
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.
Construction invariants shared by immutable catalog values.
Methods§
public static function ensure(bool $condition, string $message): voidRejects invalid public construction even when PHP assertions are disabled.
Parameters
$condition | bool | |
$message | string |
Throws
InvalidArgumentException When a state invariant does not holdCalled from 15
- static-call SqlSemantics\Core\Schema::__construct() packages/sql-semantics/src/Core/Schema.php:35
- static-call SqlSemantics\Core\Schema::__construct() packages/sql-semantics/src/Core/Schema.php:39
- static-call SqlSemantics\Core\Schema\ColumnGeneration::__construct() packages/sql-semantics/src/Core/Schema/ColumnGeneration.php:28
- static-call SqlSemantics\Core\Schema\Invariant::elements() packages/sql-semantics/src/Core/Schema/Invariant.php:36
- static-call SqlSemantics\Core\Schema\Invariant::members() packages/sql-semantics/src/Core/Schema/Invariant.php:49
- static-call SqlSemantics\Core\Schema\Invariant::members() packages/sql-semantics/src/Core/Schema/Invariant.php:51
- static-call SqlSemantics\Core\Schema\Invariant::names() packages/sql-semantics/src/Core/Schema/Invariant.php:63
- static-call SqlSemantics\Core\Schema\Invariant::names() packages/sql-semantics/src/Core/Schema/Invariant.php:65
- static-call SqlSemantics\Core\Schema\Invariant::table() packages/sql-semantics/src/Core/Schema/Invariant.php:76
- static-call SqlSemantics\Core\Schema\Invariant::table() packages/sql-semantics/src/Core/Schema/Invariant.php:78
- static-call SqlSemantics\Core\Schema\Invariant::table() packages/sql-semantics/src/Core/Schema/Invariant.php:84
- static-call SqlSemantics\Core\Schema\Invariant::table() packages/sql-semantics/src/Core/Schema/Invariant.php:87
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:46
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:47
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:48
Calls 1
- new
InvalidArgumentExceptionline 25
public static function elements(?Element ...$elements): voidParameters
$elements | ?Element |
Throws
InvalidArgumentException When an SQL value graph is mutable
Requires independent immutable SQL values, never retained parser nodes.Called from 4
- static-call SqlSemantics\Core\Schema\ColumnDefinition::__construct() packages/sql-semantics/src/Core/Schema/ColumnDefinition.php:44
- static-call SqlSemantics\Core\Schema\ColumnGeneration::__construct() packages/sql-semantics/src/Core/Schema/ColumnGeneration.php:29
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:45
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:41
Calls 3
- static-call Invariant::ensure() line 36
- method-call ImmutableGraph::containsOnlyImmutableValues() line 36
- new ImmutableGraph line 36
public static function members<T>(array<array-key, T> $members, class-string $class): voidParameters
$members | array<array-key, T> | |
$class | class-string |
Throws
InvalidArgumentException When the list or its members have the wrong shape
Checks the runtime boundary of PHP arrays, whose item types are not enforced by PHP.Called from 5
- static-call SqlSemantics\Core\Schema::__construct() packages/sql-semantics/src/Core/Schema.php:34
- static-call SqlSemantics\Core\Schema\ColumnDefinition::__construct() packages/sql-semantics/src/Core/Schema/ColumnDefinition.php:43
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:38
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:39
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:40
Calls 2
- static-call Invariant::ensure() line 49
- function-call
array_is_listline 49
public static function names<T>(array<array-key, T> $names): voidParameters
$names | array<array-key, T> |
Throws
InvalidArgumentException When a name has the wrong type or the list has the wrong shape
Requires an ordered list of names; dialects may allow empty quoted names.Called from 4
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:42
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:43
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:44
- static-call SqlSemantics\Core\Type\TypeDescriptor::__construct() packages/sql-semantics/src/Core/Type/TypeDescriptor.php:34
Calls 3
- static-call Invariant::ensure() line 63
- function-call
array_is_listline 63 - function-call
is_stringline 65
public static function table(TableDefinition $table, Dialect $dialect): voidValidates the names and types of a table in its state's dialect.
Parameters
$table | TableDefinition | |
$dialect | Dialect |
Throws
InvalidArgumentException When column identities, types or local keys conflictCalled from 1
Calls 3
- static-call Invariant::ensure() line 76
- method-call Dialect::platform() line 77
- class-const ConstraintKind::PrimaryKey() line 86
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
InvariantTestcalls
Other tests reaching this symbol 6
SchemaAnalyzerTestcallsColumnPropertiesTestcallsSchemaChangesTestcallsColumnGenerationTestcallsGenerationKindTestcallsSchemaTestcalls
Relations§
Static calls 20
- static-call SqlSemantics\Core\Schema::__construct() packages/sql-semantics/src/Core/Schema.php:34
- static-call SqlSemantics\Core\Schema::__construct() packages/sql-semantics/src/Core/Schema.php:35
- static-call SqlSemantics\Core\Schema::__construct() packages/sql-semantics/src/Core/Schema.php:39
- static-call SqlSemantics\Core\Schema::__construct() packages/sql-semantics/src/Core/Schema.php:41
- static-call SqlSemantics\Core\Schema\ColumnDefinition::__construct() packages/sql-semantics/src/Core/Schema/ColumnDefinition.php:43
- static-call SqlSemantics\Core\Schema\ColumnDefinition::__construct() packages/sql-semantics/src/Core/Schema/ColumnDefinition.php:44
- static-call SqlSemantics\Core\Schema\ColumnGeneration::__construct() packages/sql-semantics/src/Core/Schema/ColumnGeneration.php:28
- static-call SqlSemantics\Core\Schema\ColumnGeneration::__construct() packages/sql-semantics/src/Core/Schema/ColumnGeneration.php:29
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:42
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:43
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:44
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:45
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:46
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:47
- static-call SqlSemantics\Core\Schema\TableConstraint::__construct() packages/sql-semantics/src/Core/Schema/TableConstraint.php:48
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:38
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:39
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:40
- static-call SqlSemantics\Core\Schema\TableDefinition::__construct() packages/sql-semantics/src/Core/Schema/TableDefinition.php:41
- static-call SqlSemantics\Core\Type\TypeDescriptor::__construct() packages/sql-semantics/src/Core/Type/TypeDescriptor.php:34