Assert\Assertion::isObject PHP Method

isObject() public static method

Determines that the provided value is an object.
public static isObject ( mixed $value, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$message null
$propertyPath null
return boolean
    public static function isObject($value, $message = null, $propertyPath = null)
    {
        if (!is_object($value)) {
            $message = sprintf($message ?: 'Provided "%s" is not a valid object.', static::stringify($value));
            throw static::createException($value, $message, static::INVALID_OBJECT, $propertyPath);
        }
        return true;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param AggregateType $aggregateType
  * @param string $aggregateId
  * @param object $aggregateRoot
  * @param int $lastVersion
  * @param DateTimeImmutable $createdAt
  */
 public function __construct(AggregateType $aggregateType, $aggregateId, $aggregateRoot, $lastVersion, DateTimeImmutable $createdAt)
 {
     Assertion::minLength($aggregateId, 1);
     Assertion::isObject($aggregateRoot);
     Assertion::min($lastVersion, 1);
     $this->aggregateType = $aggregateType;
     $this->aggregateId = $aggregateId;
     $this->aggregateRoot = $aggregateRoot;
     $this->lastVersion = $lastVersion;
     $this->createdAt = $createdAt;
 }
All Usage Examples Of Assert\Assertion::isObject