本文整理汇总了PHP中Webmozart\Assert\Assert::nullOrStringNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::nullOrStringNotEmpty方法的具体用法?PHP Assert::nullOrStringNotEmpty怎么用?PHP Assert::nullOrStringNotEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Assert\Assert
的用法示例。
在下文中一共展示了Assert::nullOrStringNotEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates a new return value.
*
* @param string $value The value as source code.
* @param string $type The type shown in the doc block.
* @param string $description The doc block description.
*/
public function __construct($value, $type = 'mixed', $description = null)
{
Assert::stringNotEmpty($value, 'The return value must be a non-empty string. Got: %s');
Assert::stringNotEmpty($type, 'The return value type must be a non-empty string. Got: %s');
Assert::nullOrStringNotEmpty($description, 'The return value description must be a non-empty string or null. Got: %s');
$this->value = $value;
$this->type = $type;
$this->description = $description;
}
示例2: __construct
/**
* Creates the violation.
*
* @param int $code The violation code. One of the constants
* defined in this class.
* @param mixed $invalidValue The value that caused this violation.
* @param string $installerName The name of the validated installer.
* @param string|null $parameterName The name of the validated installer
* parameter or `null` if this is a generic
* error.
*/
public function __construct($code, $invalidValue, $installerName, $parameterName = null)
{
Assert::oneOf($code, self::$codes, 'The violation code %s is not valid.');
Assert::stringNotEmpty($installerName, 'The installer name must be a non-empty string. Got: %s');
Assert::nullOrStringNotEmpty($parameterName, 'The parameter name must be a non-empty string or null. Got: %s');
$this->code = $code;
$this->installerName = $installerName;
$this->parameterName = $parameterName;
$this->invalidValue = $invalidValue;
}
示例3: hasBindings
/**
* {@inheritdoc}
*/
public function hasBindings($typeName = null, Expression $expr = null)
{
Assert::nullOrStringNotEmpty($typeName, 'The type class must be a non-empty string. Got: %s');
if (null !== $typeName) {
if (null !== $expr) {
return $this->hasBindingsWithTypeNameThatMatch($typeName, $expr);
}
return $this->hasBindingsWithTypeName($typeName);
}
if (null !== $expr) {
return $this->hasBindingsThatMatch($expr);
}
return $this->hasAnyBinding();
}
示例4: __construct
public function __construct($version = null, Description $description = null)
{
Assert::nullOrStringNotEmpty($version);
$this->version = $version;
$this->description = $description;
}