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.

-
- - - - - $heading): ?> - style="nowrap"> - - - - - - - - - $value): ?> - - - - - - - - +
+
+ + + + $heading): ?> + style="nowrap"> + + + + + + + + + $value): ?> + + + + + + - -
-
+ + + + + diff --git a/src/web/assets/cp/CpAsset.php b/src/web/assets/cp/CpAsset.php index a64acc6e321..e219bd665b5 100644 --- a/src/web/assets/cp/CpAsset.php +++ b/src/web/assets/cp/CpAsset.php @@ -320,7 +320,7 @@ private function _publishableSections(User $currentUser): array $sections = []; foreach (Craft::$app->getSections()->getEditableSections() as $section) { - if ($section->type !== Section::TYPE_SINGLE && $currentUser->can('createEntries:'.$section->uid)) { + if ($section->type !== Section::TYPE_SINGLE && $currentUser->can('createEntries:' . $section->uid)) { $sections[] = [ 'entryTypes' => $this->_entryTypes($section), 'handle' => $section->handle, diff --git a/src/web/twig/Extension.php b/src/web/twig/Extension.php index 6543d4d8005..31beb1b85f4 100644 --- a/src/web/twig/Extension.php +++ b/src/web/twig/Extension.php @@ -45,7 +45,6 @@ use DateTimeInterface; use DateTimeZone; use enshrined\svgSanitize\Sanitizer; -use yii\base\Exception; use yii\base\InvalidArgumentException; use yii\base\InvalidConfigException; use yii\db\Expression; @@ -915,7 +914,7 @@ public function svgFunction($svg, bool $sanitize = null, bool $namespace = null) // Namespace class names and IDs if ( $namespace && ( - strpos($svg, 'id=') !== false || strpos($svg, 'class=') !== false) + strpos($svg, 'id=') !== false || strpos($svg, 'class=') !== false) ) { $ns = StringHelper::randomStringWithChars('abcdefghijklmnopqrstuvwxyz', 10) . '-'; $ids = []; diff --git a/src/web/twig/variables/Routes.php b/src/web/twig/variables/Routes.php index 1f32ea237c0..0d9e6f918c9 100644 --- a/src/web/twig/variables/Routes.php +++ b/src/web/twig/variables/Routes.php @@ -8,8 +8,8 @@ namespace craft\web\twig\variables; use Craft; -use craft\services\Routes as RoutesService; use craft\helpers\Html; +use craft\services\Routes as RoutesService; /** * Route functions. diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index 4df4d580b1e..790ddcb82b5 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -3,26 +3,26 @@ define('YII_ENV', 'test'); // Use the current installation of Craft -define('CRAFT_STORAGE_PATH', __DIR__.'/_craft/storage'); -define('CRAFT_TEMPLATES_PATH', __DIR__.'/_craft/templates'); -define('CRAFT_CONFIG_PATH', __DIR__.'/_craft/config'); -define('CRAFT_VENDOR_PATH', __DIR__.'/../vendor'); +define('CRAFT_STORAGE_PATH', __DIR__ . '/_craft/storage'); +define('CRAFT_TEMPLATES_PATH', __DIR__ . '/_craft/templates'); +define('CRAFT_CONFIG_PATH', __DIR__ . '/_craft/config'); +define('CRAFT_VENDOR_PATH', __DIR__ . '/../vendor'); $devMode = true; $vendorPath = realpath(CRAFT_VENDOR_PATH); -$craftPath = __DIR__.'/_craft'; +$craftPath = __DIR__ . '/_craft'; -$configPath = realpath($craftPath.'/config'); -$contentMigrationsPath = realpath($craftPath.'/migrations'); -$storagePath = realpath($craftPath.'/storage'); -$templatesPath = realpath($craftPath.'/templates'); -$translationsPath = realpath($craftPath.'/translations'); +$configPath = realpath($craftPath . '/config'); +$contentMigrationsPath = realpath($craftPath . '/migrations'); +$storagePath = realpath($craftPath . '/storage'); +$templatesPath = realpath($craftPath . '/templates'); +$translationsPath = realpath($craftPath . '/translations'); // Log errors to craft/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); ini_set('display_errors', 1); @@ -34,10 +34,10 @@ defined('CURLOPT_CONNECTTIMEOUT_MS') || define('CURLOPT_CONNECTTIMEOUT_MS', 156); // Load the files -$srcPath = dirname(__DIR__).'/src'; -$libPath = dirname(__DIR__).'/lib'; -require $vendorPath.'/yiisoft/yii2/Yii.php'; -require $srcPath.'/Craft.php'; +$srcPath = dirname(__DIR__) . '/src'; +$libPath = dirname(__DIR__) . '/lib'; +require $vendorPath . '/yiisoft/yii2/Yii.php'; +require $srcPath . '/Craft.php'; // Set aliases diff --git a/tests/_craft/config/db.php b/tests/_craft/config/db.php index 26f62c738b4..f350decf958 100644 --- a/tests/_craft/config/db.php +++ b/tests/_craft/config/db.php @@ -9,19 +9,19 @@ return [ - // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'. - 'server' => 'localhost', + // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'. + 'server' => 'localhost', - // The database username to connect with. - 'user' => getenv('TEST_DB_USER'), + // The database username to connect with. + 'user' => getenv('TEST_DB_USER'), - // The database password to connect with. - 'password' => getenv('TEST_DB_PASS'), + // The database password to connect with. + 'password' => getenv('TEST_DB_PASS'), - // The name of the database to select. - 'database' => getenv('TEST_DB_NAME'), + // The name of the database to select. + 'database' => getenv('TEST_DB_NAME'), - // The prefix to use when naming tables. This can be no more than 5 characters. - 'tablePrefix' => 'craft', + // The prefix to use when naming tables. This can be no more than 5 characters. + 'tablePrefix' => 'craft', ]; diff --git a/tests/_craft/config/general.php b/tests/_craft/config/general.php index 84bc4846fc5..74984ed60d8 100644 --- a/tests/_craft/config/general.php +++ b/tests/_craft/config/general.php @@ -8,5 +8,5 @@ */ return [ - 'devMode'=>true + 'devMode' => true ]; diff --git a/tests/_craft/config/test.php b/tests/_craft/config/test.php index fc6c0659cd5..607e5a548fd 100644 --- a/tests/_craft/config/test.php +++ b/tests/_craft/config/test.php @@ -8,8 +8,8 @@ $basePath = dirname(dirname(dirname(__DIR__))); -$srcPath = $basePath.'/src'; -$vendorPath = $basePath.'/vendor'; +$srcPath = $basePath . '/src'; +$vendorPath = $basePath . '/vendor'; // Load the config $config = ArrayHelper::merge( @@ -18,12 +18,12 @@ 'config' => [ 'class' => Config::class, 'configDir' => __DIR__, - 'appDefaultsDir' => $srcPath.'/config/defaults', + 'appDefaultsDir' => $srcPath . '/config/defaults', ], ], ], - require $srcPath.'/config/app.php', - require $srcPath.'/config/app.web.php' + require $srcPath . '/config/app.php', + require $srcPath . '/config/app.web.php' ); $config['vendorPath'] = $vendorPath; @@ -38,6 +38,6 @@ return ArrayHelper::merge($config, [ 'class' => craft\web\Application::class, - 'id'=>'craft-test', + 'id' => 'craft-test', 'basePath' => $srcPath ]); diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 3fb3a9f034d..566a1d93faf 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -12,10 +12,10 @@ * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) - * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) * * @SuppressWarnings(PHPMD) -*/ + */ class AcceptanceTester extends \Codeception\Actor { use _generated\AcceptanceTesterActions; diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php index 4d66daec0a7..4420aca2011 100644 --- a/tests/_support/FunctionalTester.php +++ b/tests/_support/FunctionalTester.php @@ -12,10 +12,10 @@ * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) - * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) * * @SuppressWarnings(PHPMD) -*/ + */ class FunctionalTester extends \Codeception\Actor { use _generated\FunctionalTesterActions; diff --git a/tests/_support/Helper/Acceptance.php b/tests/_support/Helper/Acceptance.php index 65b94215e32..51543bfaa2c 100644 --- a/tests/_support/Helper/Acceptance.php +++ b/tests/_support/Helper/Acceptance.php @@ -1,4 +1,5 @@ view; - $this->assertEquals( '{{ object.titleWithHyphens|replace({\'-\': \'!\'}) }}', $view->normalizeObjectTemplate('{{ object.titleWithHyphens|replace({\'-\': \'!\'}) }}')); - $this->assertEquals( '{{ (_variables.foo ?? object.foo)|raw }}', $view->normalizeObjectTemplate('{foo}')); - $this->assertEquals( '{{ (_variables.foo ?? object.foo).bar|raw }}', $view->normalizeObjectTemplate('{foo.bar}')); - $this->assertEquals( '{foo : \'bar\'}', $view->normalizeObjectTemplate('{foo : \'bar\'}')); - $this->assertEquals( '{{foo}}', $view->normalizeObjectTemplate('{{foo}}')); - $this->assertEquals( '{% foo %}', $view->normalizeObjectTemplate('{% foo %}')); - $this->assertEquals( '{{ (_variables.foo ?? object.foo).fn({bar: baz})|raw }}', $view->normalizeObjectTemplate('{foo.fn({bar: baz})}')); - $this->assertEquals( '{{ (_variables.foo ?? object.foo).fn({bar: {baz: 1}})|raw }}', $view->normalizeObjectTemplate('{foo.fn({bar: {baz: 1}})}')); - $this->assertEquals( '{{ (_variables.foo ?? object.foo).fn(\'bar:baz\')|raw }}', $view->normalizeObjectTemplate('{foo.fn(\'bar:baz\')}')); - $this->assertEquals( '{{ (_variables.foo ?? object.foo).fn({\'bar\': baz})|raw }}', $view->normalizeObjectTemplate('{foo.fn({\'bar\': baz})}')); + $this->assertEquals('{{ object.titleWithHyphens|replace({\'-\': \'!\'}) }}', $view->normalizeObjectTemplate('{{ object.titleWithHyphens|replace({\'-\': \'!\'}) }}')); + $this->assertEquals('{{ (_variables.foo ?? object.foo)|raw }}', $view->normalizeObjectTemplate('{foo}')); + $this->assertEquals('{{ (_variables.foo ?? object.foo).bar|raw }}', $view->normalizeObjectTemplate('{foo.bar}')); + $this->assertEquals('{foo : \'bar\'}', $view->normalizeObjectTemplate('{foo : \'bar\'}')); + $this->assertEquals('{{foo}}', $view->normalizeObjectTemplate('{{foo}}')); + $this->assertEquals('{% foo %}', $view->normalizeObjectTemplate('{% foo %}')); + $this->assertEquals('{{ (_variables.foo ?? object.foo).fn({bar: baz})|raw }}', $view->normalizeObjectTemplate('{foo.fn({bar: baz})}')); + $this->assertEquals('{{ (_variables.foo ?? object.foo).fn({bar: {baz: 1}})|raw }}', $view->normalizeObjectTemplate('{foo.fn({bar: {baz: 1}})}')); + $this->assertEquals('{{ (_variables.foo ?? object.foo).fn(\'bar:baz\')|raw }}', $view->normalizeObjectTemplate('{foo.fn(\'bar:baz\')}')); + $this->assertEquals('{{ (_variables.foo ?? object.foo).fn({\'bar\': baz})|raw }}', $view->normalizeObjectTemplate('{foo.fn({\'bar\': baz})}')); } } diff --git a/tests/unit/helpers/AppTest.php b/tests/unit/helpers/AppTest.php index 53ac1ae91c9..7acb1f4f03c 100644 --- a/tests/unit/helpers/AppTest.php +++ b/tests/unit/helpers/AppTest.php @@ -1,4 +1,5 @@ assertSame([0 => 1, 1 => 2, 4 => null, 5 => 5], ArrayHelper::filterEmptyStringsFromArray([0 => 1, 1 => 2, 3 => '', 4 => null, 5=> 5])); + $this->assertSame([0 => 1, 1 => 2, 4 => null, 5 => 5], ArrayHelper::filterEmptyStringsFromArray([0 => 1, 1 => 2, 3 => '', 4 => null, 5 => 5])); } public function testFirstKey()