Christian Hammers created LOG4PHP-178:
-----------------------------------------

             Summary: Avoid usage errors by adding Type Hints
                 Key: LOG4PHP-178
                 URL: https://issues.apache.org/jira/browse/LOG4PHP-178
             Project: Log4php
          Issue Type: Improvement
    Affects Versions: 2.2.1
            Reporter: Christian Hammers
            Priority: Minor


It's tempting to write:
        $this->log = Logger::getRootLogger();
        $this->log->setLevel(LoggerLevel::WARN);

which at first succeedes but throws an exception when first using this Logger.
It would be more obvious to the user when he gets an immediate compiler error 
due to type hints.

--- Logger.php.orig     2012-05-25 16:55:35.000000000 +0200                     
                                                                            
+++ Logger.php  2012-05-25 17:02:04.000000000 +0200                             
                                                                            
@@ -376,9 +376,11 @@                                                            
                                                                            
        /**                                                                     
                                                                            
         * Set the Logger level.
         *
+        * Use LoggerLevel::getLevelWarn() etc. to get a LoggerLevel object.
+        *
         * @param LoggerLevel $level the level to set
         */
-       public function setLevel($level) {
+       public function setLevel(LoggerLevel $level) {
                $this->level = $level;
        }
 


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to