Fix some warnings about undefined contexts
authorMatthias Schmidt <gravatronics@live.com>
Sat, 2 Jul 2016 11:12:35 +0000 (13:12 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 2 Jul 2016 11:12:49 +0000 (13:12 +0200)
wcfsetup/install.php
wcfsetup/install/files/lib/system/condition/UserIntegerPropertyCondition.class.php
wcfsetup/install/files/lib/system/image/ImageHandler.class.php
wcfsetup/install/files/lib/system/io/GZipFile.class.php
wcfsetup/install/files/lib/system/option/CaptchaSelectOptionType.class.php
wcfsetup/install/files/lib/system/option/SelectOptionType.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php

index 47867e6854dd909ac28a62eec944a5c8b7f0b5a1..d635109148ff16c4dcf52d7dd6ae20ebf04cf7e7 100644 (file)
@@ -782,6 +782,7 @@ class ZipFile extends File {
                if (!self::$gzopen64 && !function_exists('gzopen')) {
                        throw new SystemException('Can not find functions of the zlib extension');
                }
+               /** @noinspection PhpUndefinedFunctionInspection */
                $this->resource = (self::$gzopen64 ? @gzopen64($filename, $mode) : @gzopen($filename, $mode));
                if ($this->resource === false) {
                        throw new SystemException('Can not open file ' . $filename);
index 9c156d09845cb894ed4ba405b1d8594ad2de790c..86251d1fd2507edce1318786cc4663e5317c86cc 100644 (file)
@@ -26,6 +26,7 @@ class UserIntegerPropertyCondition extends AbstractIntegerCondition implements I
                }
                
                if (isset($conditionData['greaterThan'])) {
+                       /** @noinspection PhpUndefinedFieldInspection */
                        $objectList->getConditionBuilder()->add('user_table.'.$this->getDecoratedObject()->propertyname.' > ?', [$conditionData['greaterThan']]);
                }
                if (isset($conditionData['lessThan'])) {
index 1bef80ffa032130ef60cfa83e9b0fe3464fd4de2..26835b8927fa608bdf1f50a2b10b4c0829ef827a 100644 (file)
@@ -39,6 +39,7 @@ class ImageHandler extends SingletonFactory {
                }
                
                $imageAdapter = $this->imageAdapters[IMAGE_ADAPTER_TYPE];
+               /** @noinspection PhpUndefinedCallbackInspection */
                $isSupported = call_user_func([$imageAdapter, 'isSupported']);
                
                // fallback to GD if image adapter is not available
index ba89054a8137387bdd2e59bce4536df8af588f9a..22d8745decf311c73eea78feed269539db86b1af 100644 (file)
@@ -35,6 +35,7 @@ class GZipFile extends File {
                }
                
                $this->filename = $filename;
+               /** @noinspection PhpUndefinedFunctionInspection */
                $this->resource = (self::$gzopen64 ? gzopen64($filename, $mode) : gzopen($filename, $mode));
                if ($this->resource === false) {
                        throw new SystemException('Can not open file ' . $filename);
index 3fa7c890d68dad2079174cd65a4cf1f48c2ea04c..6b9b1973f3c9a92b69292cc22d3f4b8db06e7a8a 100644 (file)
@@ -19,11 +19,10 @@ class CaptchaSelectOptionType extends AbstractOptionType {
         */
        public function getFormElement(Option $option, $value) {
                $selectOptions = CaptchaHandler::getInstance()->getCaptchaSelection();
+               /** @noinspection PhpUndefinedFieldInspection */
                if ($option->allowemptyvalue) {
                        $selectOptions = array_merge(
-                               [
-                                       '' => WCF::getLanguage()->get('wcf.captcha.useNoCaptcha')
-                               ],
+                               ['' => WCF::getLanguage()->get('wcf.captcha.useNoCaptcha')],
                                $selectOptions
                        );
                }
index de2ec66c6bca50c684469d54051bcea87a1ae376..8cbdacc9a975e677d17ef070d7eb9b4cbb42f0d7 100644 (file)
@@ -20,6 +20,7 @@ class SelectOptionType extends RadioButtonOptionType {
        public function getFormElement(Option $option, $value) {
                $options = $this->parseEnableOptions($option);
                
+               /** @noinspection PhpUndefinedFieldInspection */
                WCF::getTPL()->assign([
                        'disableOptions' => $options['disableOptions'],
                        'enableOptions' => $options['enableOptions'],
index fb5309fccb808c2812f65b6ce89001db516ed738..4ed3efb4296e6ee1777631a74dd8ecd44a474408 100644 (file)
@@ -6,6 +6,7 @@ use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\CommentRuntimeCache;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
 use wcf\system\WCF;
 
 /**
@@ -15,6 +16,8 @@ use wcf\system\WCF;
  * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\System\User\Notification\Event
+ *
+ * @method     CommentResponseUserNotificationObject   getUserNotificationObject()
  */
 class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractSharedUserNotificationEvent {
        /**
@@ -26,7 +29,7 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
         * @inheritDoc
         */
        protected function prepare() {
-               CommentRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->commentID);
+               CommentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->commentID);
                UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['userID']);
        }
        
@@ -49,7 +52,7 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
         * @inheritDoc
         */
        public function getMessage() {
-               $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID);
                if ($comment->userID) {
                        $commentAuthor = UserProfileRuntimeCache::getInstance()->getObject($comment->userID);
                }
@@ -83,7 +86,7 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
         * @inheritDoc
         */
        public function getEmailMessage($notificationType = 'instant') {
-               $comment = new Comment($this->userNotificationObject->commentID);
+               $comment = new Comment($this->getUserNotificationObject()->commentID);
                $owner = new User($comment->objectID);
                if ($comment->userID) {
                        $commentAuthor = new User($comment->userID);
@@ -134,6 +137,6 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
         * @inheritDoc
         */
        public function getEventHash() {
-               return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);
+               return sha1($this->eventID . '-' . $this->getUserNotificationObject()->commentID);
        }
 }
index 2f631d54c41a1cf5a19494ee76aea57e3a260b8f..52cfecfe0e37e471a7ed17e7e334d1e629c525ec 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\system\user\notification\event;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\object\CommentUserNotificationObject;
 
 /**
  * User notification event for profile comments.
@@ -10,6 +11,8 @@ use wcf\system\request\LinkHandler;
  * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\System\User\Notification\Event
+ * 
+ * @method     CommentUserNotificationObject   getUserNotificationObject()
  */
 class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent {
        /**
@@ -21,7 +24,7 @@ class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotifica
         * @inheritDoc
         */
        protected function prepare() {
-               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->objectID);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->objectID);
        }
        
        /**
@@ -68,7 +71,7 @@ class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotifica
         * @inheritDoc
         */
        public function getEmailMessage($notificationType = 'instant') {
-               $user = UserProfileRuntimeCache::getInstance()->getObject($this->userNotificationObject->objectID);
+               $user = UserProfileRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID);
                
                $authors = $this->getAuthors();
                if (count($authors) > 1) {
@@ -100,7 +103,7 @@ class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotifica
         * @inheritDoc
         */
        public function getLink() {
-               return LinkHandler::getInstance()->getLink('User', ['object' => UserProfileRuntimeCache::getInstance()->getObject($this->userNotificationObject->objectID)], '#wall');
+               return LinkHandler::getInstance()->getLink('User', ['object' => UserProfileRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)], '#wall');
        }
        
        /**