Assert\Assertion::noContent PHP Method

noContent() public static method

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

Usage Example

コード例 #1
0
 protected function marshallParts(InputInterface $input) : array
 {
     $parts = $input->getOption('part');
     $invalidParts = array_diff($parts, $this->validParts);
     Assertion::noContent($invalidParts, sprintf('Invalid parts specified: %s', implode(', ', $invalidParts)));
     if (in_array(static::PART_ALL, $parts)) {
         $parts = $this->puzzle->getPartMethods();
     }
     return $parts;
 }
All Usage Examples Of Assert\Assertion::noContent