Oihana PHP Arango

assertDocuments.php

Table of Contents

Functions

assertDocuments()  : void
Ensures that a given value is an instance of {@see Documents}.

Functions

assertDocuments()

Ensures that a given value is an instance of {@see Documents}.

assertDocuments(mixed $value) : void

This runtime assertion validates type safety for Documents. If the provided value is not an instance of Documents, an UnexpectedValueException is thrown with a descriptive message.

This is especially useful when handling dynamically typed data or container-resolved dependencies, where you want to enforce strict model integrity.

Parameters
$value : mixed

The value to assert as an Documents instance.

Tags
throws
UnexpectedValueException

If the provided value is not an instance of Documents.

example
use oihana\arango\models\helpers\assertDocuments;
use oihana\arango\models\Documents;

$documents = new Documents();

// ✅ Valid: no exception thrown
assertDocuments( $documents );

// ❌ Invalid: throws UnexpectedValueException
assertDocuments( 'not an edges instance' );
// → UnexpectedValueException: The value property must be an instance of Documents (arango).
author

Marc Alcaraz (eKameleon)

version
1.0.0
On this page

Search results