note 76232 deleted from language.oop5 by colder

From: Date: Sun, 19 Aug 2007 23:38:09 +0000
Subject: note 76232 deleted from language.oop5 by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-129603@lists.php.net to get a copy of this message
Note Submitter: blog at geimanen dot com ---- 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

« previous php.notes (#129603) next »