• Resolved Puddleglum

    (@puddleglum)


    Aptana Studio is showing errors on two files:
    updraftplus – vendor – psr – log – Psr – Log – LoggerAwareTrait.php
    updraftplus – vendor – psr – log – Psr – Log – LoggerTrait.php

      For LoggerAwareTrait.php

    It doesn’t like line 8 “trait LoggerAwareTrait” (Syntax Error)
    It doesn’t like line 22 “}” (Syntax Error)
    It doesn’t complain but I expect it dislikes that there’s no closing “?>”

      For LoggerTrait.php

    It gives syntax errors on line 13 “trait LoggerTrait” and line 37 “public function alert($message, array $context = array())”

    
    namespace Psr\Log;
    
    /**
     * Basic Implementation of LoggerAwareInterface.
     */
    trait LoggerAwareTrait
    {
        /** @var LoggerInterface */
        protected $logger;
    
        /**
         * Sets a logger.
         * 
         * @param LoggerInterface $logger
         */
        public function setLogger(LoggerInterface $logger)
        {
            $this->logger = $logger;
        }
    }
    
    
    <?php
    
    namespace Psr\Log;
    
    /**
     * This is a simple Logger trait that classes unable to extend AbstractLogger
     * (because they extend another class, etc) can include.
     *
     * It simply delegates all log-level-specific methods to the <code>log</code> method to 
     * reduce boilerplate code that a simple Logger that does the same thing with 
     * messages regardless of the error level has to implement.
     */
    trait LoggerTrait
    {
        /**
         * System is unusable.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function emergency($message, array $context = array())
        {
            $this->log(LogLevel::EMERGENCY, $message, $context);
        }
    
        /**
         * Action must be taken immediately.
         *
         * Example: Entire website down, database unavailable, etc. This should
         * trigger the SMS alerts and wake you up.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function alert($message, array $context = array())
        {
            $this->log(LogLevel::ALERT, $message, $context);
        }
    
        /**
         * Critical conditions.
         *
         * Example: Application component unavailable, unexpected exception.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function critical($message, array $context = array())
        {
            $this->log(LogLevel::CRITICAL, $message, $context);
        }
    
        /**
         * Runtime errors that do not require immediate action but should typically
         * be logged and monitored.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function error($message, array $context = array())
        {
            $this->log(LogLevel::ERROR, $message, $context);
        }
    
        /**
         * Exceptional occurrences that are not errors.
         *
         * Example: Use of deprecated APIs, poor use of an API, undesirable things
         * that are not necessarily wrong.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function warning($message, array $context = array())
        {
            $this->log(LogLevel::WARNING, $message, $context);
        }
    
        /**
         * Normal but significant events.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function notice($message, array $context = array())
        {
            $this->log(LogLevel::NOTICE, $message, $context);
        }
    
        /**
         * Interesting events.
         *
         * Example: User logs in, SQL logs.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function info($message, array $context = array())
        {
            $this->log(LogLevel::INFO, $message, $context);
        }
    
        /**
         * Detailed debug information.
         *
         * @param string $message
         * @param array $context
         * @return null
         */
        public function debug($message, array $context = array())
        {
            $this->log(LogLevel::DEBUG, $message, $context);
        }
    
        /**
         * Logs with an arbitrary level.
         *
         * @param mixed $level
         * @param string $message
         * @param array $context
         * @return null
         */
        abstract public function log($level, $message, array $context = array());
    }
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Puddleglum

    (@puddleglum)

    Not sure if I subscribed to this thread or not and it won’t let me w/o posting a comment.

    Plugin Contributor DNutbourne

    (@dnutbourne)

    Hi,

    Those files appear to be sound. Is your IDE set to a ‘strict’ mode when checking for errors?

    Thread Starter Puddleglum

    (@puddleglum)

    I’ve not been able to find those settings in Aptana. So the file lacking ?> is completed elsewhere?

    Plugin Contributor DNutbourne

    (@dnutbourne)

    Hi,

    This is a standard PHP practice. The PHP ?> tag is completed elsewhere.

    The omitted ‘?>’ ensures that the file does not output any extra whitespace, which can cause issues in certain circumstances. It also prevents issues when the file is loaded by another PHP file.

    Thread Starter Puddleglum

    (@puddleglum)

    Learn something new every day. ?? Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Errors shown in plugin files (By Aptana IDE)’ is closed to new replies.