Skip to content

v1.3.0 - Union Types Support

Latest
Compare
Choose a tag to compare
@WendellAdriel WendellAdriel released this 23 Jun 13:21
· 2 commits to main since this release

What's Changed

Full Changelog: v1.2.0...v1.3.0

Extended Docs

use Strictus\Enums\Type;

$unionTypesVariable = Strictus::union([Type::INT, Type::STRING], 'foo');

echo $unionTypesVariable->value; //foo

echo $unionTypesVariable(); //foo

// Update variable

$unionTypesVariable->value = 100;

echo $unionTypesVariable->value; //100

// Thrown an exception if the value is wrong union types

$unionTypesVariable->value = false; //StrictusTypeException