classBinder
final class Binder
Public API: explicitly declared with
@visibility public.Performs the SQL semantic phase: name binding, type resolution, and NULL propagation.
$consume = static fn (\SqlSemantics\Core\Binder $value): string => $value::class;
$consume instanceof \Closure // => trueProperties§
public Schema $schemaMethods§
public function __construct(public Schema $schema)Uses the schema's dialect, grammar release, and default name resolution schema.
Parameters
$schema | Schema |
Calls 1
- new DialectParser line 31
public function bind(string $sql): BoundSelectParses SQL and binds one SELECT into an immutable semantic representation.
Parameters
$sql | string | One SELECT statement in the schema's dialect |
Returns
BoundSelect Bound relations and expressions with types, NULL facts, and source syntaxThrows
SemanticException When names, types, or supported semantics cannot be resolvedLexicalException When SQL contains invalid tokensSyntaxException When SQL does not match the selected grammarTest cases 76
SemanticsBench::benchBindcallsIdentifiersTest::testEqualDistinguishesQuotedPostgresCasecallsIdentifiersTest::testNamePreservesQuotedPostgresCaseAndFoldsUnquotedNamescallsIdentifiersTest::testPartsDoesNotSplitDotsInsideQuotedIdentifierscallsIdentifiersTest::testRelationEqualModelsMysqlTableAliasesSeparatelyFromColumnscallsBinderTest::testBindPreservesSourceTextAndExpressionNodeIdentitycallsBinderTest::testBindPropagatesSyntaxErrorscallsBinderTest::testBindRejectsMissingDeclarationscallsBinderTest::testBindResetsStatementIdentitiesWhenReusingTheBindercallsBinderTest::testBindSelfJoinPreservesOccurrenceIdentityAndNullProvenancecallsBinderTest::testBindUsesTheSchemasDefaultNamespacecallsExpressionBinderTest::testBindsParenthesesAndUnaryOperatorscallsExpressionBinderTest::testCallRetainsNestedCoalesceInputscallsExpressionBinderTest::testOperationPreservesOperatorPrecedencecallsExpressionRulesTest::testArithmeticHandlesNegativePostgresIntegerBoundariescallsExpressionRulesTest::testCallNullIfCanIntroduceNullWithoutAnOuterJoincallsExpressionRulesTest::testCoerceRecordsPostgresCommonTypeConversionscallsExpressionRulesTest::testOperatorNullTestsAreNeverNullablecallsExpressionRulesTest::testPredicateRejectsNonBooleanPostgresInputscallsFromBinderTest::testBindCrossJoinHasNoMatchPredicatecallsFromBinderTest::testJoinedBindsOnBeforeIntroducingThisJoinsNullscallsFromBinderTest::testJoinPropagatesNestedOuterJoinProvenancecallsFromBinderTest::testRelationFullJoinExtendsBothSidescallsFromBinderTest::testSqliteRespectsExplicitDatabaseNamescallsFromBinderTest::testTableRejectsAliasColumnListscallsLiteralBinderTest::testBindDistinguishesMysqlUnsignedAndDecimalBoundariescallsLiteralBinderTest::testBindDistinguishesSqliteOverflowAsRealcallsLiteralBinderTest::testBindParametersRemainExplicitlyUnknownWithoutBindingscallsLiteralBinderTest::testIntegerClassifiesPostgresWidthsWithoutPhpOverflowcallsNullFactsTest::testCoalesceRequiresANonNullOperandToGuaranteeAValuecallsNullFactsTest::testExtensionsRetainsAllNullableOperandCausescallsNullFactsTest::testStrictComparisonPropagatesNullButBooleanOrDoesNotcallsProjectionBinderTest::testBindExpandsUnqualifiedStarInFromOrdercallsProjectionBinderTest::testItemDecodesMysqlStringAliasescallsProjectionBinderTest::testItemExpandsStarsAndPreservesDuplicateNamescallsProjectionBinderTest::testItemResolvesBarePostgresUnknownLiteralsAsTextcallsProjectionBinderTest::testStarRejectsAnUnknownQualifiercallsScopeTest::testColumnRejectsAmbiguousUnqualifiedNamescallsScopeTest::testCombineRejectsDuplicateAliasescallsScopeTest::testExtendDoesNotMutateTheInputScopecallsScopeTest::testMatchesAliasHidesOriginalTableNamecallsScopeTest::testRejectsReferencesOutsideJoinOperandscallsSelectBinderTest::testBindConstantQueriesWithoutARelationcallsSelectModifiersBinderTest::testOrderingResolvesAliasesAndDirectioncallsSelectModifiersBinderTest::testPaginationReadsMysqlCommaOrdercallsSelectModifiersBinderTest::testPaginationRejectsFetchWithTiesRatherThanDroppingItsMeaningcallsSelectModifiersBinderTest::testRejectsOutOfRangeOrderPositioncallsSelectModifiersBinderTest::testSortExpressionDoesNotResolveAStringLiteralAsAnAliascallsSelectModifiersBinderTest::testSortExpressionResolvesPositionsAndNullPlacementcallsSyntaxGuardTest::testSelectRejectsUnmodeledConstructscallsTableResolverTest::testRejectsMissingTablesInsteadOfInventingColumnscallsTableResolverTest::testResolvesQualifiedDeclarationscallsTypeResolutionTest::testCommonPromotesIntegerOperandscallsTypeResolutionTest::testRejectsUnmodeledCoercioncallsBoundSelectTest::testRetainsRowDependenciesAbsentFromValueLineagecallsColumnBindingTest::testRetainsDeclarationIdentitycallsExpressionKindTest::testDistinguishesNullHandlingOperationscallsExpressionTest::testLineageDeduplicatesByOccurrenceAndColumncallsJoinTest::testRetainsTheMatchTreecallsOrderingTest::testKeepsSortDirectionSeparateFromTheExpressioncallsOutputColumnTest::testDoesNotInventEngineSpecificExpressionLabelscallsTableUseTest::testSeparatesAliasesSharingOneDeclarationcallsPlatformTest::testQueryKeepsProjectionOrdercallsQueryRulesTest::testProjectionItemsPreserveOutputOrdercallsQueryRulesTest::testProjectionTokensExpandQualifiedStarcallsQueryRulesTest::testRelationResolvesAnAliascallsSchemaBuilderTest::testBuildDoesNotAccumulatePreviousDeclarationscallsSchemaBuilderTest::testBuildKeepsExplicitlyQualifiedDeclarationscallsSchemaTest::testAnalyzePreservesStatePropertiescallsSchemaTest::testAnalyzeResolvesAnyAffinityFromTableOptionscallsPlatformTest::testQueryKeepsProjectionOrdercallsQueryRulesTest::testJoinedTracksNullableInputcallsQueryRulesTest::testOrderingNodesPreserveDirectioncallsQueryRulesTest::testProjectionItemsPreserveOutputOrdercallsQueryRulesTest::testProjectionTokensExpandQualifiedStarcallsQueryRulesTest::testRelationResolvesAnAliascalls
Calls 5
- new TableResolver line 45
- new Identifiers line 45
- method-call SelectBinder::bind() line 47
- new SelectBinder line 47
- method-call DialectParser::parse() line 47
Private surface 1§
Implementation details, listed for orientation only.
private DialectParser $parserTest cases 109§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
BinderTest::testBindPreservesSourceTextAndExpressionNodeIdentitycallsBinderTest::testBindPropagatesSyntaxErrorscallsBinderTest::testBindRejectsMissingDeclarationscallsBinderTest::testBindResetsStatementIdentitiesWhenReusingTheBindercallsBinderTest::testBindSelfJoinPreservesOccurrenceIdentityAndNullProvenancecallsBinderTest::testBindUsesTheSchemasDefaultNamespacecalls
Other tests reaching this symbol 103
SemanticsBench::benchBindcallsSemanticsBench::setUpcallsSchemaAnalyzerTestcallsColumnPropertiesTestcallsColumnReaderTestcallsConstraintReaderTestcallsIdentifiersTest::testEqualDistinguishesQuotedPostgresCasecallsIdentifiersTest::testNamePreservesQuotedPostgresCaseAndFoldsUnquotedNamescallsIdentifiersTest::testPartsDoesNotSplitDotsInsideQuotedIdentifierscallsIdentifiersTest::testRelationEqualModelsMysqlTableAliasesSeparatelyFromColumnscallsSchemaChangesTestcallsSchemaReaderTestcallsStatementListTestcallsTokenGroupsTestcallsTreeTestcallsTypeReaderTestcallsBoundRelationTestcallsExpressionBinderTest::testBindsParenthesesAndUnaryOperatorscallsExpressionBinderTest::testCallRetainsNestedCoalesceInputscallsExpressionBinderTest::testOperationPreservesOperatorPrecedencecallsExpressionRulesTest::testArithmeticHandlesNegativePostgresIntegerBoundariescallsExpressionRulesTest::testCallNullIfCanIntroduceNullWithoutAnOuterJoincallsExpressionRulesTest::testCoerceRecordsPostgresCommonTypeConversionscallsExpressionRulesTest::testOperatorNullTestsAreNeverNullablecallsExpressionRulesTest::testPredicateRejectsNonBooleanPostgresInputscallsFromBinderTest::testBindCrossJoinHasNoMatchPredicatecallsFromBinderTest::testJoinedBindsOnBeforeIntroducingThisJoinsNullscallsFromBinderTest::testJoinPropagatesNestedOuterJoinProvenancecallsFromBinderTest::testRelationFullJoinExtendsBothSidescallsFromBinderTest::testSqliteRespectsExplicitDatabaseNamescallsFromBinderTest::testTableRejectsAliasColumnListscallsIdentitySequenceTestcallsLiteralBinderTest::testBindDistinguishesMysqlUnsignedAndDecimalBoundariescallsLiteralBinderTest::testBindDistinguishesSqliteOverflowAsRealcallsLiteralBinderTest::testBindParametersRemainExplicitlyUnknownWithoutBindingscallsLiteralBinderTest::testIntegerClassifiesPostgresWidthsWithoutPhpOverflowcallsNullFactsTest::testCoalesceRequiresANonNullOperandToGuaranteeAValuecallsNullFactsTest::testExtensionsRetainsAllNullableOperandCausescallsNullFactsTest::testStrictComparisonPropagatesNullButBooleanOrDoesNotcallsProjectionBinderTest::testBindExpandsUnqualifiedStarInFromOrdercallsProjectionBinderTest::testItemDecodesMysqlStringAliasescallsProjectionBinderTest::testItemExpandsStarsAndPreservesDuplicateNamescallsProjectionBinderTest::testItemResolvesBarePostgresUnknownLiteralsAsTextcallsProjectionBinderTest::testStarRejectsAnUnknownQualifiercallsScopeTest::testColumnRejectsAmbiguousUnqualifiedNamescallsScopeTest::testCombineRejectsDuplicateAliasescallsScopeTest::testExtendDoesNotMutateTheInputScopecallsScopeTest::testMatchesAliasHidesOriginalTableNamecallsScopeTest::testRejectsReferencesOutsideJoinOperandscallsSelectBinderTest::testBindConstantQueriesWithoutARelationcallsSelectModifiersBinderTest::testOrderingResolvesAliasesAndDirectioncallsSelectModifiersBinderTest::testPaginationReadsMysqlCommaOrdercallsSelectModifiersBinderTest::testPaginationRejectsFetchWithTiesRatherThanDroppingItsMeaningcallsSelectModifiersBinderTest::testRejectsOutOfRangeOrderPositioncallsSelectModifiersBinderTest::testSortExpressionDoesNotResolveAStringLiteralAsAnAliascallsSelectModifiersBinderTest::testSortExpressionResolvesPositionsAndNullPlacementcallsSyntaxGuardTest::testSelectRejectsUnmodeledConstructscallsTableResolverTest::testRejectsMissingTablesInsteadOfInventingColumnscallsTableResolverTest::testResolvesQualifiedDeclarationscallsTypeResolutionTest::testCommonPromotesIntegerOperandscallsTypeResolutionTest::testRejectsUnmodeledCoercioncallsDialectTestcallsBoundSelectTest::testRetainsRowDependenciesAbsentFromValueLineagecallsColumnBindingTest::testRetainsDeclarationIdentitycallsExpressionKindTest::testDistinguishesNullHandlingOperationscallsExpressionTest::testLineageDeduplicatesByOccurrenceAndColumncallsJoinKindTestcallsJoinTest::testRetainsTheMatchTreecallsOrderingTest::testKeepsSortDirectionSeparateFromTheExpressioncallsOutputColumnTest::testDoesNotInventEngineSpecificExpressionLabelscallsTableUseTest::testSeparatesAliasesSharingOneDeclarationcallsPlatformTest::testQueryKeepsProjectionOrdercallsNameRulesTestcallsQueryRulesTest::testProjectionItemsPreserveOutputOrdercallsQueryRulesTest::testProjectionTokensExpandQualifiedStarcallsQueryRulesTest::testRelationResolvesAnAliascallsSchemaRulesTestcallsSyntaxRulesTestcallsTypeRulesTestcallsColumnDefinitionTestcallsColumnGenerationTestcallsConstraintKindTestcallsGenerationKindTestcallsInvariantTestcallsTableConstraintTestcallsTableDefinitionTestcallsSchemaBuilderTest::testBuildDoesNotAccumulatePreviousDeclarationscallsSchemaBuilderTest::testBuildKeepsExplicitlyQualifiedDeclarationscallsSchemaTestcallsSemanticExceptionTestcallsNullabilityTestcallsTypeDescriptorTestcallsSchemaTest::testAnalyzePreservesStatePropertiescallsSchemaTest::testAnalyzeResolvesAnyAffinityFromTableOptionscallsNameRulesTestcallsPlatformTest::testQueryKeepsProjectionOrdercallsQueryRulesTest::testJoinedTracksNullableInputcallsQueryRulesTest::testOrderingNodesPreserveDirectioncallsQueryRulesTest::testProjectionItemsPreserveOutputOrdercallsQueryRulesTest::testProjectionTokensExpandQualifiedStarcallsQueryRulesTest::testRelationResolvesAnAliascallsSchemaRulesTestcallsTypeRulesTestcalls