Webmozart\Assert\Assert::null PHP Method

null() public static method

public static null ( $value, $message = '' )
    public static function null($value, $message = '')
    {
        if (null !== $value) {
            static::reportInvalidArgument(sprintf($message ?: 'Expected null. Got: %s', static::valueToString($value)));
        }
    }

Usage Example

Esempio n. 1
0
 public function __construct(BankAccountInterface $bankAccount, $specKnown, $specResult)
 {
     try {
         Assert::boolean($specKnown, 'specKnown should be a boolean, got: `%s`');
         if (true === $specKnown) {
             Assert::boolean($specResult, 'specResult should be a boolean, got: `%s`');
         } else {
             Assert::null($specResult, 'specResult should be null, got: `%s`');
         }
     } catch (\InvalidArgumentException $e) {
         throw E::wrap($e);
     }
     $this->bankAccount = $bankAccount;
     $this->specKnown = $specKnown;
     $this->specResult = $specResult;
 }
All Usage Examples Of Webmozart\Assert\Assert::null