Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-15 Thread Larry Garfield
On Fri, Jan 15, 2021, at 9:55 AM, Pierre R. wrote: > Le 10/01/2021 à 22:27, Larry Garfield a écrit : > > This is a little tangent from the Enums RFC, but I want to flag it because > > it it's the sort of in-passing decision that could have far-reaching > > implications, so shouldn't be done impli

Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-15 Thread Pierre R.
Le 10/01/2021 à 22:27, Larry Garfield a écrit : This is a little tangent from the Enums RFC, but I want to flag it because it it's the sort of in-passing decision that could have far-reaching implications, so shouldn't be done implicitly. At the moment, the Enum RFC for scalar enums includes t

Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-14 Thread Dan Ackroyd
On Sun, 10 Jan 2021 at 21:28, Larry Garfield wrote: > > > making a valueOrDefault() method unnecessary. > > $order = SortOrder::tryFrom($input) ?? SortOrder::Asc; > tbh, I would prefer a valueOrDefault() method, partly because it's what I'm used to in my own code* but also I think it would be ea

Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-12 Thread Larry Garfield
On Tue, Jan 12, 2021, at 10:13 AM, Ben Ramsey wrote: > > On Jan 11, 2021, at 19:09, Mike Schinkel wrote: > > > >> On Jan 11, 2021, at 6:52 PM, Larry Garfield wrote: > >> > >> On Mon, Jan 11, 2021, at 2:27 PM, Ben Ramsey wrote: > On Jan 10, 2021, at 20:09, Larry Garfield wrote: > > >

Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-12 Thread Ben Ramsey
> On Jan 11, 2021, at 19:09, Mike Schinkel wrote: > >> On Jan 11, 2021, at 6:52 PM, Larry Garfield wrote: >> >> On Mon, Jan 11, 2021, at 2:27 PM, Ben Ramsey wrote: On Jan 10, 2021, at 20:09, Larry Garfield wrote: On Sun, Jan 10, 2021, at 4:40 PM, Mark Randall wrote: > On 10

Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-11 Thread Mike Schinkel
> On Jan 11, 2021, at 6:52 PM, Larry Garfield wrote: > > On Mon, Jan 11, 2021, at 2:27 PM, Ben Ramsey wrote: >>> On Jan 10, 2021, at 20:09, Larry Garfield wrote: >>> >>> On Sun, Jan 10, 2021, at 4:40 PM, Mark Randall wrote: On 10/01/2021 21:27, Larry Garfield wrote: > The "a method t

Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-11 Thread Larry Garfield
On Mon, Jan 11, 2021, at 2:27 PM, Ben Ramsey wrote: > > On Jan 10, 2021, at 20:09, Larry Garfield wrote: > > > > On Sun, Jan 10, 2021, at 4:40 PM, Mark Randall wrote: > >> On 10/01/2021 21:27, Larry Garfield wrote: > >>> The "a method that begins with try is nullable, so watch out" idiom is > >>

Re: [PHP-DEV] "TryX" idom for Enumerations

2021-01-11 Thread Ben Ramsey
> On Jan 10, 2021, at 20:09, Larry Garfield wrote: > > On Sun, Jan 10, 2021, at 4:40 PM, Mark Randall wrote: >> On 10/01/2021 21:27, Larry Garfield wrote: >>> The "a method that begins with try is nullable, so watch out" idiom is >>> present in C# and Rust, but to my knowledge has never existed

[PHP-DEV] "TryX" idom for Enumerations

2021-01-10 Thread Larry Garfield
This is a little tangent from the Enums RFC, but I want to flag it because it it's the sort of in-passing decision that could have far-reaching implications, so shouldn't be done implicitly. At the moment, the Enum RFC for scalar enums includes two methods: public function has(string $name): bo