classUpsertTruth
final class UpsertTruth
Answers whether a value counts as true, in SQL's three-valued logic.
Null is not false: it is unknown, and it stays unknown through NOT. It only stops mattering where the other operand settles the answer on its own — one false makes an AND false, one true makes an OR true — which is what makes these different from PHP's own operators.
Type Aliases§
RowValue = import from TableDefinitionMethods§
public function __construct(private UpsertNumber $numbers = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertNumber())Parameters
$numbers | UpsertNumber | Reads a value as the number it stands for |
Test cases 12
UpsertTruthTest::testAndHoldsOnlyWhenBothSidesDocoversUpsertTruthTest::testAndIsFalseWhereOneSideIsFalseHoweverUnknownTheOtherIscoversUpsertTruthTest::testAndIsUnknownWhereOneSideIsUnknownAndTheOtherHoldscoversUpsertTruthTest::testNotLeavesTheUnknownUnknowncoversUpsertTruthTest::testNotTurnsTheAnswerAroundcoversUpsertTruthTest::testOfCountsAnyNumberButZeroAsTruecoversUpsertTruthTest::testOfIsUnknownForAnUnknownValuecoversUpsertTruthTest::testOfKeepsABooleanAsItIscoversUpsertTruthTest::testOfRefusesAValueThatIsNeitherBooleanNorANumbercoversUpsertTruthTest::testOrHoldsWhenEitherSideDoescoversUpsertTruthTest::testOrIsTrueWhereOneSideHoldsHoweverUnknownTheOtherIscoversUpsertTruthTest::testOrIsUnknownWhereOneSideIsUnknownAndTheOtherDoesNotHoldcovers
Calls 1
- new UpsertNumber line 25
public function of(mixed $value): bool|nullAnswers whether a value counts as true.
Parameters
$value | mixed | Value to read |
Returns
bool|null Whether it does, or null when the value is unknownThrows
UnsupportedSqlException When the value is neither boolean nor a numberTest cases 6
UpsertTruthTest::testNotLeavesTheUnknownUnknowncoversUpsertTruthTest::testNotTurnsTheAnswerAroundcoversUpsertTruthTest::testOfCountsAnyNumberButZeroAsTruecovers and callsUpsertTruthTest::testOfIsUnknownForAnUnknownValuecovers and callsUpsertTruthTest::testOfKeepsABooleanAsItIscovers and callsUpsertTruthTest::testOfRefusesAValueThatIsNeitherBooleanNorANumbercovers and calls
Called from 4
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator::apply() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertOperator.php:72
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator::apply() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertOperator.php:73
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertTruth::not() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertTruth.php:61
- method-call ZtdQuery\Shadow\Mutation\UpsertExpression::matches() packages/ztd-query-core/src/Shadow/Mutation/UpsertExpression.php:178
Calls 3
- function-call
is_boolline 43 - function-call
in_arrayline 47 - method-call UpsertNumber::of() line 47
public function not(mixed $value): bool|nullAnswers the opposite of what a value counts as.
Parameters
$value | mixed | Value to read |
Returns
bool|null The opposite, or null when the value is unknownThrows
UnsupportedSqlException When the value is neither boolean nor a numberTest cases 2
UpsertTruthTest::testNotLeavesTheUnknownUnknowncovers and callsUpsertTruthTest::testNotTurnsTheAnswerAroundcovers and calls
Called from 1
Calls 1
- method-call UpsertTruth::of() line 61
public function and(bool|null $left, bool|null $right): bool|nullAnswers whether both sides hold.
Parameters
$left | bool|null | Left operand |
$right | bool|null | Right operand |
Returns
bool|null Whether both do, or null when that cannot be saidTest cases 3
UpsertTruthTest::testAndHoldsOnlyWhenBothSidesDocovers and callsUpsertTruthTest::testAndIsFalseWhereOneSideIsFalseHoweverUnknownTheOtherIscovers and callsUpsertTruthTest::testAndIsUnknownWhereOneSideIsUnknownAndTheOtherHoldscovers and calls
public function or(bool|null $left, bool|null $right): bool|nullAnswers whether either side holds.
Parameters
$left | bool|null | Left operand |
$right | bool|null | Right operand |
Returns
bool|null Whether either does, or null when that cannot be saidTest cases 3
UpsertTruthTest::testOrHoldsWhenEitherSideDoescovers and callsUpsertTruthTest::testOrIsTrueWhereOneSideHoldsHoweverUnknownTheOtherIscovers and callsUpsertTruthTest::testOrIsUnknownWhereOneSideIsUnknownAndTheOtherDoesNotHoldcovers and calls
Private surface 1§
Implementation details, listed for orientation only.
private UpsertNumber $numbers = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertNumber()Test cases 19§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 12
UpsertTruthTest::testAndHoldsOnlyWhenBothSidesDocovers and callsUpsertTruthTest::testAndIsFalseWhereOneSideIsFalseHoweverUnknownTheOtherIscovers and callsUpsertTruthTest::testAndIsUnknownWhereOneSideIsUnknownAndTheOtherHoldscovers and callsUpsertTruthTest::testNotLeavesTheUnknownUnknowncovers and callsUpsertTruthTest::testNotTurnsTheAnswerAroundcovers and callsUpsertTruthTest::testOfCountsAnyNumberButZeroAsTruecovers and callsUpsertTruthTest::testOfIsUnknownForAnUnknownValuecovers and callsUpsertTruthTest::testOfKeepsABooleanAsItIscovers and callsUpsertTruthTest::testOfRefusesAValueThatIsNeitherBooleanNorANumbercovers and callsUpsertTruthTest::testOrHoldsWhenEitherSideDoescovers and callsUpsertTruthTest::testOrIsTrueWhereOneSideHoldsHoweverUnknownTheOtherIscovers and callsUpsertTruthTest::testOrIsUnknownWhereOneSideIsUnknownAndTheOtherDoesNotHoldcovers and calls
Other tests reaching this symbol 7
ConflictSearchTestcallsMutationImpactTestcallsInsertMutationTestcallsUpsertOperatorTestcallsUpsertExpressionTestcallsUpsertMutationTestcallsUpsertUpdateTestcalls
Relations§
Instantiated in 2
Method calls 6
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator::apply() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertOperator.php:60
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator::apply() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertOperator.php:72
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator::apply() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertOperator.php:72
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator::apply() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertOperator.php:73
- method-call ZtdQuery\Shadow\Mutation\Upsert\UpsertOperator::apply() packages/ztd-query-core/src/Shadow/Mutation/Upsert/UpsertOperator.php:73
- method-call ZtdQuery\Shadow\Mutation\UpsertExpression::matches() packages/ztd-query-core/src/Shadow/Mutation/UpsertExpression.php:178