Scoped for the 0.3.0 breaking release.
Problem
Type::some() is a public static factory that returns its argument unchanged:
public static function some(self $some): self
{
return $some;
}
Sitting next to option() (a real Option<T> wrapper) and none() (a real None type), some() reads as "the Some branch of an Option" but constructs no Some type at all — there is a TypeConstructor::Some case (arity 1) that this factory does not build. It is a silent footgun: Type::some(Type::int()) is exactly Type::int(), so e.g. x.isSubtypeOf(Type::some(...)) behaves nothing like it reads. Some appears nowhere in the README's user-facing type list.
Proposed change
Remove Type::some() from the public surface. (If a genuine need for a Some constructor surfaces later, add one that actually builds the Some constructor and documents how it differs from option().)
BC impact
Structural break (public method removal). Cheap now, a major-version affair after 1.0.0.
Scoped for the 0.3.0 breaking release.
Problem
Type::some()is a public static factory that returns its argument unchanged:Sitting next to
option()(a realOption<T>wrapper) andnone()(a realNonetype),some()reads as "the Some branch of an Option" but constructs noSometype at all — there is aTypeConstructor::Somecase (arity 1) that this factory does not build. It is a silent footgun:Type::some(Type::int())is exactlyType::int(), so e.g.x.isSubtypeOf(Type::some(...))behaves nothing like it reads.Someappears nowhere in the README's user-facing type list.Proposed change
Remove
Type::some()from the public surface. (If a genuine need for aSomeconstructor surfaces later, add one that actually builds theSomeconstructor and documents how it differs fromoption().)BC impact
Structural break (public method removal). Cheap now, a major-version affair after 1.0.0.