classNullTest
final class NullTest
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A test for NULL: a IS [NOT] NULL, a ISNULL, a NOTNULL.
Mirrors PostgreSQL's NullTest node (IS_NULL, IS_NOT_NULL). For a row value the test applies to every field.
Rule: PG-NULL-TEST-001. Facts: boolean, never NULL. The operand must keep its place before IS (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-comparison.html. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT NULL IS NOT NULL')->field(0)->nullability // => \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Nullability::NotNullProperties§
public Scalar $operandpublic bool $negatedpublic NullTestSpelling $spelling = NullTestSpelling::KeywordsMethods§
public function __construct(
public Scalar $operand,
public bool $negated,
public NullTestSpelling $spelling = NullTestSpelling::Keywords,
)Parameters
$operand | Scalar | The tested value |
$negated | bool | Whether the test is for a value that is not NULL |
$spelling | NullTestSpelling | How the test is written |
Calls 5
- class-const NullTestSpelling::Keywords() line 42
- static-call Check::input() line 44
- method-call Precedence::before() line 44
- new Precedence line 44
- class-const Precedence::IS() line 44
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand; the test is a boolean that is never NULL.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- method-call Derivation::scalar() line 52
- new ScalarFact line 54
- new Known line 54
- class-const Builtin::Bool() line 54
- class-const Nullability::NotNull() line 54
public function render(Output $out): voidWrites the value and the test.
Parameters
$out | Output |
Test cases 1
Calls 4
- method-call Output::node() line 62
- class-const NullTestSpelling::Keywords() line 64
- method-call Output::keyword() line 64
- class-const NullTestSpelling::Postfix() line 65
Test cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 8
PredicateRuleTest::testLowerLowersAPostfixNullTestcallsPrecedenceTest::testOpeningIsTheWeakestTokenOnTheLeftEdgecallsPrecedenceTest::testOperatorsAnswersNullForAPredicatecallsPrecedenceTest::testPredicatesAnswersTheEdgesOfANullTestcallsPrecedenceTest::testRestrictedTellsBExprFormscallsDefaultExpressionTest::testRefusesAnExpressionThatNeedsParenthesescallsBetweenTest::testRejectsALowBoundOutsideBExprcallsDistinctTestTest::testRejectsANullTestOnTheRightcalls