Skip to content

Remove Type::some() — an identity function masquerading as a type constructor #93

Description

@MidnightDesign

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bc-breakIntroduces a backwards compatibility break and should be tagged with a new major versionenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions