note 126826 added to class.backedenum

From: Date: Fri, 04 Feb 2022 09:57:38 +0000
Subject: note 126826 added to class.backedenum
Groups: php.notes 
Request: Send a blank email to php-notes+get-217579@lists.php.net to get a copy of this message
As of PHP 8.1, while UnitEnum & BackedEnum cannot be implemented by user-defined classes, it seems they can be extended by user-defined interfaces and eventually be implemented by enums. <?php interface TestEnumInterface extends \BackedEnum { public function foo(): string; } enum TestEnum: string implements TestEnumInterface { case CASE_1 = 'case 1'; case CASE_2 = 'case 2'; public function foo(): string { return 'bar'; } } ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.135 (proxied: 82.128.232.15) ---- Manual Page -- https://php.net/manual/en/class.backedenum.php Edit -- https://main.php.net/note/edit/126826 Del: integrated -- https://main.php.net/note/delete/126826/integrated Del: useless -- https://main.php.net/note/delete/126826/useless Del: bad code -- https://main.php.net/note/delete/126826/bad+code Del: spam -- https://main.php.net/note/delete/126826/spam Del: non-english -- https://main.php.net/note/delete/126826/non-english Del: in docs -- https://main.php.net/note/delete/126826/in+docs Del: other reasons-- https://main.php.net/note/delete/126826 Reject -- https://main.php.net/note/reject/126826 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217579) next »