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 ? Type<class-string> : Type<class-string<T>>)
 */
type_class_string(?string $class) : Type
/**
 * @template T of UnitEnum
 *
 * @param class-string<T> $class
 *
 * @return Type<T>
 */
type_enum(string $class) : Type
/**
 * @template T of object
 *
 * @param class-string<T> $class
 *
 * @return Type<T>
 */
type_instance_of(string $class) : Type
/**
 * @template T
 *
 * @param Type<T> $first
 * @param Type<T> $second
 * @param Type<T> ...$types
 *
 * @return Type<T>
 */
type_intersection(Type $first, Type $second, Type $types) : Type
/**
 * @template T
 *
 * @param Type<T> $element
 *
 * @return Type<list<T>>
 */
type_list(Type $element) : Type
/**
 * @template T of bool|float|int|string
 *
 * @param T $value
 *
 * @return Type<T>
 */
type_literal(string|int|float|bool $value) : Type
/**
 * @template TKey of array-key
 * @template TValue
 *
 * @param Type<TKey> $key_type
 * @param Type<TValue> $value_type
 *
 * @return Type<array<TKey, TValue>>
 */
type_map(Type $key_type, Type $value_type) : Type
/**
 * @template T
 *
 * @param Type<T> $type
 *
 * @return Type<T>
 */
type_optional(Type $type) : Type
/**
 * @param array<string, Type<mixed>> $elements
 * @param array<string, Type<mixed>> $optional_elements
 *
 * @return Type<array<string, mixed>>
 */
type_structure(array $elements, array $optional_elements, bool $allow_extra) : Type
/**
 * @template T
 *
 * @param Type<T> $first
 * @param Type<T> $second
 * @param Type<T> ...$types
 *
 * @return Type<T>
 */
type_union(Type $first, Type $second, Type $types) : Type

HELPER

/**
 * @template T
 *
 * @param Type<T> ...$types
 *
 * @return Types<T>
 */
types(Type $types) : Types
/**
 * @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