From a99fcf96373fc802e4a88cf9577ef6a9413543bf Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 5 Jan 2013 13:18:10 +0100 Subject: [PATCH] Fixes code to match PHP CodeSniffer rules --- .../lib/system/SingletonFactory.class.php | 2 +- .../PackageInstallationDispatcher.class.php | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/wcfsetup/install/files/lib/system/SingletonFactory.class.php b/wcfsetup/install/files/lib/system/SingletonFactory.class.php index 9765eccaaf..6824d1aa2c 100644 --- a/wcfsetup/install/files/lib/system/SingletonFactory.class.php +++ b/wcfsetup/install/files/lib/system/SingletonFactory.class.php @@ -55,7 +55,7 @@ abstract class SingletonFactory { self::$__singletonObjects[$className] = null; self::$__singletonObjects[$className] = new $className(); } - else if (array_key_exists($className, self::$__singletonObjects) && is_null(self::$__singletonObjects[$className])) { + else if (array_key_exists($className, self::$__singletonObjects) && self::$__singletonObjects[$className] === null) { throw new SystemException("Infinite loop detected while trying to retrieve object for '".$className."'"); } diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 45c61b9e11..370742808a 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -15,8 +15,10 @@ use wcf\system\cache\CacheHandler; use wcf\system\database\statement\PreparedStatement; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\SystemException; -use wcf\system\form\container; -use wcf\system\form\element; +use wcf\system\form\container\GroupFormElementContainer; +use wcf\system\form\container\MultipleSelectionFormElementContainer; +use wcf\system\form\element\MultipleSelectionFormElement; +use wcf\system\form\element\TextInputFormElement; use wcf\system\form\FormDocument; use wcf\system\form; use wcf\system\language\LanguageFactory; @@ -26,6 +28,7 @@ use wcf\system\package\plugin\SQLPackageInstallationPlugin; use wcf\system\request\LinkHandler; use wcf\system\request\RouteHandler; use wcf\system\style\StyleHandler; +use wcf\system\version\VersionHandler; use wcf\system\WCF; use wcf\util\FileUtil; use wcf\util\HeaderUtil; @@ -561,8 +564,8 @@ class PackageInstallationDispatcher { protected function promptPackageDir() { if (!PackageInstallationFormManager::findForm($this->queue, 'packageDir')) { - $container = new container\GroupFormElementContainer(); - $packageDir = new element\TextInputFormElement($container); + $container = new GroupFormElementContainer(); + $packageDir = new TextInputFormElement($container); $packageDir->setName('packageDir'); $packageDir->setLabel(WCF::getLanguage()->get('wcf.acp.package.packageDir.input')); @@ -629,11 +632,11 @@ class PackageInstallationDispatcher { */ protected function promptOptionalPackages(array $packages) { if (!PackageInstallationFormManager::findForm($this->queue, 'optionalPackages')) { - $container = new container\MultipleSelectionFormElementContainer(); + $container = new MultipleSelectionFormElementContainer(); $container->setName('optionalPackages'); foreach ($packages as $package) { - $optionalPackage = new element\MultipleSelectionFormElement($container); + $optionalPackage = new MultipleSelectionFormElement($container); $optionalPackage->setName('optionalPackages'); $optionalPackage->setLabel($package['packageName']); $optionalPackage->setValue($package['package']); @@ -954,12 +957,12 @@ class PackageInstallationDispatcher { break; } } - + /* * Restructure version tables. */ protected function restructureVersionTables() { - $objectTypes = \wcf\system\version\VersionHandler::getInstance()->getObjectTypes(); + $objectTypes = VersionHandler::getInstance()->getObjectTypes(); if (empty($objectTypes)) { return; @@ -971,8 +974,8 @@ class PackageInstallationDispatcher { $versionTableBaseColumns[] = array('name' => 'versionUserID', 'data' => array('type' => 'INT')); $versionTableBaseColumns[] = array('name' => 'versionUsername', 'data' => array('type' => 'VARCHAR', 'length' => 255)); $versionTableBaseColumns[] = array('name' => 'versionTime', 'data' => array('type' => 'INT')); - - foreach ($objectTypes as $objectTypeID => $objectType) { + + foreach ($objectTypes as $objectTypeID => $objectType) { // get structure of base table $baseTableColumns = WCF::getDB()->getEditor()->getColumns($objectType::getDatabaseTableName()); // get structure of version table @@ -980,7 +983,7 @@ class PackageInstallationDispatcher { if (empty($versionTableColumns)) { $columns = array_merge($versionTableBaseColumns, $baseTableColumns); - + WCF::getDB()->getEditor()->createTable($objectType::getDatabaseVersionTableName(), $columns); } else { @@ -1001,5 +1004,5 @@ class PackageInstallationDispatcher { } } } - } + } } -- 2.20.1