Jarrod Nettles wrote:
So, my proposed syntax would look something more like this.
I think also and was wondering about the current rfc for a few weeks.
Im not a core developer but I want to outline what i would expect as
php framework developer.
namespace System\Logs
{
enum Levels{
DEBUG,
INFO,
WARNING,
ERROR
};
}
Yes, after that I would expect a new type "Levels"
and the possibility to do something like this:
$log = new Levels;
$log = WARNING;
or
$log = new Levels(WARNING);
Like the current rfc i think, therefore we need the corresponding
constants to be defined by defining the Levels type.
Furthermore we should have the appropriate type hints for
function/method calls.
Assuming, we have a method like this
public function setLogLevel (Levels $logLevel)
{
$this->logLevel = $logLevel;
}
i would like to call them by delivering $log as a parameter
$someLogginObject->setLogLevel($log)
and get an error in the case the type of $log is not Levels.
What do you think about a viable approach to
implement a enum language structure.
The current rfc seams not very useful for me.
Thanks!
Thomas Gutbier
Web Developer
Hannover, Germany
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php