typhoon/type
Typhoon Type provides an object abstraction over PHP’s modern type system for building tools that understand complex types. Define, print (stringify), and work with array shapes, object types, non-empty lists, and more in a consistent API.
T in Typhoon\Type invariant.In this release, we refocus the library: typhoon/type now contains only the types necessary for building
runtime tools like is() or HMap. Complex types requiring reflection and/or additional context have been removed
and will be later implemented in typhoon/algebra.
WeakVisitor.Mask::match() to test().float in FloatValueT and FloatRangeT.IntRangeT.K, V templates in ArrayT.$templates from CallableT and ClosureT.Parameter::__construct() signature.Reduce a trait.ObjectBareT to ObjectT.intersectionT, return IntersectionT.unionT, return UnionT.bitmaskT.WeakReference<Visitor> in Stringify — use WeakVisitor instead.namedObjectT() to objectT().Mask instance to constantMaskT() and classConstantMaskT().Mask::toString(), use Mask::$mask instead.fromReflection() function, will be later implemented in a separate package.Template and Variance, will be later implemented in algebra.Alias and corresponding visitor methods, will be later implemented in algebra.IsSubtype and corresponding visitor methods, will be later implemented in algebra.KeyOf and corresponding visitor methods, will be later implemented in algebra.LiteralString and corresponding visitor methods, will be later implemented in algebra.ObjectT and corresponding visitor methods, will be later implemented in algebra.Offset and corresponding visitor methods, will be later implemented in algebra.ParentBare and corresponding visitor methods, will be later implemented in algebra.SelfBare and corresponding visitor methods, will be later implemented in algebra.Self and corresponding visitor methods, will be later implemented in algebra.StaticBare and corresponding visitor methods, will be later implemented in algebra.Static and corresponding visitor methods, will be later implemented in algebra.Template and corresponding visitor methods, will be later implemented in algebra.Ternary and corresponding visitor methods, will be later implemented in algebra.Untyped and corresponding visitor methods, will be later implemented in algebra.ValueOf and corresponding visitor methods, will be later implemented in algebra.andT() and orT()..0 to stringified floats with zero scale.mixed type.untyped type (ADR).fromReflection(?ReflectionType): Type function.BigDecimal for floats (ADR).Typhoon\Type\Type interface to Typhoon\Type (#51).PHP_INT_MIN, PHP_INT_MAX for IntRangeT limits instead of null.*DefaultT to *BareT, Visitor::*DefaultT() to Visitor::*BearT() (#56).Reduced::callableBareT() to Fallback::callableBareT() (ADR).Stringify final and allow composition via a Visitor<non-empty-string> parameter (#54).Template::new(), Template::factory() constructors, make primary private.Reduced::visit() and visitMultiple() — let developer implement them.of() for now — it cannot infer types correctly anyway.The library was rewritten from scratch with a new philosophy in mind:
types constants to global constants: types::int -> intT.types methods to functions: types::intRange() -> intRangeT().Type classes public.TypeVisitor to Visitor, pass types as objects without destructuring.TypeStringifier to Stringify, make it abstract.DefaultTypeVisitor to Fallback.Reduced visitor that expresses some types via the others, reducing the number of Visitor methods to implement.Parameter::with().ShapeElement::with().ShapeElement::__construct($type) optional with types::mixed as a default value.types::value() factory that creates a Type from an arbitrary value.types::scalar() in favor of value().$type parameter PHPDoc types in TypeVisitor.Type<int> in types::intMask() due to possibly overflowing bitmasks.How can I help you explore Laravel packages today?