DSL References
DSL stands for Domain Specific Language. In Flow, the DSL is a set of small functions that wrap object construction so pipelines read top-to-bottom. See the examples for usage in context.
TYPE
/**
* @return ArrayType<array<mixed>>
*/
type_array() : ArrayType /**
* @return BooleanType<bool>
*/
type_boolean() : BooleanType /**
* @return CallableType<callable>
*/
type_callable() : CallableType /**
* @template T of object
*
* @param null|class-string<T> $class
*
* @return ($class is null ? ClassStringType<class-string> : ClassStringType<class-string<T>>)
*/
type_class_string(?string $class) : ClassStringType /**
* @return DateType<\DateTimeInterface>
*/
type_date() : DateType /**
* @return DateTimeType<\DateTimeInterface>
*/
type_datetime() : DateTimeType /**
* @return EmptyArrayType<array{}>
*/
type_empty_array() : EmptyArrayType /**
* @template T of UnitEnum
*
* @param class-string<T> $class
*
* @return EnumType<T>
*/
type_enum(string $class) : EnumType /**
* @return FloatType<float>
*/
type_float() : FloatType /**
* @return HTMLType<HTMLDocument>
*/
type_html() : HTMLType /**
* @return HTMLElementType<HTMLElement>
*/
type_html_element() : HTMLElementType /**
* @template T of object
*
* @param class-string<T> $class
*
* @return InstanceOfType<T>
*/
type_instance_of(string $class) : InstanceOfType /**
* @return IntegerType<int>
*/
type_integer() : IntegerType /**
* @template T
*
* @param Type<T> $first
* @param Type<T> $second
* @param Type<T> ...$types
*
* @return IntersectionType<T, T>
*/
type_intersection(Type $first, Type $second, Type $types) : IntersectionType /**
* @return JsonType<Json>
*/
type_json() : JsonType /**
* @template T
*
* @param Type<T> $element
*
* @return ListType<list<T>>
*/
type_list(Type $element) : ListType /**
* @template T of bool|float|int|string
*
* @param T $value
*
* @return LiteralType<T>
*/
type_literal(string|int|float|bool $value) : LiteralType /**
* @template TKey of array-key
* @template TValue
*
* @param Type<TKey> $key_type
* @param Type<TValue> $value_type
*
* @return MapType<array<TKey, TValue>>
*/
type_map(Type $key_type, Type $value_type) : MapType /**
* @return MixedType<mixed>
*/
type_mixed() : MixedType /**
* @return NonEmptyStringType<non-empty-string>
*/
type_non_empty_string() : NonEmptyStringType /**
* @return NullType<null>
*/
type_null() : NullType /**
* @return NumericStringType<numeric-string>
*/
type_numeric_string() : NumericStringType /**
* @return ObjectType<object>
*/
type_object() : ObjectType /**
* @template T
*
* @param Type<T> $type
*
* @return OptionalType<T>
*/
type_optional(Type $type) : OptionalType /**
* @return PositiveIntegerType<int<0, max>>
*/
type_positive_integer() : PositiveIntegerType /**
* @return ResourceType<resource>
*/
type_resource() : ResourceType /**
* @return ScalarType<bool|float|int|string>
*/
type_scalar() : ScalarType /**
* @return StringType<string>
*/
type_string() : StringType /**
* @template T
*
* @param array<array-key, StructureElement<T>|Type<T>> $elements
*
* @return StructureType<array<array-key, T>>
*/
type_structure(array $elements, bool $allow_extra) : StructureType /**
* @return TimeType<\DateInterval>
*/
type_time() : TimeType /**
* @return TimeZoneType<\DateTimeZone>
*/
type_time_zone() : TimeZoneType /**
* @template T
*
* @param Type<T> $first
* @param Type<T> $second
* @param Type<T> ...$types
*
* @return UnionType<T, T>
*/
type_union(Type $first, Type $second, Type $types) : UnionType /**
* @return UuidType<Uuid>
*/
type_uuid() : UuidType /**
* @return XMLType<\DOMDocument|XMLDocument>
*/
type_xml() : XMLType /**
* @return XMLElementType<\DOMElement|Element>
*/
type_xml_element() : XMLElementType HELPER
dom_element_to_string(DOMElement $element, bool $format_output, bool $preserver_white_space) : string|false /**
* @return Type<mixed>
*/
get_type(?mixed $value) : Type /**
* @template T
* @template TOptional of bool
*
* @param Type<T> $type
* @param TOptional $optional
*
* @return StructureElement<T, TOptional>
*/
structure_element(string|int $name, Type $type, bool $optional) : StructureElement /**
* @template T
*
* @param Type<T> ...$types
*
* @return Types<T>
*/
types(Type $types) : Types /**
* Strip exactly one level of nullability, whichever of the two spellings carries it
* (OptionalType, or a UnionType containing NullType). Total: a NOT NULL type is returned unchanged.
*
* @template T
*
* @param Type<T> $type
*
* @return Type<mixed>
*/
type_bare(Type $type) : Type /**
* @param Type<mixed> $left
* @param Type<mixed> $right
*/
type_equals(Type $left, Type $right) : bool /**
* @param array<string, mixed> $data
*
* @return Type<mixed>
*/
type_from_array(array $data) : Type /**
* @template T
*
* @param Type<T> $type
* @param class-string<Type<mixed>> $typeClass
*/
type_is(Type $type, string $typeClass) : bool /**
* @template T
*
* @param Type<T> $type
* @param class-string<Type<mixed>> $typeClass
* @param class-string<Type<mixed>> ...$typeClasses
*/
type_is_any(Type $type, string $typeClass, string $typeClasses) : bool /**
* @template T
*
* @param Type<T> $type
*/
type_is_nullable(Type $type) : bool