|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-29 20:13 UTC] cunha17 at uol dot com dot br
[2003-07-30 13:20 UTC] helly@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 06:00:01 2025 UTC |
What a work in Zend2 !!! It is getting great, but what about final classes and 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 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