diff --git a/bootstrap/bootstrap.php b/bootstrap/bootstrap.php index 63bcb80ad09..ef2a6fd29d0 100644 --- a/bootstrap/bootstrap.php +++ b/bootstrap/bootstrap.php @@ -58,7 +58,7 @@ // Set a 503 response header so things like Varnish won't cache a bad page. http_response_code(503); - exit('Tried to create a folder at '.$path.', but could not.' . PHP_EOL); + exit('Tried to create a folder at ' . $path . ', but could not.' . PHP_EOL); } // Because setting permission with mkdir is a crapshoot. @@ -71,11 +71,11 @@ $realPath = realpath($path); // !@file_exists('/.') is a workaround for the terrible is_executable() - if ($realPath === false || !is_dir($realPath) || !@file_exists($realPath.'/.')) { + if ($realPath === false || !is_dir($realPath) || !@file_exists($realPath . '/.')) { // Set a 503 response header so things like Varnish won't cache a bad page. http_response_code(503); - exit(($realPath !== false ? $realPath : $path).' doesn\'t exist or isn\'t writable by PHP. Please fix that.' . PHP_EOL); + exit(($realPath !== false ? $realPath : $path) . ' doesn\'t exist or isn\'t writable by PHP. Please fix that.' . PHP_EOL); } if ($writableToo) { @@ -83,7 +83,7 @@ // Set a 503 response header so things like Varnish won't cache a bad page. http_response_code(503); - exit($realPath.' isn\'t writable by PHP. Please fix that.' . PHP_EOL); + exit($realPath . ' isn\'t writable by PHP. Please fix that.' . PHP_EOL); } } }; @@ -98,11 +98,11 @@ $rootPath = $findConfigPath('CRAFT_BASE_PATH', 'basePath') ?: dirname($vendorPath); // By default the remaining directories will be in the base directory -$configPath = $findConfigPath('CRAFT_CONFIG_PATH', 'configPath') ?: $rootPath.'/config'; -$contentMigrationsPath = $findConfigPath('CRAFT_CONTENT_MIGRATIONS_PATH', 'contentMigrationsPath') ?: $rootPath.'/migrations'; -$storagePath = $findConfigPath('CRAFT_STORAGE_PATH', 'storagePath') ?: $rootPath.'/storage'; -$templatesPath = $findConfigPath('CRAFT_TEMPLATES_PATH', 'templatesPath') ?: $rootPath.'/templates'; -$translationsPath = $findConfigPath('CRAFT_TRANSLATIONS_PATH', 'translationsPath') ?: $rootPath.'/translations'; +$configPath = $findConfigPath('CRAFT_CONFIG_PATH', 'configPath') ?: $rootPath . '/config'; +$contentMigrationsPath = $findConfigPath('CRAFT_CONTENT_MIGRATIONS_PATH', 'contentMigrationsPath') ?: $rootPath . '/migrations'; +$storagePath = $findConfigPath('CRAFT_STORAGE_PATH', 'storagePath') ?: $rootPath . '/storage'; +$templatesPath = $findConfigPath('CRAFT_TEMPLATES_PATH', 'templatesPath') ?: $rootPath . '/templates'; +$translationsPath = $findConfigPath('CRAFT_TRANSLATIONS_PATH', 'translationsPath') ?: $rootPath . '/translations'; // Set the environment $environment = $findConfig('CRAFT_ENVIRONMENT', 'env') ?: ($_SERVER['SERVER_NAME'] ?? null); @@ -128,7 +128,7 @@ $ensureFolderIsReadable($licensePath); if ($appType === 'web') { - $licenseFullPath = $licensePath.'/'.$licenseKeyName; + $licenseFullPath = $licensePath . '/' . $licenseKeyName; // If the license key doesn't exist yet, make sure the folder is readable and we can write a temp one. if (!file_exists($licenseFullPath)) { @@ -137,7 +137,7 @@ // See if it worked. if (!file_exists($licenseFullPath) || (file_exists($licenseFullPath) && file_get_contents($licenseFullPath) !== 'temp')) { - exit($licensePath.' isn\'t writable by PHP. Please fix that.' . PHP_EOL); + exit($licensePath . ' isn\'t writable by PHP. Please fix that.' . PHP_EOL); } } } @@ -147,16 +147,16 @@ $ensureFolderIsReadable($storagePath, true); // Create the storage/runtime/ folder if it doesn't already exist -$createFolder($storagePath.'/runtime'); -$ensureFolderIsReadable($storagePath.'/runtime', true); +$createFolder($storagePath . '/runtime'); +$ensureFolderIsReadable($storagePath . '/runtime', true); // Create the storage/logs/ folder if it doesn't already exist -$createFolder($storagePath.'/logs'); -$ensureFolderIsReadable($storagePath.'/logs', true); +$createFolder($storagePath . '/logs'); +$ensureFolderIsReadable($storagePath . '/logs', true); // Log errors to storage/logs/phperrors.log ini_set('log_errors', 1); -ini_set('error_log', $storagePath.'/logs/phperrors.log'); +ini_set('error_log', $storagePath . '/logs/phperrors.log'); error_reporting(E_ALL); // Load the general config @@ -165,7 +165,7 @@ $configService = new Config(); $configService->env = $environment; $configService->configDir = $configPath; -$configService->appDefaultsDir = dirname(__DIR__).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'defaults'; +$configService->appDefaultsDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'defaults'; $generalConfig = $configService->getConfigFromFile('general'); // Determine if Craft is running in Dev Mode @@ -196,11 +196,11 @@ defined('CURLOPT_CONNECTTIMEOUT_MS') || define('CURLOPT_CONNECTTIMEOUT_MS', 156); // Load the files -$cmsPath = $vendorPath.'/craftcms/cms'; -$libPath = $cmsPath.'/lib'; -$srcPath = $cmsPath.'/src'; -require $srcPath.'/Yii.php'; -require $srcPath.'/Craft.php'; +$cmsPath = $vendorPath . '/craftcms/cms'; +$libPath = $cmsPath . '/lib'; +$srcPath = $cmsPath . '/src'; +require $srcPath . '/Yii.php'; +require $srcPath . '/Craft.php'; // Move Yii's autoloader to the end (Composer's is faster when optimized) spl_autoload_unregister(['Yii', 'autoload']); diff --git a/bootstrap/console.php b/bootstrap/console.php index 7a08e4307bf..f09ac386c27 100644 --- a/bootstrap/console.php +++ b/bootstrap/console.php @@ -28,4 +28,4 @@ $appType = 'console'; -return require __DIR__.'/bootstrap.php'; +return require __DIR__ . '/bootstrap.php'; diff --git a/bootstrap/web.php b/bootstrap/web.php index 2f865be974f..8a452709f37 100644 --- a/bootstrap/web.php +++ b/bootstrap/web.php @@ -39,4 +39,4 @@ $appType = 'web'; -return require __DIR__.'/bootstrap.php'; +return require __DIR__ . '/bootstrap.php'; diff --git a/src/base/ApplicationTrait.php b/src/base/ApplicationTrait.php index aab03489407..e9963414603 100644 --- a/src/base/ApplicationTrait.php +++ b/src/base/ApplicationTrait.php @@ -33,7 +33,6 @@ use craft\services\Sites; use craft\services\Tags; use craft\services\UserGroups; -use craft\services\UserPermissions; use craft\services\Users; use craft\services\Volumes; use craft\web\Application as WebApplication; diff --git a/src/behaviors/EnvAttributeParserBehavior.php b/src/behaviors/EnvAttributeParserBehavior.php index d16e470c9bf..19b1c0ef2f2 100644 --- a/src/behaviors/EnvAttributeParserBehavior.php +++ b/src/behaviors/EnvAttributeParserBehavior.php @@ -8,11 +8,8 @@ namespace craft\behaviors; use Craft; -use craft\base\FieldInterface; use craft\helpers\StringHelper; -use craft\models\FieldLayout; use yii\base\Behavior; -use yii\base\InvalidConfigException; use yii\base\Model; use yii\validators\UrlValidator; diff --git a/src/controllers/BaseElementsController.php b/src/controllers/BaseElementsController.php index dee04660d9a..a67dbfcf7b4 100644 --- a/src/controllers/BaseElementsController.php +++ b/src/controllers/BaseElementsController.php @@ -12,7 +12,6 @@ use craft\errors\InvalidTypeException; use craft\web\Controller; use yii\web\BadRequestHttpException; -use yii\web\ForbiddenHttpException; /** * The BaseElementsController class provides some common methods for [[ElementsController]] and [[ElementIndexesController]]. diff --git a/src/controllers/ConfigSyncController.php b/src/controllers/ConfigSyncController.php index f5ad0cb41da..8731f6f09dd 100644 --- a/src/controllers/ConfigSyncController.php +++ b/src/controllers/ConfigSyncController.php @@ -7,16 +7,12 @@ namespace craft\controllers; -use Composer\IO\BufferIO; -use Composer\Semver\Comparator; -use Composer\Semver\VersionParser; use Craft; use craft\base\Plugin; use craft\errors\InvalidPluginException; use craft\helpers\ArrayHelper; use craft\services\Plugins; use yii\base\NotSupportedException; -use yii\web\BadRequestHttpException; use yii\web\Response; /** diff --git a/src/controllers/SystemSettingsController.php b/src/controllers/SystemSettingsController.php index 8dc3ebc1304..44a3c011699 100644 --- a/src/controllers/SystemSettingsController.php +++ b/src/controllers/SystemSettingsController.php @@ -18,7 +18,6 @@ use craft\mail\transportadapters\BaseTransportAdapter; use craft\mail\transportadapters\Sendmail; use craft\mail\transportadapters\TransportAdapterInterface; -use craft\models\Info; use craft\models\MailSettings; use craft\web\assets\generalsettings\GeneralSettingsAsset; use craft\web\Controller; diff --git a/src/elements/actions/DeepDuplicate.php b/src/elements/actions/DeepDuplicate.php index be48426d64c..640f8ad0559 100644 --- a/src/elements/actions/DeepDuplicate.php +++ b/src/elements/actions/DeepDuplicate.php @@ -7,13 +7,6 @@ namespace craft\elements\actions; -use Craft; -use craft\base\Element; -use craft\base\ElementAction; -use craft\base\ElementInterface; -use craft\elements\db\ElementQueryInterface; -use craft\helpers\ArrayHelper; - /** * DeepDuplicate represents a "Duplicate (with descendants)" element action. * diff --git a/src/elements/actions/Duplicate.php b/src/elements/actions/Duplicate.php index a2155be739b..5fc25aceed1 100644 --- a/src/elements/actions/Duplicate.php +++ b/src/elements/actions/Duplicate.php @@ -12,7 +12,6 @@ use craft\base\ElementAction; use craft\base\ElementInterface; use craft\elements\db\ElementQueryInterface; -use craft\helpers\ArrayHelper; /** * Duplicate represents a Duplicate element action. diff --git a/src/events/DeleteElementEvent.php b/src/events/DeleteElementEvent.php index 7e3fd318e53..3236d4d39f7 100644 --- a/src/events/DeleteElementEvent.php +++ b/src/events/DeleteElementEvent.php @@ -7,9 +7,6 @@ namespace craft\events; -use craft\base\ElementInterface; -use yii\base\Event; - /** * Delete element event class. * diff --git a/src/fields/Assets.php b/src/fields/Assets.php index 61fb76ad44e..7d568c44eef 100644 --- a/src/fields/Assets.php +++ b/src/fields/Assets.php @@ -128,9 +128,11 @@ public function rules() { $rules = parent::rules(); - $rules[] = [['allowedKinds'], 'required', 'when' => function(self $field): bool { - return (bool)$field->restrictFiles; - }]; + $rules[] = [ + ['allowedKinds'], 'required', 'when' => function(self $field): bool { + return (bool)$field->restrictFiles; + } + ]; return $rules; } diff --git a/src/fields/Matrix.php b/src/fields/Matrix.php index ae0dc8aff3b..f2b9b161cf9 100644 --- a/src/fields/Matrix.php +++ b/src/fields/Matrix.php @@ -924,9 +924,9 @@ private function _createBlocksFromSerializedData($value, ElementInterface $eleme // Should we ignore disabled blocks? $request = Craft::$app->getRequest(); $hideDisabledBlocks = !$request->getIsConsoleRequest() && ( - $request->getToken() !== null || - $request->getIsLivePreview() - ); + $request->getToken() !== null || + $request->getIsLivePreview() + ); $blocks = []; $sortOrder = 0; diff --git a/src/migrations/m150617_213829_update_email_settings.php b/src/migrations/m150617_213829_update_email_settings.php index 48975b77e61..337c3a506d4 100644 --- a/src/migrations/m150617_213829_update_email_settings.php +++ b/src/migrations/m150617_213829_update_email_settings.php @@ -2,7 +2,6 @@ namespace craft\migrations; -use Craft; use craft\db\Migration; use craft\db\Query; use craft\helpers\Json; diff --git a/src/migrations/m180517_173000_user_photo_volume_to_uid.php b/src/migrations/m180517_173000_user_photo_volume_to_uid.php index cfdc00ff888..057c4a55096 100644 --- a/src/migrations/m180517_173000_user_photo_volume_to_uid.php +++ b/src/migrations/m180517_173000_user_photo_volume_to_uid.php @@ -49,7 +49,6 @@ public function safeUp() ], [ 'category' => 'users' ], [], false); - } } } diff --git a/src/migrations/m180521_173000_initial_yml_and_snapshot.php b/src/migrations/m180521_173000_initial_yml_and_snapshot.php index cc88fa4d52e..df8fd078258 100644 --- a/src/migrations/m180521_173000_initial_yml_and_snapshot.php +++ b/src/migrations/m180521_173000_initial_yml_and_snapshot.php @@ -8,9 +8,7 @@ use craft\elements\User; use craft\helpers\ArrayHelper; use craft\helpers\DateTimeHelper; -use craft\helpers\FileHelper; use craft\helpers\Json; -use Symfony\Component\Yaml\Yaml; /** * m180521_173000_initial_yml_and_snapshot migration. diff --git a/src/migrations/m181112_203955_sequences_table.php b/src/migrations/m181112_203955_sequences_table.php index 8432749db82..d27d4263e86 100644 --- a/src/migrations/m181112_203955_sequences_table.php +++ b/src/migrations/m181112_203955_sequences_table.php @@ -2,7 +2,6 @@ namespace craft\migrations; -use Craft; use craft\db\Migration; /** diff --git a/src/services/AssetTransforms.php b/src/services/AssetTransforms.php index 878383ee4d6..27e31f3f232 100644 --- a/src/services/AssetTransforms.php +++ b/src/services/AssetTransforms.php @@ -280,12 +280,12 @@ public function handleChangedTransform(ConfigEvent $event) $transformRecord->save(false); $transaction->commit(); - } catch (\Throwable $e) { $transaction->rollBack(); throw $e; } } + /** * Deletes an asset transform by its ID. * @@ -902,7 +902,7 @@ public function getLocalImageSource(Asset $asset): string // Fetch a list of existing temp files for this image. $files = FileHelper::findFiles($tempPath, [ 'only' => [ - $prefix . '*' . '.' . $extension + $prefix . '*' . '.' . $extension ] ]); diff --git a/src/services/Matrix.php b/src/services/Matrix.php index 0874fc0050b..9c92f0b8795 100644 --- a/src/services/Matrix.php +++ b/src/services/Matrix.php @@ -12,12 +12,10 @@ use craft\base\ElementInterface; use craft\base\Field; use craft\db\Query; -use craft\elements\db\ElementQueryInterface; use craft\elements\db\MatrixBlockQuery; use craft\elements\MatrixBlock; use craft\errors\MatrixBlockTypeNotFoundException; use craft\events\ConfigEvent; -use craft\fields\BaseRelationField; use craft\fields\Matrix as MatrixField; use craft\helpers\ArrayHelper; use craft\helpers\Db; diff --git a/src/services/Routes.php b/src/services/Routes.php index ede842110c1..039953328cc 100644 --- a/src/services/Routes.php +++ b/src/services/Routes.php @@ -8,15 +8,10 @@ namespace craft\services; use Craft; -use craft\db\Query; -use craft\errors\RouteNotFoundException; use craft\events\DeleteSiteEvent; use craft\events\RouteEvent; use craft\helpers\ArrayHelper; -use craft\helpers\Db; -use craft\helpers\Json; use craft\helpers\StringHelper; -use craft\records\Route as RouteRecord; use yii\base\Component; /** @@ -307,6 +302,6 @@ private function _getMaxSortOrder(): int $max = max($max, $route['sortOrder']); } - return (int) $max + 1; + return (int)$max + 1; } } diff --git a/src/services/Updates.php b/src/services/Updates.php index 442f1e64c20..dcc5e6d71c3 100644 --- a/src/services/Updates.php +++ b/src/services/Updates.php @@ -16,7 +16,6 @@ use craft\models\Updates as UpdatesModel; use yii\base\Component; use yii\base\ErrorException; -use yii\base\Exception; use yii\base\InvalidArgumentException; /** diff --git a/src/views/debug/table.php b/src/views/debug/table.php index 1d7de18e264..e698550bba4 100644 --- a/src/views/debug/table.php +++ b/src/views/debug/table.php @@ -9,40 +9,40 @@ ?> -
Empty.
+Empty.
-style="nowrap">= Html::encode($heading) ?> | - -|
---|---|
= $value ?> | - - -= $value ?> | - - -
style="nowrap">= Html::encode($heading) ?> | + +|
---|---|
= $value ?> | + + += $value ?> | + -