Stellar PHP SDK API Documentation

NativeUnionVal

Container for contract union variant values

This class represents a union variant value for Soroban smart contracts. Unions in Soroban allow for variant types where one of multiple possible cases is active. Each union has a tag (case name) and optional associated values for that case.

Used by ContractSpec::nativeToXdrSCVal() when converting native PHP values to XDR for user-defined union types.

Tags
see
ContractSpec::nativeToXdrSCVal()

For type conversion usage

see
ContractSpec::nativeToUnion()

For union-specific conversion

since
1.0.0

Table of Contents

Properties

$tag  : string
$values  : array<string|int, mixed>|null

Methods

__construct()  : mixed

Properties

Methods

__construct()

public __construct(string $tag[, array<string|int, mixed>|null $values = null ]) : mixed
Parameters
$tag : string

The name of the union case/variant to use.

$values : array<string|int, mixed>|null = null

The values associated with this union case. Null for void cases, array of values for tuple cases. The array must match the expected types defined in the contract spec for this union case.


        
On this page

Search results