Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
 /**
  * {@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();
 }
Exemplo n.º 4
0
 public function __construct($version = null, Description $description = null)
 {
     Assert::nullOrStringNotEmpty($version);
     $this->version = $version;
     $this->description = $description;
 }