Re: [RFC] Enumerations, Round 2

From: Date: Wed, 30 Dec 2020 15:48:49 +0000
Subject: Re: [RFC] Enumerations, Round 2
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-112664@lists.php.net to get a copy of this message
> > What's the quickest way (=less code) to have an enum represent it's > lexical name as the literal values? > > So that … case Foo; case Bar; … results in > ::Foo->value === 'Foo' etc.? > > Is this possible without implementing this manually for all cases? > > AFAICS, you'd need to implement the values manually. The $value property is only defined on ScalarEnum, not UnitEnum. - Benjamin

« previous php.internals (#112664) next »