Hello... Is anyone thinking about it ?
"Cristiano Duarte" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > What a work in Zend2 !!! It is getting great, but about object constants in > class definition? > I need to do something like this: > > class EnumException extends Exception{ } > final class Car { > //private > const _ferrari = 0; > const _porsche = 1; > const _corvette = 2; > > //private > const _last_value = 2; > > //public > const ferrari = new Car(_ferrari); > const porsche = new Car(_porsche); > const corvette = new Car(_corvette); > > private $value; > > protected function __construct($value) { > if (($value < 0) || ($value > _last_value)) { > throw new EnumException(); > } > $this->value = $value; > } > public function value() { > return $this->value; > } > } > > Everything works fine, except the final keyword for the class and the const > initialization with an object. > > I think final classes would be a good approach in assuring that a class will > not be modified(inherited). > > Why canīt objects be assigned to constants ? Is there another way of doing > this in Zend2 ? > > Thanx, > > Cristiano Duarte > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php