Assert\Assertion::notNull PHP Method

notNull() public static method

Assert that value is not null
public static notNull ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
return boolean
    public static function notNull($value, $message = null, $propertyPath = null)
    {
        if ($value === null) {
            $message = sprintf($message ?: 'Value "%s" is null, but non null value was expected.', static::stringify($value));
            throw static::createException($value, $message, static::VALUE_NULL, $propertyPath);
        }
        return true;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function checkPKCEInput($code_challenge_method, $code_challenge, $code_verifier)
 {
     Assertion::true($this->hasPKCEMethod($code_challenge_method), sprintf('Unsupported code challenge method "%s".', $code_challenge_method));
     $method = $this->getPKCEMethod($code_challenge_method);
     Assertion::notNull($code_verifier, 'The parameter "code_verifier" is required.');
     Assertion::true($method->isChallengeVerified($code_verifier, $code_challenge), 'Invalid parameter "code_verifier".');
 }
All Usage Examples Of Assert\Assertion::notNull