You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Florian Semm (JIRA)" <ji...@apache.org> on 2012/05/26 13:53:23 UTC

[jira] [Commented] (LOG4PHP-178) Avoid usage errors by adding Type Hints

    [ https://issues.apache.org/jira/browse/LOG4PHP-178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283965#comment-13283965 ] 

Florian Semm commented on LOG4PHP-178:
--------------------------------------

done. 

Ivan has commited your changes
                
> 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
>              Labels: patch
>
> 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