Oihana PHP Arango

assertEdges.php

Table of Contents

Functions

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

Functions

assertEdges()

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

assertEdges(mixed $value) : void

This helper function acts as a runtime assertion to validate type safety. If the provided value is not an instance of Edges, 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 Edges instance.

Tags
throws
UnexpectedValueException

If the provided value is not an instance of Edges.

example
use oihana\arango\models\helpers\assertEdges;
use oihana\arango\models\Edges;

$edges = new Edges();

// ✅ Valid: no exception thrown
assertEdges( $edges );

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

Marc Alcaraz (eKameleon)

version
1.0.0
On this page

Search results