Hey Saki,

On Sat, 23 May 2026 at 14:51, Saki Takamachi <[email protected]> wrote:

> I am in favor of introducing such a static method. It would probably look
> something like this:
>
> ```
> // $scale is optional
> $num = BcMath\Number::createFrom($val, $scale);
> ```


I'm overall very much in favor of static factory methods: they are a clear
and established way of doing this in the ecosystem at large, with no
particular drawbacks, and better future BC boundaries.

Important though: `::createFrom()` is probably a bad name, and
`::fromValueAndScale()` or such would allow clearer/future expansion via
other constructors.

Marco Pivetta

https://mastodon.social/@ocramius

https://ocramius.github.io/

Reply via email to