note 76232 added to language.oop5

From: Date: Fri, 06 Jul 2007 11:40:33 +0000
Subject: note 76232 added to language.oop5
Groups: php.notes 
Request: Send a blank email to php-notes+get-128265@lists.php.net to get a copy of this message
The best way to make Enum with typecheck support (Im using VS.PHP) is following: final class WeekDayType extends EnumType { public static function None() { return self::Init(__CLASS__,__FUNCTION__); } public static function Monday() { return self::Init(__CLASS__,__FUNCTION__); } public static function Tuesday() { return self::Init(__CLASS__,__FUNCTION__); } public static function Wednesday() { return self::Init(__CLASS__,__FUNCTION__); } public static function Thirsday() { return self::Init(__CLASS__,__FUNCTION__); } public static function Friday() { return self::Init(__CLASS__,__FUNCTION__); } public static function Saturday() { return self::Init(__CLASS__,__FUNCTION__); } //__FUNCTION__ could be actually replaced with any name you want. public static function Sunday() { return self::Init(__CLASS__,"SunnyDay"); } } the EnumType class could be found here: http://blog.geimanen.com/?p=3#more-3 ---- Server IP: 212.47.220.13 Probable Submitter: 194.126.102.98 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.php Edit -- https://master.php.net/note/edit/76232 Del: integrated -- https://master.php.net/note/delete/76232/integrated Del: useless -- https://master.php.net/note/delete/76232/useless Del: bad code -- https://master.php.net/note/delete/76232/bad+code Del: spam -- https://master.php.net/note/delete/76232/spam Del: non-english -- https://master.php.net/note/delete/76232/non-english Del: in docs -- https://master.php.net/note/delete/76232/in+docs Del: other reasons-- https://master.php.net/note/delete/76232 Reject -- https://master.php.net/note/reject/76232 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128265) next »