Skip to content
Search

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

/**
 * @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
/**
 * @template T of UnitEnum
 *
 * @param class-string<T> $class
 *
 * @return EnumType<T>
 */
type_enum(string $class) : EnumType
/**
 * @template T of object
 *
 * @param class-string<T> $class
 *
 * @return InstanceOfType<T>
 */
type_instance_of(string $class) : InstanceOfType
/**
 * @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
/**
 * @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
/**
 * @template T
 *
 * @param Type<T> $type
 *
 * @return OptionalType<T>
 */
type_optional(Type $type) : OptionalType
/**
 * @return ScalarType<bool|float|int|string>
 */
type_scalar() : ScalarType
/**
 * @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
/**
 * @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 XMLType<\DOMDocument|XMLDocument>
 */
type_xml() : XMLType

HELPER

/**
 * @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
Contributors

Built in the open.

Join us on GitHub
scroll back to top