classCoercions
final class Coercions
The implicit casts between pg_catalog types that function resolution may apply.
Rule: PG-IMPLICIT-CAST-001. The table lists the casts of pg_cast marked implicit among the numeric, string, date/time and bit-string types; a value of type unknown (a string constant or NULL) can be converted to any type. Types are compared without modifiers: a modifier never selects a function. Source: https://www.postgresql.org/docs/17/typeconv-func.html, https://www.postgresql.org/docs/17/sql-createcast.html. Termination: constant work. Status: Implemented.
Methods§
public function key(TypeFact $fact): ?stringAnswers the type name an argument contributes to function lookup: unknown for a string constant or NULL, null when the type is not a catalog type of the table.
Parameters
$fact | TypeFact |
Returns
?stringTest cases 1
Called from 1
Calls 2
- class-const Builtin::Unknown() line 56
- method-call Coercions::descriptor() line 59
public function descriptor(TypeDescriptor $descriptor): ?stringAnswers the catalog name of a type without its modifiers, null for a type the table does not name.
Parameters
$descriptor | TypeDescriptor |
Returns
?stringTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\Coercions::key() packages/sql-semantics-postgres/src/Rules/Invocation/Coercions.php:59
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\Coercions::descriptor() packages/sql-semantics-postgres/src/Rules/Invocation/Coercions.php:77
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\XmlChecks::serialized() packages/sql-semantics-postgres/src/Rules/Invocation/XmlChecks.php:80
Calls 2
- class-const Builtin::Interval() line 74
- method-call Coercions::descriptor() line 77
public function implicit(string $from, string $to): boolTells whether a value of one type can be passed where another is expected without an explicit cast.
Parameters
$from | string | |
$to | string |
Returns
boolTest cases 1
Called from 1
Calls 3
- class-const Builtin::Unknown() line 90
- function-call
in_arrayline 90 - class-const Coercions::IMPLICIT() line 90
public function type(string $name): TypeDescriptorAnswers the type a catalog name of the table denotes.
Parameters
$name | string |
Returns
Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\CallTyping::result() packages/sql-semantics-postgres/src/Rules/Invocation/CallTyping.php:139
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\Coercions::type() packages/sql-semantics-postgres/src/Rules/Invocation/Coercions.php:98
Calls 5
- function-call
str_ends_withline 98 - new ArrayOf line 98
- method-call Coercions::type() line 98
- function-call
substrline 98 - static-call Builtin::from() line 98
Private surface 1§
Implementation details, listed for orientation only.
private const IMPLICIT = ['int2' => ['int4', 'int8', 'numeric', 'float4', 'float8', 'oid'], 'int4' => ['…Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 4
- new SqlSemantics\Platform\PostgreSql\Rules\Invocation\CallTyping::row() packages/sql-semantics-postgres/src/Rules/Invocation/CallTyping.php:112
- new SqlSemantics\Platform\PostgreSql\Rules\Invocation\CallTyping::result() packages/sql-semantics-postgres/src/Rules/Invocation/CallTyping.php:139
- new SqlSemantics\Platform\PostgreSql\Rules\Invocation\RoutineMatch::find() packages/sql-semantics-postgres/src/Rules/Invocation/RoutineMatch.php:40
- new SqlSemantics\Platform\PostgreSql\Rules\Invocation\XmlChecks::serialized() packages/sql-semantics-postgres/src/Rules/Invocation/XmlChecks.php:80
Method calls 4
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\CallTyping::row() packages/sql-semantics-postgres/src/Rules/Invocation/CallTyping.php:115
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\CallTyping::result() packages/sql-semantics-postgres/src/Rules/Invocation/CallTyping.php:139
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\RoutineMatch::find() packages/sql-semantics-postgres/src/Rules/Invocation/RoutineMatch.php:51
- method-call SqlSemantics\Platform\PostgreSql\Rules\Invocation\XmlChecks::serialized() packages/sql-semantics-postgres/src/Rules/Invocation/XmlChecks.php:80