Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112672 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81060 invoked from network); 30 Dec 2020 18:56:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Dec 2020 18:56:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D0FDA1804E3 for ; Wed, 30 Dec 2020 10:30:55 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mx.kolabnow.com (mx.kolabnow.com [95.128.36.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 30 Dec 2020 10:30:54 -0800 (PST) Received: from localhost (unknown [127.0.0.1]) by ext-mx-out001.mykolab.com (Postfix) with ESMTP id 0C7C4AD9 for ; Wed, 30 Dec 2020 19:30:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:date:date:message-id:from :from:references:subject:subject:received:received:received; s= dkim20160331; t=1609353051; x=1611167452; bh=UqdPHRvt1v14R3wB0aR XIZMhZAoDjk1OpVQOyHAKIts=; b=RsCddTkA3VzbeMbBx/xmLph3f58hzSRZYSn xbVJScM9r9KOYokAOsR5AkPEhy4TYLZxer7WNlM8Q5wlpzRcibgoDkqX9gpFgJIO 8QPK91eNEepx3Iu/ibgquQK1jUpl3GCd9BbGpH2N62uKVrpj0u44QQWOtOQrk1VK 7K1X0sUX0KA9kAEr8mOBNYn82OYxdEcr57oyT5zDD+ihY6wsScypsNzuGYdddV/a vVc35VtSh9QJwyyZOd+Soc9AppgyhuYJiuGqG6T7RYG1n+2xAGq8uZXlPysaEKjY wiB3ulV64+CRl/nQeh3fDiIqU+kwB73+e+xm81XANMbn8CStMFmas/1dTW+c4YSl 6/J1voaLMZjOp1Fxd1J+72xtHS45/l86FIeajnhm3CnDULO55zM2n+77+7u+vufg /ZvYe7LN+jQYbR4EzwUYa0AZZovhiaAJgOrIPfyDUhxoPbWZAX0clsY33f3gAvjK mY+xrj3JYzYIxEi5mT9PjEgp7Ty5xn0nblIrx/CYLNNsiRLpIdlx4LVP43lpgCXY RMirNoUPQiGsOQu0yhX3TQtQxC+FJWT8EX5jsUj/d+hYh7cd8Nv3WYXi6hPefb1+ ATzIymZtjVMYTBHiT3KNtJPZeJCl4kph7SdPBjOAsM4Rj1YA7W/oL9zxvBXAsBwK NrPDVvxM= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32kIptTXB-AE for ; Wed, 30 Dec 2020 19:30:51 +0100 (CET) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by ext-mx-out001.mykolab.com (Postfix) with ESMTPS id 3D07470A for ; Wed, 30 Dec 2020 19:30:50 +0100 (CET) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx001.mykolab.com (Postfix) with ESMTPS id DA0787AC for ; Wed, 30 Dec 2020 19:30:50 +0100 (CET) To: internals@lists.php.net References: Message-ID: <8aa05350-05fc-df9d-e5d6-fa0f4feb57ba@alec.pl> Date: Wed, 30 Dec 2020 19:30:48 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Enumerations, Round 2 From: alec@alec.pl (Aleksander Machniak) On 28.12.2020 21:21, Larry Garfield wrote: > https://wiki.php.net/rfc/enumerations Why can't this be simplified to: enum Size { case Small; case Medium; case Large; } 'Small' === Size::Small->value; // true Size::from('Small') === Size::Small; // true enum Suit { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; } 'H' === Suit::Hearts->value; // true 'Hearts' === Suit::Hearts->value; // false Also, how about using a method instead of property for ->value? -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com