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
type_array() : ArrayType type_boolean() : BooleanType 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 type_date() : DateType type_datetime(DateTimeZone|string $zone) : DateTimeType type_empty_array() : EmptyArrayType /**
* @template T of UnitEnum
*
* @param class-string<T> $class
*
* @return EnumType<T>
*/
type_enum(string $class) : EnumType type_float() : FloatType type_html() : HTMLType type_html_element() : HTMLElementType /**
* @template T of object
*
* @param class-string<T> $class
*
* @return InstanceOfType<T>
*/
type_instance_of(string $class) : InstanceOfType 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 type_json() : JsonType /**
* @template T
*
* @param Type<T> $element
*
* @return ListType<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<TKey, TValue>
*/
type_map(Type $key_type, Type $value_type) : MapType type_mixed() : MixedType type_non_empty_string() : NonEmptyStringType type_null() : NullType type_numeric_string() : NumericStringType type_object() : ObjectType /**
* @template T
*
* @param Type<T> $type
*
* @return OptionalType<T>
*/
type_optional(Type $type) : OptionalType type_positive_integer() : PositiveIntegerType type_resource() : ResourceType type_scalar() : ScalarType type_string() : StringType /**
* @template T
*
* @param array<array-key, StructureElement<T, bool>|Type<T>> $elements
*
* @return StructureType<array<array-key, T>>
*/
type_structure(array $elements) : StructureType type_time() : TimeType 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 type_uuid() : UuidType type_xml() : XMLType 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