Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114495 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 87453 invoked from network); 17 May 2021 14:07:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 May 2021 14:07:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 33D8D180545 for ; Mon, 17 May 2021 07:16:43 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 17 May 2021 07:16:42 -0700 (PDT) Received: by mail-io1-f43.google.com with SMTP id d11so5947093iod.5 for ; Mon, 17 May 2021 07:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u9UgjiXwrkLyX4WaqzeV/yhZnfVTkW0EzzLbpg1t8T4=; b=VZidnuIutnySsk3dTYt6G9MI4yI6NhZM+6U/0nYOCvzKB7AK5WAPp6AT5wisUVb94Y nMo9vAVeqRQCv7eJfcHsrPKhebRzogb3jA3oA2bgFzcHOyJtICzszzRL8Ejy4tJwyBCy q9vHr8rt53TpPyrbhX9+fS5dfs9Z34ZufXcXTRhnCNwfYGPTXvpuXzELtTkLllcJl3nj 2yiPhy/FrPt3nqa0b2bdo17vKJWLw5BFHYvvLOvSAoFyoXfmbHH99YYHE/BYS25IlPs6 hJRzeEt6ya8V5qaT3Fr7z22Bs7z2y0CAzdi9P6g2y9YKimMcgXt1+/4Yw5awbG5vPSns d9eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u9UgjiXwrkLyX4WaqzeV/yhZnfVTkW0EzzLbpg1t8T4=; b=tQyye6Lkg1f8dj1CtD1v/GthGJxJ41yG1oUEpXKyjSkB+MMtIli24C3CLAM3H4QzQz FiRVkq2Aflsq77aW/saEZYYxr+Rrb2S5DMBGAiRRICcm3z+3U2vmPxRY4nF23e8/9S4+ JA2NHU1X4jT6tb/qWfURR8zSpJo7wkcxIVv/txdsMe9PDaTucpxJerO/I2vGg5AIR7Vf fFlYzDxPUFSPLRgEKVpW5WuO0POxiD6NpyvgZbPAag4plRf+AvxMGFCzH2yis2Q5fjRu N901YkOt+dMbChWcW9Anlwo1bUWQTV7xgyxdLy8s4Y9dikjQ5Xx39cWGfrxbSFTL2pDQ xb7g== X-Gm-Message-State: AOAM531UYfVg0F1vec8PEy9XNWRoUc1DorBDjx3KyfFLIFtSKQojoadO 3cYtQU0/7eijBdJXdBbxJ9U/iP6R9xT6T38ixVI= X-Google-Smtp-Source: ABdhPJw+ilsT5XkP7jUpw8KiS0sG76NgSlEb7Zao1AZ8SYSaNvY1eh1xNsMxuV1BScAH5H5+PUys1ry1qctCYTFH8jI= X-Received: by 2002:a05:6638:388e:: with SMTP id b14mr210858jav.73.1621261001272; Mon, 17 May 2021 07:16:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 17 May 2021 16:16:27 +0200 Message-ID: To: tyson andre Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000011b56805c2873e7d" Subject: Re: [PHP-DEV] [RFC]: Allow static properties in enums From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000011b56805c2873e7d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable pon., 17 maj 2021, 16:02 u=C5=BCytkownik tyson andre napisa=C5=82: > Hi internals, > > I've created a new RFC > https://wiki.php.net/rfc/enum_allow_static_properties > > Although enums are immutable objects, it is often useful to have function= s > or methods that operate on enum instances. > In many cases, it would make sense to declare that functionality as stati= c > methods on the enum itself. > In cases where static methods require shared state, it would be useful to > allow storing those shared state in static properties. > To ensure immutability of enum instances, it's only necessary to forbid > instance properties, but all properties were forbidden in the initial > functionality included with the enums RFC. > > This RFC proposes allowing static properties in enums, while continuing t= o > forbid instance properties. > Would you be able to provide more real life example? The example in RFC could easily encapsulate current Environment reading in for eg. EnvironmentConfiguration class with static property and method and TBH possibly that would be my preference to solve this. Cheers, Micha=C5=82 Marcin Brzuchalski > --00000000000011b56805c2873e7d--