classTypeRules
final class TypeRules
implements TypeRules
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.
PostgreSql TypeRules implementation.
Methods§
public function __construct(private Dialect $dialect)Retains the language identity used in semantic output.
Parameters
$dialect | Dialect |
public function read(Node $node, ?Node $table = null): TypeDescriptorReads a declared type, including table-dependent storage rules and modifiers.
Returns
Calls 5
- method-call Node::tokens() line 38
- function-call
implodeline 55 - method-call TypeRules::canonical() line 56
- function-call
strtoupperline 56 - new TypeDescriptor line 57
public function canonical(string $name): ?stringResolves the built-in aliases modeled for this dialect.
Parameters
$name | string |
Returns
?stringTest cases 1
Called from 1
Calls 1
- function-call
strtolowerline 76
public function affinity(string $name): stringComputes storage affinity from a declaration name.
Parameters
$name | string |
Returns
stringTest cases 1
Calls 1
- function-call
str_containsline 88
public function typeName(Token $token): ?stringClassifies a literal's lexical category without converting its contents.
Parameters
$token | Token |
Returns
?stringTest cases 1
Calls 7
- function-call
str_replaceline 109 - function-call
in_arrayline 110 - function-call
preg_matchline 110 - static-call Tree::unsupported() line 111
- function-call
strtoupperline 113 - method-call TypeRules::integer() line 115
- function-call
ctype_digitline 118
public function integer(string $text): stringChooses a PostgreSql integer width from its decimal spelling.
Parameters
$text | string |
Returns
stringTest cases 1
Called from 2
public function common(list<Expression> $expressions, Node|Token $source): TypeDescriptorpublic function boolean(): TypeDescriptorReturns the dialect result type of a predicate.
Returns
Test cases 2
Calls 1
public function arithmetic(
string $operator,
non-empty-list<Expression> $operands,
Node $source,
): TypeDescriptorResolves supported numeric operations, including signed literal boundaries.
Parameters
$operator | string | |
$operands | non-empty-list<Expression> | |
$source | Node |
Returns
Test cases 1
Calls 9
- method-call TypeResolution::common() line 190
- new TypeResolution line 190
- function-call
countline 191 - class-const ExpressionKind::Literal() line 191
- function-call
str_replaceline 192 - new TypeDescriptor line 194
- function-call
in_arrayline 199 - function-call
strtolowerline 199 - static-call Tree::unsupported() line 200
public function predicate(Expression $expression): voidParameters
$expression | Expression |
Throws
Test cases 1
Calls 2
- function-call
in_arrayline 210 - new SemanticException line 211
public function coalesce(list<Expression> $operands, TypeDescriptor $type): list<Expression>Parameters
$operands | list<Expression> | |
$type | TypeDescriptor |
Returns
list<Expression>Test cases 1
Calls 3
- function-call
array_mapline 221 - method-call ExpressionRules::coerce() line 221
- new ExpressionRules line 221
public function project(Expression $expression): ExpressionResolves the output type of a projected literal.
Parameters
$expression | Expression |
Returns
Test cases 1
Calls 4
- class-const ExpressionKind::Literal() line 229
- method-call ExpressionRules::coerce() line 230
- new ExpressionRules line 230
- new TypeDescriptor line 230
Private surface 1§
Implementation details, listed for orientation only.
private Dialect $dialectTest cases 70§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
TypeRulesTestcallsTypeRulesTest::testAffinityUsesDeclaredTypePrecedencecallsTypeRulesTest::testArithmeticRetainsLanguageSemanticscallsTypeRulesTest::testBooleanNamesPredicateResultcallsTypeRulesTest::testCanonicalResolvesIntegercallsTypeRulesTest::testCoalescePreservesOperandscallsTypeRulesTest::testCommonPreservesHomogeneousTypecallsTypeRulesTest::testIntegerModelsLargeMagnitudecallsTypeRulesTest::testPredicateAcceptsBooleanResultscallsTypeRulesTest::testProjectPreservesTypedValuescallsTypeRulesTest::testTypeNameClassifiesIntegerTokencalls
Other tests reaching this symbol 59
SchemaAnalyzerTestcallsColumnPropertiesTestcallsColumnReaderTestcallsConstraintReaderTestcallsDialectParserTestcallsIdentifiersTestcallsSchemaChangesTestcallsSchemaReaderTestcallsStatementListTestcallsTokenGroupsTestcallsTreeTestcallsTypeReaderTestcallsBinderTestcallsBoundRelationTestcallsExpressionBinderTestcallsExpressionRulesTestcallsFromBinderTestcallsIdentitySequenceTestcallsLiteralBinderTestcallsNullFactsTestcallsProjectionBinderTestcallsScopeTestcallsSelectBinderTestcallsSelectModifiersBinderTestcallsSyntaxGuardTestcallsTableResolverTestcallsTypeResolutionTestcallsDialectTestcallsBoundSelectTestcallsColumnBindingTestcallsExpressionKindTestcallsExpressionTestcallsJoinKindTestcallsJoinTestcallsOrderingTestcallsOutputColumnTestcallsTableUseTestcallsPlatformTestcallsNameRulesTestcallsQueryRulesTestcallsSchemaRulesTestcallsSyntaxRulesTestcallsColumnDefinitionTestcallsColumnGenerationTestcallsConstraintKindTestcallsGenerationKindTestcallsInvariantTestcallsTableConstraintTestcallsTableDefinitionTestcallsSchemaBuilderTestcallsSchemaTestcallsSemanticExceptionTestcallsNullabilityTestcallsTypeDescriptorTestcallsSchemaTestcallsNameRulesTestcallsPlatformTestcallsQueryRulesTestcallsSchemaRulesTestcalls