diff --git a/phpcs.xml.dist b/phpcs.xml.dist index b2ed50871..cb2fc02dc 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -18,13 +18,19 @@ + + + + + + - + */SSTemplateParser.php$ - */_fakewebroot/* - */fixtures/* + */_fakewebroot/* + */fixtures/* diff --git a/src/Control/HTTP.php b/src/Control/HTTP.php index 14225ec22..08531c38b 100644 --- a/src/Control/HTTP.php +++ b/src/Control/HTTP.php @@ -205,14 +205,14 @@ class HTTP } $host = (isset($parts['host'])) ? $parts['host'] : ''; - $port = (isset($parts['port']) && $parts['port'] != '') ? ':'.$parts['port'] : ''; + $port = (isset($parts['port']) && $parts['port'] != '') ? ':' . $parts['port'] : ''; $path = (isset($parts['path']) && $parts['path'] != '') ? $parts['path'] : ''; // handle URL params which are existing / new $params = ($params) ? '?' . http_build_query($params, null, $separator) : ''; // keep fragments (anchors) intact. - $fragment = (isset($parts['fragment']) && $parts['fragment'] != '') ? '#'.$parts['fragment'] : ''; + $fragment = (isset($parts['fragment']) && $parts['fragment'] != '') ? '#' . $parts['fragment'] : ''; // Recompile URI segments $newUri = $scheme . '://' . $user . $host . $port . $path . $params . $fragment; @@ -465,7 +465,7 @@ class HTTP } elseif ((is_bool($value) && $value) || $value === "true") { $cacheControlHeaders[$header] = $header; } else { - $cacheControlHeaders[$header] = $header."=".$value; + $cacheControlHeaders[$header] = $header . "=" . $value; } } diff --git a/src/Control/RSS/RSSFeed.php b/src/Control/RSS/RSSFeed.php index 3fe5f586e..e6806129e 100644 --- a/src/Control/RSS/RSSFeed.php +++ b/src/Control/RSS/RSSFeed.php @@ -157,8 +157,7 @@ class RSSFeed extends ViewableData { $title = Convert::raw2xml($title); Requirements::insertHeadTags( - '' + '' ); } diff --git a/src/Control/RSS/RSSFeed_Entry.php b/src/Control/RSS/RSSFeed_Entry.php index f2d733b09..2ae7099c2 100644 --- a/src/Control/RSS/RSSFeed_Entry.php +++ b/src/Control/RSS/RSSFeed_Entry.php @@ -130,9 +130,7 @@ class RSSFeed_Entry extends ViewableData } throw new BadMethodCallException( - get_class($this->failover) . - " object has neither an AbsoluteLink nor a Link method." . - " Can't put a link in the RSS feed", + get_class($this->failover) . " object has neither an AbsoluteLink nor a Link method." . " Can't put a link in the RSS feed", E_USER_WARNING ); } diff --git a/src/Control/RequestHandler.php b/src/Control/RequestHandler.php index 14c06ff53..a8f1cfa69 100644 --- a/src/Control/RequestHandler.php +++ b/src/Control/RequestHandler.php @@ -189,7 +189,7 @@ class RequestHandler extends ViewableData user_error("Non-string method name: " . var_export($action, true), E_USER_ERROR); } - $classMessage = Director::isLive() ? 'on this handler' : 'on class '.static::class; + $classMessage = Director::isLive() ? 'on this handler' : 'on class ' . static::class; try { if (!$this->hasAction($action)) { @@ -266,8 +266,7 @@ class RequestHandler extends ViewableData $class = static::class; $latestParams = var_export($request->latestParams(), true); Debug::message( - "Rule '{$rule}' matched to action '{$action}' on {$class}. ". - "Latest request params: {$latestParams}" + "Rule '{$rule}' matched to action '{$action}' on {$class}. " . "Latest request params: {$latestParams}" ); } @@ -306,7 +305,7 @@ class RequestHandler extends ViewableData */ protected function handleAction($request, $action) { - $classMessage = Director::isLive() ? 'on this handler' : 'on class '.static::class; + $classMessage = Director::isLive() ? 'on this handler' : 'on class ' . static::class; if (!$this->hasMethod($action)) { return new HTTPResponse("Action '$action' isn't available $classMessage.", 404); @@ -566,8 +565,7 @@ class RequestHandler extends ViewableData // no link defined by default trigger_error( - 'Request handler '.static::class. ' does not have a url_segment defined. '. - 'Relying on this link may be an application error', + 'Request handler ' . static::class . ' does not have a url_segment defined. ' . 'Relying on this link may be an application error', E_USER_WARNING ); return null; diff --git a/src/Control/RequestProcessor.php b/src/Control/RequestProcessor.php index c8f8a006a..3a1d4f646 100644 --- a/src/Control/RequestProcessor.php +++ b/src/Control/RequestProcessor.php @@ -59,7 +59,7 @@ class RequestProcessor implements HTTPMiddleware foreach ($this->filters as $filter) { $res = $filter->preRequest($request); if ($res === false) { - return new HTTPResponse(_t(__CLASS__.'.INVALID_REQUEST', 'Invalid request'), 400); + return new HTTPResponse(_t(__CLASS__ . '.INVALID_REQUEST', 'Invalid request'), 400); } } diff --git a/src/Core/Extensible.php b/src/Core/Extensible.php index 8dc523bf5..da338e204 100644 --- a/src/Core/Extensible.php +++ b/src/Core/Extensible.php @@ -251,7 +251,7 @@ trait Extensible foreach ($config as $key => $candidate) { // extensions with parameters will be stored in config as ExtensionName("Param"). if (strcasecmp($candidate, $extension) === 0 || - stripos($candidate, $extension.'(') === 0 + stripos($candidate, $extension . '(') === 0 ) { $found = true; unset($config[$key]); diff --git a/src/Core/Injector/Injector.php b/src/Core/Injector/Injector.php index 0b77d82d0..bf5fc8b54 100644 --- a/src/Core/Injector/Injector.php +++ b/src/Core/Injector/Injector.php @@ -789,8 +789,8 @@ class Injector implements ContainerInterface */ protected function setObjectProperty($object, $name, $value) { - if (ClassInfo::hasMethod($object, 'set'.$name)) { - $object->{'set'.$name}($value); + if (ClassInfo::hasMethod($object, 'set' . $name)) { + $object->{'set' . $name}($value); } else { $object->$name = $value; } diff --git a/src/Core/Manifest/VersionProvider.php b/src/Core/Manifest/VersionProvider.php index ccc12f97a..c2f307931 100644 --- a/src/Core/Manifest/VersionProvider.php +++ b/src/Core/Manifest/VersionProvider.php @@ -37,7 +37,7 @@ class VersionProvider foreach ($modules as $module => $title) { $version = isset($lockModules[$module]) ? $lockModules[$module] - : _t(__CLASS__.'.VERSIONUNKNOWN', 'Unknown'); + : _t(__CLASS__ . '.VERSIONUNKNOWN', 'Unknown'); $output[] = $title . ': ' . $version; } return implode(', ', $output); diff --git a/src/Core/Startup/ErrorControlChainMiddleware.php b/src/Core/Startup/ErrorControlChainMiddleware.php index 6c782e135..bdb5ff0a3 100644 --- a/src/Core/Startup/ErrorControlChainMiddleware.php +++ b/src/Core/Startup/ErrorControlChainMiddleware.php @@ -98,7 +98,7 @@ class ErrorControlChainMiddleware implements HTTPMiddleware // Fail and redirect the user to the login page $params = array_merge($request->getVars(), $reloadToken->params(false)); - $backURL = $request->getURL(). '?' . http_build_query($params); + $backURL = $request->getURL() . '?' . http_build_query($params); $loginPage = Director::absoluteURL(Security::config()->get('login_url')); $loginPage .= "?BackURL=" . urlencode($backURL); $result = new HTTPResponse(); diff --git a/src/Core/Startup/ParameterConfirmationToken.php b/src/Core/Startup/ParameterConfirmationToken.php index 642812c3b..a5069102c 100644 --- a/src/Core/Startup/ParameterConfirmationToken.php +++ b/src/Core/Startup/ParameterConfirmationToken.php @@ -56,7 +56,7 @@ class ParameterConfirmationToken protected function pathForToken($token) { - return TEMP_PATH . DIRECTORY_SEPARATOR . 'token_'.preg_replace('/[^a-z0-9]+/', '', $token); + return TEMP_PATH . DIRECTORY_SEPARATOR . 'token_' . preg_replace('/[^a-z0-9]+/', '', $token); } /** @@ -116,7 +116,7 @@ class ParameterConfirmationToken $this->parameterBackURL = $this->backURLToken($request); // If the token provided is valid, mark it as such - $token = $request->getVar($parameterName.'token'); + $token = $request->getVar($parameterName . 'token'); if ($this->checkToken($token)) { $this->token = $token; } diff --git a/src/Core/TempFolder.php b/src/Core/TempFolder.php index 87846459c..6efd43057 100644 --- a/src/Core/TempFolder.php +++ b/src/Core/TempFolder.php @@ -76,9 +76,7 @@ class TempFolder } // failing the above, try finding a namespaced silverstripe-cache dir in the system temp - $tempPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . - 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION) . - str_replace(array(' ', '/', ':', '\\'), '-', $base); + $tempPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION) . str_replace(array(' ', '/', ':', '\\'), '-', $base); if (!@file_exists($tempPath)) { $oldUMask = umask(0); @mkdir($tempPath, 0777); @@ -107,9 +105,7 @@ class TempFolder if (!$worked) { throw new Exception( - 'Permission problem gaining access to a temp folder. ' . - 'Please create a folder named silverstripe-cache in the base folder ' . - 'of the installation and ensure it has the correct permissions' + 'Permission problem gaining access to a temp folder. ' . 'Please create a folder named silverstripe-cache in the base folder ' . 'of the installation and ensure it has the correct permissions' ); } diff --git a/src/Dev/Backtrace.php b/src/Dev/Backtrace.php index 6eaeac55d..756945c52 100644 --- a/src/Dev/Backtrace.php +++ b/src/Dev/Backtrace.php @@ -178,7 +178,7 @@ class Backtrace } } - $funcName .= "(" . implode(", ", $args) .")"; + $funcName .= "(" . implode(", ", $args) . ")"; } return $funcName; diff --git a/src/Dev/CSVParser.php b/src/Dev/CSVParser.php index b16333445..987d01a22 100644 --- a/src/Dev/CSVParser.php +++ b/src/Dev/CSVParser.php @@ -256,7 +256,7 @@ class CSVParser implements Iterator foreach ($srcRow as $i => $value) { // Allow escaping of quotes and commas in the data $value = str_replace( - array('\\'.$this->enclosure,'\\'.$this->delimiter), + array('\\' . $this->enclosure,'\\' . $this->delimiter), array($this->enclosure, $this->delimiter), $value ); diff --git a/src/Dev/CliDebugView.php b/src/Dev/CliDebugView.php index fbb41b3b1..86c87422f 100644 --- a/src/Dev/CliDebugView.php +++ b/src/Dev/CliDebugView.php @@ -119,7 +119,7 @@ class CliDebugView extends DebugView $output .= CLI::text(str_repeat('=', self::config()->columns), 'green'); $output .= PHP_EOL; $output .= CLI::text($this->formatCaller($caller), 'blue', null, true); - $output .= PHP_EOL.PHP_EOL; + $output .= PHP_EOL . PHP_EOL; if (is_string($val)) { $output .= wordwrap($val, self::config()->columns); } else { diff --git a/src/Dev/DebugView.php b/src/Dev/DebugView.php index 9dc12644a..b08586c8c 100644 --- a/src/Dev/DebugView.php +++ b/src/Dev/DebugView.php @@ -222,7 +222,7 @@ class DebugView $debugCSS = ModuleResourceLoader::singleton() ->resolveURL('silverstripe/framework:client/styles/debug.css'); $output = '' . $url . ''; - $output .= ''; + $output .= ''; $output .= ''; $output .= ''; @@ -367,7 +367,7 @@ class DebugView public function renderVariable($val, $caller) { $output = '
';
-        $output .= "" . $this->formatCaller($caller). " - \n";
+        $output .= "" . $this->formatCaller($caller) . " - \n";
         if (is_string($val)) {
             $output .= wordwrap($val, self::config()->columns);
         } else {
diff --git a/src/Dev/Deprecation.php b/src/Dev/Deprecation.php
index c7389defc..dd96d4b15 100644
--- a/src/Dev/Deprecation.php
+++ b/src/Dev/Deprecation.php
@@ -234,7 +234,7 @@ class Deprecation
             $string .= " Called from " . self::get_called_method_from_trace($backtrace, 2) . '.';
 
             if ($caller) {
-                user_error($caller.' is deprecated.'.($string ? ' '.$string : ''), $level);
+                user_error($caller . ' is deprecated.' . ($string ? ' ' . $string : ''), $level);
             } else {
                 user_error($string, $level);
             }
diff --git a/src/Dev/DevelopmentAdmin.php b/src/Dev/DevelopmentAdmin.php
index 99741822b..267d3386a 100644
--- a/src/Dev/DevelopmentAdmin.php
+++ b/src/Dev/DevelopmentAdmin.php
@@ -127,7 +127,7 @@ class DevelopmentAdmin extends Controller
             return $controllerClass::create();
         }
 
-        $msg = 'Error: no controller registered in '.__CLASS__.' for: '.$request->param('Action');
+        $msg = 'Error: no controller registered in ' . __CLASS__ . ' for: ' . $request->param('Action');
         if (Director::is_cli()) {
             // in CLI we cant use httpError because of a bug with stuff being in the output already, see DevAdminControllerTest
             throw new Exception($msg);
diff --git a/src/Dev/FixtureBlueprint.php b/src/Dev/FixtureBlueprint.php
index 99592a4d0..9d219a36f 100644
--- a/src/Dev/FixtureBlueprint.php
+++ b/src/Dev/FixtureBlueprint.php
@@ -44,7 +44,7 @@ class FixtureBlueprint
 
     /** @config */
     private static $dependencies = array(
-        'factory' => '%$'.FixtureFactory::class,
+        'factory' => '%$' . FixtureFactory::class,
     );
 
     /**
@@ -221,10 +221,10 @@ class FixtureBlueprint
                     } else {
                         $hasOneField = preg_replace('/ID$/', '', $fieldName);
                         if ($className = $schema->hasOneComponent($class, $hasOneField)) {
-                            $obj->{$hasOneField.'ID'} = $this->parseValue($fieldVal, $fixtures, $fieldClass);
+                            $obj->{$hasOneField . 'ID'} = $this->parseValue($fieldVal, $fixtures, $fieldClass);
                             // Inject class for polymorphic relation
                             if ($className === 'SilverStripe\\ORM\\DataObject') {
-                                $obj->{$hasOneField.'Class'} = $fieldClass;
+                                $obj->{$hasOneField . 'Class'} = $fieldClass;
                             }
                         }
                     }
diff --git a/src/Dev/Install/Installer.php b/src/Dev/Install/Installer.php
index 55e61adeb..742922f2f 100644
--- a/src/Dev/Install/Installer.php
+++ b/src/Dev/Install/Installer.php
@@ -282,7 +282,7 @@ PHP;
         ];
         ksort($vars);
         foreach ($vars as $key => $value) {
-            $lines[] = $key.'="'.addcslashes($value, '"').'"';
+            $lines[] = $key . '="' . addcslashes($value, '"') . '"';
         }
 
         $this->writeToFile('.env', implode("\n", $lines));
diff --git a/src/Dev/Install/MySQLDatabaseConfigurationHelper.php b/src/Dev/Install/MySQLDatabaseConfigurationHelper.php
index 000eb9b70..a0a4cb10d 100644
--- a/src/Dev/Install/MySQLDatabaseConfigurationHelper.php
+++ b/src/Dev/Install/MySQLDatabaseConfigurationHelper.php
@@ -88,7 +88,7 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
                     }
 
                     $conn = @new PDO(
-                        'mysql:host='.$databaseConfig['server'],
+                        'mysql:host=' . $databaseConfig['server'],
                         $databaseConfig['username'],
                         $databaseConfig['password'],
                         $ssl
@@ -247,8 +247,7 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
             preg_quote('"%".*'),
             preg_quote('*.*')
         );
-        $expression = '/GRANT[ ,\w]+((ALL PRIVILEGES)|('.$permission.'(?! ((VIEW)|(ROUTINE)))))[ ,\w]+ON '.
-            $dbPattern.'/i';
+        $expression = '/GRANT[ ,\w]+((ALL PRIVILEGES)|(' . $permission . '(?! ((VIEW)|(ROUTINE)))))[ ,\w]+ON ' . $dbPattern . '/i';
         return preg_match($expression, $grant);
     }
 
diff --git a/src/Dev/SapphireREPL.php b/src/Dev/SapphireREPL.php
index 33e7cd3dd..5b181fcb5 100644
--- a/src/Dev/SapphireREPL.php
+++ b/src/Dev/SapphireREPL.php
@@ -97,7 +97,7 @@ class SapphireREPL extends Controller
                 } catch (Exception $__repl_exception) {
                     echo CLI::start_colour("red");
                     printf(
-                        '%s (code: %d) got thrown'.PHP_EOL,
+                        '%s (code: %d) got thrown' . PHP_EOL,
                         get_class($__repl_exception),
                         $__repl_exception->getCode()
                     );
diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php
index f32c57d6c..55f1d78c3 100644
--- a/src/Dev/SapphireTest.php
+++ b/src/Dev/SapphireTest.php
@@ -1114,7 +1114,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly
             $themeBaseDir = substr($themeBaseDir, strlen(BASE_PATH));
         }
         SSViewer::config()->update('theme_enabled', true);
-        SSViewer::set_themes([$themeBaseDir.'/themes/'.$theme, '$default']);
+        SSViewer::set_themes([$themeBaseDir . '/themes/' . $theme, '$default']);
 
         try {
             $callback();
diff --git a/src/Dev/YamlFixture.php b/src/Dev/YamlFixture.php
index 1ae95dafc..e22b1686f 100644
--- a/src/Dev/YamlFixture.php
+++ b/src/Dev/YamlFixture.php
@@ -95,7 +95,7 @@ class YamlFixture
             $this->fixtureString = $fixture;
         } else {
             if (!Director::is_absolute($fixture)) {
-                $fixture = Director::baseFolder().'/'. $fixture;
+                $fixture = Director::baseFolder() . '/' . $fixture;
             }
 
             if (!file_exists($fixture)) {
diff --git a/src/Forms/CurrencyField.php b/src/Forms/CurrencyField.php
index da1959456..80bf1a51e 100644
--- a/src/Forms/CurrencyField.php
+++ b/src/Forms/CurrencyField.php
@@ -60,7 +60,7 @@ class CurrencyField extends TextField
     public function validate($validator)
     {
         $currencySymbol = preg_quote(DBCurrency::config()->uninherited('currency_symbol'));
-        $regex = '/^\s*(\-?'.$currencySymbol.'?|'.$currencySymbol.'\-?)?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?\s*$/';
+        $regex = '/^\s*(\-?' . $currencySymbol . '?|' . $currencySymbol . '\-?)?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?\s*$/';
         if (!empty($this->value) && !preg_match($regex, $this->value)) {
             $validator->validationError(
                 $this->name,
diff --git a/src/Forms/DatetimeField.php b/src/Forms/DatetimeField.php
index 324b5fda3..16c94db8b 100644
--- a/src/Forms/DatetimeField.php
+++ b/src/Forms/DatetimeField.php
@@ -572,7 +572,7 @@ class DatetimeField extends TextField
             $validator->validationError(
                 $this->name,
                 _t(
-                    __CLASS__.'.VALIDDATETIMEFORMAT',
+                    __CLASS__ . '.VALIDDATETIMEFORMAT',
                     "Please enter a valid date and time format ({format})",
                     ['format' => $this->getDatetimeFormat()]
                 )
@@ -588,7 +588,7 @@ class DatetimeField extends TextField
                 $validator->validationError(
                     $this->name,
                     _t(
-                        __CLASS__.'.VALIDDATETIMEMINDATE',
+                        __CLASS__ . '.VALIDDATETIMEMINDATE',
                         "Your date has to be newer or matching the minimum allowed date and time ({datetime})",
                         [
                             'datetime' => sprintf(
@@ -613,7 +613,7 @@ class DatetimeField extends TextField
                 $validator->validationError(
                     $this->name,
                     _t(
-                        __CLASS__.'.VALIDDATEMAXDATETIME',
+                        __CLASS__ . '.VALIDDATEMAXDATETIME',
                         "Your date has to be older or matching the maximum allowed date and time ({datetime})",
                         [
                             'datetime' => sprintf(
diff --git a/src/Forms/Form.php b/src/Forms/Form.php
index 0da09cbd6..9acef4df5 100644
--- a/src/Forms/Form.php
+++ b/src/Forms/Form.php
@@ -1771,7 +1771,7 @@ class Form extends ViewableData implements HasRequestHandler
 
         if ($this->validator) {
             /** @skipUpgrade */
-            $result .= '

'._t(__CLASS__.'.VALIDATOR', 'Validator').'

' . $this->validator->debug(); + $result .= '

' . _t(__CLASS__ . '.VALIDATOR', 'Validator') . '

' . $this->validator->debug(); } return $result; diff --git a/src/Forms/FormRequestHandler.php b/src/Forms/FormRequestHandler.php index b0b019d23..0244a11f5 100644 --- a/src/Forms/FormRequestHandler.php +++ b/src/Forms/FormRequestHandler.php @@ -144,8 +144,7 @@ class FormRequestHandler extends RequestHandler if (empty($vars[$securityID])) { $this->httpError(400, _t( "SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE", - "There seems to have been a technical problem. Please click the back button, ". - "refresh your browser, and try again." + "There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again." )); } else { // Clear invalid token on refresh @@ -258,8 +257,7 @@ class FormRequestHandler extends RequestHandler $legacyActions = $this->form->config()->get('allowed_actions'); if ($legacyActions) { throw new BadMethodCallException( - "allowed_actions are not valid on Form class " . get_class($this->form) . - ". Implement these in subclasses of " . static::class . " instead" + "allowed_actions are not valid on Form class " . get_class($this->form) . ". Implement these in subclasses of " . static::class . " instead" ); } diff --git a/src/Forms/FormScaffolder.php b/src/Forms/FormScaffolder.php index d2d804da4..c355e13a4 100644 --- a/src/Forms/FormScaffolder.php +++ b/src/Forms/FormScaffolder.php @@ -77,7 +77,7 @@ class FormScaffolder // tabbed or untabbed if ($this->tabbed) { $fields->push(new TabSet("Root", $mainTab = new Tab("Main"))); - $mainTab->setTitle(_t(__CLASS__.'.TABMAIN', 'Main')); + $mainTab->setTitle(_t(__CLASS__ . '.TABMAIN', 'Main')); } // Add logical fields directly specified in db config diff --git a/src/Forms/GridField/GridField.php b/src/Forms/GridField/GridField.php index ebaeb6be7..b66dc274e 100644 --- a/src/Forms/GridField/GridField.php +++ b/src/Forms/GridField/GridField.php @@ -897,8 +897,7 @@ class GridField extends FormField if (!$token->checkRequest($request)) { $this->httpError(400, _t( "SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE", - "There seems to have been a technical problem. Please click the back button, ". - "refresh your browser, and try again." + "There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again." )); } diff --git a/src/Forms/GridField/GridFieldDeleteAction.php b/src/Forms/GridField/GridFieldDeleteAction.php index 79331b96f..eced99c02 100644 --- a/src/Forms/GridField/GridFieldDeleteAction.php +++ b/src/Forms/GridField/GridFieldDeleteAction.php @@ -119,11 +119,11 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio if (!$record->canEdit()) { return null; } - $title = _t(__CLASS__.'.UnlinkRelation', "Unlink"); + $title = _t(__CLASS__ . '.UnlinkRelation', "Unlink"); $field = GridField_FormAction::create( $gridField, - 'UnlinkRelation'.$record->ID, + 'UnlinkRelation' . $record->ID, false, "unlinkrelation", array('RecordID' => $record->ID) @@ -138,14 +138,14 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio $field = GridField_FormAction::create( $gridField, - 'DeleteRecord'.$record->ID, + 'DeleteRecord' . $record->ID, false, "deleterecord", array('RecordID' => $record->ID) ) ->addExtraClass('gridfield-button-delete btn--icon-md font-icon-trash-bin btn--no-text grid-field__icon-action') - ->setAttribute('title', _t(__CLASS__.'.Delete', "Delete")) - ->setDescription(_t(__CLASS__.'.DELETE_DESCRIPTION', 'Delete')); + ->setAttribute('title', _t(__CLASS__ . '.Delete', "Delete")) + ->setDescription(_t(__CLASS__ . '.DELETE_DESCRIPTION', 'Delete')); } return $field->Field(); } @@ -171,7 +171,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio if ($actionName == 'deleterecord') { if (!$item->canDelete()) { throw new ValidationException( - _t(__CLASS__.'.DeletePermissionsFailure', "No delete permissions") + _t(__CLASS__ . '.DeletePermissionsFailure', "No delete permissions") ); } @@ -179,7 +179,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio } else { if (!$item->canEdit()) { throw new ValidationException( - _t(__CLASS__.'.EditPermissionsFailure', "No permission to unlink record") + _t(__CLASS__ . '.EditPermissionsFailure', "No permission to unlink record") ); } diff --git a/src/Forms/GridField/GridFieldFilterHeader.php b/src/Forms/GridField/GridFieldFilterHeader.php index 9416b3e98..b44ec9df6 100755 --- a/src/Forms/GridField/GridFieldFilterHeader.php +++ b/src/Forms/GridField/GridFieldFilterHeader.php @@ -128,7 +128,7 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan $dataListClone = clone($dataList); foreach ($filterArguments as $columnName => $value) { if ($dataList->canFilterBy($columnName) && $value) { - $dataListClone = $dataListClone->filter($columnName.':PartialMatch', $value); + $dataListClone = $dataListClone->filter($columnName . ':PartialMatch', $value); } } return $dataListClone; @@ -196,7 +196,7 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan $field->setAttribute( 'placeholder', - _t('SilverStripe\\Forms\\GridField\\GridField.FilterBy', "Filter by ") . _t('SilverStripe\\Forms\\GridField\\GridField.'.$metadata['title'], $metadata['title']) + _t('SilverStripe\\Forms\\GridField\\GridField.FilterBy', "Filter by ") . _t('SilverStripe\\Forms\\GridField\\GridField.' . $metadata['title'], $metadata['title']) ); $fields->push($field); diff --git a/src/Forms/GridField/GridFieldPageCount.php b/src/Forms/GridField/GridFieldPageCount.php index e080edbc6..8d3ff47cd 100755 --- a/src/Forms/GridField/GridFieldPageCount.php +++ b/src/Forms/GridField/GridFieldPageCount.php @@ -51,8 +51,7 @@ class GridFieldPageCount implements GridField_HTMLProvider if (!$paginator && GridFieldPageCount::config()->uninherited('require_paginator')) { throw new LogicException( - static::class . " relies on a GridFieldPaginator to be added " . - "to the same GridField, but none are present." + static::class . " relies on a GridFieldPaginator to be added " . "to the same GridField, but none are present." ); } diff --git a/src/Forms/GridField/GridFieldPrintButton.php b/src/Forms/GridField/GridFieldPrintButton.php index 40ec100dc..758de42c6 100644 --- a/src/Forms/GridField/GridFieldPrintButton.php +++ b/src/Forms/GridField/GridFieldPrintButton.php @@ -133,7 +133,7 @@ class GridFieldPrintButton implements GridField_HTMLProvider, GridField_ActionPr $this->extend('updatePrintData', $data); if ($data) { - return $data->renderWith(get_class($gridField)."_print"); + return $data->renderWith(get_class($gridField) . "_print"); } return null; diff --git a/src/Forms/GridField/GridFieldSortableHeader.php b/src/Forms/GridField/GridFieldSortableHeader.php index f4eb9344b..6d84784d2 100644 --- a/src/Forms/GridField/GridFieldSortableHeader.php +++ b/src/Forms/GridField/GridFieldSortableHeader.php @@ -171,7 +171,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM $field = GridField_FormAction::create( $gridField, - 'SetOrder'.$fieldName, + 'SetOrder' . $fieldName, $title, "sort$dir", array('SortColumn' => $columnField) diff --git a/src/Forms/GridField/GridFieldVersionedState.php b/src/Forms/GridField/GridFieldVersionedState.php index d668cf9b5..ba0abb605 100644 --- a/src/Forms/GridField/GridFieldVersionedState.php +++ b/src/Forms/GridField/GridFieldVersionedState.php @@ -149,23 +149,23 @@ class GridFieldVersionedState implements GridField_ColumnProvider if ($record->isOnLiveOnly()) { $flags['removedfromdraft'] = array( - 'text' => _t(__CLASS__.'.ONLIVEONLYSHORT', 'On live only'), - 'title' => _t(__CLASS__.'.ONLIVEONLYSHORTHELP', 'Item is published, but has been deleted from draft'), + 'text' => _t(__CLASS__ . '.ONLIVEONLYSHORT', 'On live only'), + 'title' => _t(__CLASS__ . '.ONLIVEONLYSHORTHELP', 'Item is published, but has been deleted from draft'), ); } elseif ($record->isArchived()) { $flags['archived'] = array( - 'text' => _t(__CLASS__.'.ARCHIVEDPAGESHORT', 'Archived'), - 'title' => _t(__CLASS__.'.ARCHIVEDPAGEHELP', 'Item is removed from draft and live'), + 'text' => _t(__CLASS__ . '.ARCHIVEDPAGESHORT', 'Archived'), + 'title' => _t(__CLASS__ . '.ARCHIVEDPAGEHELP', 'Item is removed from draft and live'), ); } elseif ($record->isOnDraftOnly()) { $flags['addedtodraft'] = array( - 'text' => _t(__CLASS__.'.ADDEDTODRAFTSHORT', 'Draft'), - 'title' => _t(__CLASS__.'.ADDEDTODRAFTHELP', "Item has not been published yet") + 'text' => _t(__CLASS__ . '.ADDEDTODRAFTSHORT', 'Draft'), + 'title' => _t(__CLASS__ . '.ADDEDTODRAFTHELP', "Item has not been published yet") ); } elseif ($record->isModifiedOnDraft()) { $flags['modified'] = array( - 'text' => _t(__CLASS__.'.MODIFIEDONDRAFTSHORT', 'Modified'), - 'title' => _t(__CLASS__.'.MODIFIEDONDRAFTHELP', 'Item has unpublished changes'), + 'text' => _t(__CLASS__ . '.MODIFIEDONDRAFTSHORT', 'Modified'), + 'title' => _t(__CLASS__ . '.MODIFIEDONDRAFTHELP', 'Item has unpublished changes'), ); } diff --git a/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php b/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php index 8ffd14ffb..f2f3a3b09 100644 --- a/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php +++ b/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php @@ -168,8 +168,7 @@ SCRIPT; // Join list of paths $filesList = Convert::raw2js(implode(',', $fileURLS)); // Mark all themes, plugins and languages as done - $buffer[] = "window.tinymce.each('$filesList'.split(',')," . - "function(f){tinymce.ScriptLoader.markDone(baseURL+f);});"; + $buffer[] = "window.tinymce.each('$filesList'.split(',')," . "function(f){tinymce.ScriptLoader.markDone(baseURL+f);});"; $buffer[] = '})();'; return implode("\n", $buffer) . "\n"; diff --git a/src/Forms/LookupField.php b/src/Forms/LookupField.php index e618c9aa1..1e1bdbee7 100644 --- a/src/Forms/LookupField.php +++ b/src/Forms/LookupField.php @@ -54,7 +54,7 @@ class LookupField extends MultiSelectField $attrValue = implode(', ', array_values($mapped)); $inputValue = implode(', ', array_values($values)); } else { - $attrValue = '('._t('SilverStripe\\Forms\\FormField.NONE', 'none').')'; + $attrValue = '(' . _t('SilverStripe\\Forms\\FormField.NONE', 'none') . ')'; $inputValue = ''; } diff --git a/src/Forms/MoneyField.php b/src/Forms/MoneyField.php index 4e392b63f..b3ca9f366 100644 --- a/src/Forms/MoneyField.php +++ b/src/Forms/MoneyField.php @@ -330,7 +330,7 @@ class MoneyField extends FormField $validator->validationError( $this->getName(), _t( - __CLASS__.'.INVALID_CURRENCY', + __CLASS__ . '.INVALID_CURRENCY', 'Currency {currency} is not in the list of allowed currencies', ['currency' => $currency] ) diff --git a/src/Forms/NumericField.php b/src/Forms/NumericField.php index d26d5147e..65392a954 100644 --- a/src/Forms/NumericField.php +++ b/src/Forms/NumericField.php @@ -290,7 +290,7 @@ class NumericField extends TextField if ($scale === 0) { return '1'; } - return '0.'.str_repeat('0', $scale - 1).'1'; + return '0.' . str_repeat('0', $scale - 1) . '1'; } /** diff --git a/src/Forms/TreeDropdownField.php b/src/Forms/TreeDropdownField.php index 01ff04b4f..02c5f1f88 100644 --- a/src/Forms/TreeDropdownField.php +++ b/src/Forms/TreeDropdownField.php @@ -700,7 +700,7 @@ class TreeDropdownField extends FormField $grandChildren = $child['children']; $contextString = implode('/', $parentTitles); - $child['contextString'] = ($contextString !== '') ? $contextString .'/' : ''; + $child['contextString'] = ($contextString !== '') ? $contextString . '/' : ''; unset($child['children']); if (!$this->search || in_array($child['id'], $this->realSearchIds)) { @@ -847,7 +847,7 @@ class TreeDropdownField extends FormField foreach ($ancestors as $parent) { $title = $parent->obj($this->getTitleField())->getValue(); - $titlePath .= $title .'/'; + $titlePath .= $title . '/'; } } $data['data']['valueObject'] = [ diff --git a/src/Forms/TreeMultiselectField.php b/src/Forms/TreeMultiselectField.php index 2c2888b1e..72de4dc11 100644 --- a/src/Forms/TreeMultiselectField.php +++ b/src/Forms/TreeMultiselectField.php @@ -191,7 +191,7 @@ class TreeMultiselectField extends TreeDropdownField if ($this->form) { $dataUrlTree = $this->Link('tree'); if (!empty($idArray)) { - $dataUrlTree = Controller::join_links($dataUrlTree, '?forceValue='.implode(',', $idArray)); + $dataUrlTree = Controller::join_links($dataUrlTree, '?forceValue=' . implode(',', $idArray)); } } $properties = array_merge( diff --git a/src/ORM/Connect/DBQueryBuilder.php b/src/ORM/Connect/DBQueryBuilder.php index cae101f0a..12f112075 100644 --- a/src/ORM/Connect/DBQueryBuilder.php +++ b/src/ORM/Connect/DBQueryBuilder.php @@ -357,7 +357,7 @@ class DBQueryBuilder // Assert that the array version provides the 'limit' key if (!isset($limit['limit']) || !is_numeric($limit['limit'])) { throw new InvalidArgumentException( - 'DBQueryBuilder::buildLimitSQL(): Wrong format for $limit: '. var_export($limit, true) + 'DBQueryBuilder::buildLimitSQL(): Wrong format for $limit: ' . var_export($limit, true) ); } diff --git a/src/ORM/Connect/Database.php b/src/ORM/Connect/Database.php index 45d8b6c86..3e2910522 100644 --- a/src/ORM/Connect/Database.php +++ b/src/ORM/Connect/Database.php @@ -285,7 +285,7 @@ abstract class Database } // Implode quoted column - return '"' . implode('"'.$separator.'"', $value) . '"'; + return '"' . implode('"' . $separator . '"', $value) . '"'; } /** diff --git a/src/ORM/Connect/MySQLQueryBuilder.php b/src/ORM/Connect/MySQLQueryBuilder.php index 50cf26ffa..da7791c13 100644 --- a/src/ORM/Connect/MySQLQueryBuilder.php +++ b/src/ORM/Connect/MySQLQueryBuilder.php @@ -42,7 +42,7 @@ class MySQLQueryBuilder extends DBQueryBuilder // Assert that the array version provides the 'limit' key if (!array_key_exists('limit', $limit) || ($limit['limit'] !== null && ! is_numeric($limit['limit']))) { throw new InvalidArgumentException( - 'MySQLQueryBuilder::buildLimitSQL(): Wrong format for $limit: '. var_export($limit, true) + 'MySQLQueryBuilder::buildLimitSQL(): Wrong format for $limit: ' . var_export($limit, true) ); } diff --git a/src/ORM/Connect/PDOConnector.php b/src/ORM/Connect/PDOConnector.php index 7b3902251..ca4cf309f 100644 --- a/src/ORM/Connect/PDOConnector.php +++ b/src/ORM/Connect/PDOConnector.php @@ -199,7 +199,7 @@ class PDOConnector extends DBConnector // May throw a PDOException if fails $this->pdoConnection = new PDO( - $driver.implode(';', $dsn), + $driver . implode(';', $dsn), empty($parameters['username']) ? '' : $parameters['username'], empty($parameters['password']) ? '' : $parameters['password'], $options diff --git a/src/ORM/DataList.php b/src/ORM/DataList.php index d55c77bc0..e5f95e943 100644 --- a/src/ORM/DataList.php +++ b/src/ORM/DataList.php @@ -517,7 +517,7 @@ class DataList extends ViewableData implements SS_List, Filterable, Sortable, Li // Simple fields without relations are mapped directly if (strpos($field, '.') === false) { - $columnName = '"'.$field.'"'; + $columnName = '"' . $field . '"'; return $this; } diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php index 465ad03c4..712156a18 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -321,7 +321,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity if (!is_array($record)) { if (is_object($record)) { - $passed = "an object of type '".get_class($record)."'"; + $passed = "an object of type '" . get_class($record) . "'"; } else { $passed = "The value '$record'"; } @@ -359,7 +359,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity foreach ($fields as $field => $fieldSpec) { $fieldClass = strtok($fieldSpec, "."); if (!array_key_exists($field, $record)) { - $this->record[$field.'_Lazy'] = $fieldClass; + $this->record[$field . '_Lazy'] = $fieldClass; } } } @@ -636,7 +636,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity { $default = 'one ' . $this->i18n_singular_name() . '|{count} ' . $this->i18n_plural_name(); return i18n::_t( - static::class.'.PLURALS', + static::class . '.PLURALS', $default, [ 'count' => $count ] ); @@ -675,7 +675,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity */ public function i18n_singular_name() { - return _t(static::class.'.SINGULARNAME', $this->singular_name()); + return _t(static::class . '.SINGULARNAME', $this->singular_name()); } /** @@ -710,7 +710,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity */ public function i18n_plural_name() { - return _t(static::class.'.PLURALNAME', $this->plural_name()); + return _t(static::class . '.PLURALNAME', $this->plural_name()); } /** @@ -809,7 +809,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity // If the intermediate relationship objects haven't been created, then write them if ($iID || (!$relObj->ID && $parentObj !== $this)) { $relObj->write(); - $relatedFieldName = $relation."ID"; + $relatedFieldName = $relation . "ID"; $parentObj->$relatedFieldName = $relObj->ID; $parentObj->write(); } @@ -828,7 +828,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity if ($relObj) { $relObj->$fieldName = $value; $relObj->write(); - $relatedFieldName = $relation."ID"; + $relatedFieldName = $relation . "ID"; $this->$relatedFieldName = $relObj->ID; $relObj->flushCache(); } else { @@ -1151,7 +1151,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity { if ($this->ObsoleteClassName) { return new ValidationException( - "Object is of class '{$this->ObsoleteClassName}' which doesn't exist - ". + "Object is of class '{$this->ObsoleteClassName}' which doesn't exist - " . "you need to change the ClassName before you can write it" ); } @@ -1281,7 +1281,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } // Perform an insert on the base table - $insert = new SQLInsert('"'.$baseTable.'"'); + $insert = new SQLInsert('"' . $baseTable . '"'); $insert ->assign('"Created"', $now) ->execute(); @@ -1565,8 +1565,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity if (empty($component)) { $component = Injector::inst()->create($class); if ($polymorphic) { - $component->{$joinField.'ID'} = $this->ID; - $component->{$joinField.'Class'} = static::class; + $component->{$joinField . 'ID'} = $this->ID; + $component->{$joinField . 'Class'} = static::class; } else { $component->$joinField = $this->ID; } @@ -2167,8 +2167,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } // Do we have a field that needs to be lazy loaded? - if (isset($this->record[$field.'_Lazy'])) { - $tableClass = $this->record[$field.'_Lazy']; + if (isset($this->record[$field . '_Lazy'])) { + $tableClass = $this->record[$field . '_Lazy']; $this->loadLazyFields($tableClass); } @@ -2368,8 +2368,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } // If we've just lazy-loaded the column, then we need to populate the $original array - if (isset($this->record[$fieldName.'_Lazy'])) { - $tableClass = $this->record[$fieldName.'_Lazy']; + if (isset($this->record[$fieldName . '_Lazy'])) { + $tableClass = $this->record[$fieldName . '_Lazy']; $this->loadLazyFields($tableClass); } @@ -2751,7 +2751,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity // Select db object $component = $dbObject; } else { - user_error("$relation is not a relation/field on ".get_class($component), E_USER_ERROR); + user_error("$relation is not a relation/field on " . get_class($component), E_USER_ERROR); } } } @@ -3659,9 +3659,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity $singularName = $this->singular_name(); $conjunction = preg_match('/^[aeiou]/i', $singularName) ? 'An ' : 'A '; return [ - static::class.'.SINGULARNAME' => $this->singular_name(), - static::class.'.PLURALNAME' => $pluralName, - static::class.'.PLURALS' => [ + static::class . '.SINGULARNAME' => $this->singular_name(), + static::class . '.PLURALNAME' => $pluralName, + static::class . '.PLURALS' => [ 'one' => $conjunction . $singularName, 'other' => '{count} ' . $pluralName ] diff --git a/src/ORM/DataQuery.php b/src/ORM/DataQuery.php index 9f5c15708..e403f90b3 100644 --- a/src/ORM/DataQuery.php +++ b/src/ORM/DataQuery.php @@ -324,7 +324,7 @@ class DataQuery $query->selectField( " CASE WHEN {$baseClassColumn} IS NOT NULL THEN {$baseClassColumn} - ELSE ".Convert::raw2sql($baseDataClass, true)." END", + ELSE " . Convert::raw2sql($baseDataClass, true) . " END", "RecordClassName" ); @@ -939,7 +939,7 @@ class DataQuery foreach ($ancestry as $ancestor) { $ancestorTable = $schema->tableName($ancestor); if ($ancestorTable !== $foreignTable) { - $ancestorTableAliased = $foreignPrefix.$ancestorTable; + $ancestorTableAliased = $foreignPrefix . $ancestorTable; $this->query->addLeftJoin( $ancestorTable, "\"{$foreignTableAliased}\".\"ID\" = \"{$ancestorTableAliased}\".\"ID\"", @@ -979,7 +979,7 @@ class DataQuery // Skip if already joined $foreignBaseClass = $schema->baseDataClass($foreignClass); $foreignBaseTable = $schema->tableName($foreignBaseClass); - if ($this->query->isJoinedTo($foreignPrefix.$foreignBaseTable)) { + if ($this->query->isJoinedTo($foreignPrefix . $foreignBaseTable)) { return; } @@ -989,7 +989,7 @@ class DataQuery $this->query->addLeftJoin( $foreignBaseTable, "{$foreignIDColumn} = {$localColumn}", - $foreignPrefix.$foreignBaseTable + $foreignPrefix . $foreignBaseTable ); // Add join clause to the component's ancestry classes so that the search filter could search on @@ -1000,7 +1000,7 @@ class DataQuery foreach ($ancestry as $ancestor) { $ancestorTable = $schema->tableName($ancestor); if ($ancestorTable !== $foreignBaseTable) { - $ancestorTableAliased = $foreignPrefix.$ancestorTable; + $ancestorTableAliased = $foreignPrefix . $ancestorTable; $this->query->addLeftJoin( $ancestorTable, "{$foreignIDColumn} = \"{$ancestorTableAliased}\".\"ID\"", @@ -1048,7 +1048,7 @@ class DataQuery } // Join parent class to join table - $relationAliasedTable = $componentPrefix.$relationClassOrTable; + $relationAliasedTable = $componentPrefix . $relationClassOrTable; $parentIDColumn = $schema->sqlColumnForField($parentClass, 'ID', $parentPrefix); $this->query->addLeftJoin( $relationClassOrTable, @@ -1071,7 +1071,7 @@ class DataQuery foreach ($ancestry as $ancestor) { $ancestorTable = $schema->tableName($ancestor); if ($ancestorTable !== $componentBaseTable) { - $ancestorTableAliased = $componentPrefix.$ancestorTable; + $ancestorTableAliased = $componentPrefix . $ancestorTable; $this->query->addLeftJoin( $ancestorTable, "{$componentIDColumn} = \"{$ancestorTableAliased}\".\"ID\"", @@ -1096,7 +1096,7 @@ class DataQuery $subSelect->selectField($fieldExpression, $field); $subSelect->setOrderBy(null); $subSelectSQL = $subSelect->sql($subSelectParameters); - $this->where(array($this->expressionForField($field)." NOT IN ($subSelectSQL)" => $subSelectParameters)); + $this->where(array($this->expressionForField($field) . " NOT IN ($subSelectSQL)" => $subSelectParameters)); return $this; } diff --git a/src/ORM/FieldType/DBComposite.php b/src/ORM/FieldType/DBComposite.php index d8ee65478..a938f242f 100644 --- a/src/ORM/FieldType/DBComposite.php +++ b/src/ORM/FieldType/DBComposite.php @@ -211,7 +211,7 @@ abstract class DBComposite extends DBField // Check bound object if ($this->record instanceof DataObject) { - $key = $this->getName().$field; + $key = $this->getName() . $field; return $this->record->getField($key); } diff --git a/src/ORM/FieldType/DBDate.php b/src/ORM/FieldType/DBDate.php index d0cc2cd36..71cca7d10 100644 --- a/src/ORM/FieldType/DBDate.php +++ b/src/ORM/FieldType/DBDate.php @@ -329,7 +329,7 @@ class DBDate extends DBField $matches = array(); if (preg_match('/^([\-+])(\d{2})(\d{2})$/', date('O', $this->getTimestamp()), $matches)) { - $date .= $matches[1].$matches[2].':'.$matches[3]; + $date .= $matches[1] . $matches[2] . ':' . $matches[3]; } else { $date .= 'Z'; } @@ -419,7 +419,7 @@ class DBDate extends DBField case "seconds": $span = $ago; return _t( - __CLASS__.'.SECONDS_SHORT_PLURALS', + __CLASS__ . '.SECONDS_SHORT_PLURALS', '{count} sec|{count} secs', ['count' => $span] ); @@ -427,7 +427,7 @@ class DBDate extends DBField case "minutes": $span = round($ago/60); return _t( - __CLASS__.'.MINUTES_SHORT_PLURALS', + __CLASS__ . '.MINUTES_SHORT_PLURALS', '{count} min|{count} mins', ['count' => $span] ); @@ -435,7 +435,7 @@ class DBDate extends DBField case "hours": $span = round($ago/3600); return _t( - __CLASS__.'.HOURS_SHORT_PLURALS', + __CLASS__ . '.HOURS_SHORT_PLURALS', '{count} hour|{count} hours', ['count' => $span] ); @@ -443,7 +443,7 @@ class DBDate extends DBField case "days": $span = round($ago/86400); return _t( - __CLASS__.'.DAYS_SHORT_PLURALS', + __CLASS__ . '.DAYS_SHORT_PLURALS', '{count} day|{count} days', ['count' => $span] ); @@ -451,7 +451,7 @@ class DBDate extends DBField case "months": $span = round($ago/86400/30); return _t( - __CLASS__.'.MONTHS_SHORT_PLURALS', + __CLASS__ . '.MONTHS_SHORT_PLURALS', '{count} month|{count} months', ['count' => $span] ); @@ -459,7 +459,7 @@ class DBDate extends DBField case "years": $span = round($ago/86400/365); return _t( - __CLASS__.'.YEARS_SHORT_PLURALS', + __CLASS__ . '.YEARS_SHORT_PLURALS', '{count} year|{count} years', ['count' => $span] ); diff --git a/src/ORM/FieldType/DBHTMLText.php b/src/ORM/FieldType/DBHTMLText.php index 2219eec3b..db7aae4e5 100644 --- a/src/ORM/FieldType/DBHTMLText.php +++ b/src/ORM/FieldType/DBHTMLText.php @@ -186,11 +186,11 @@ class DBHTMLText extends DBText if ($tag === 'text()') { $textFilter = ''; // Disable text filter if allowed } else { - $query[] = 'not(self::'.$tag.')'; + $query[] = 'not(self::' . $tag . ')'; } } - foreach ($dom->query('//body//*['.implode(' and ', $query).']'.$textFilter) as $el) { + foreach ($dom->query('//body//*[' . implode(' and ', $query) . ']' . $textFilter) as $el) { if ($el->parentNode) { $el->parentNode->removeChild($el); } diff --git a/src/ORM/HasManyList.php b/src/ORM/HasManyList.php index df0ec55a8..6f4480a9e 100644 --- a/src/ORM/HasManyList.php +++ b/src/ORM/HasManyList.php @@ -54,7 +54,7 @@ class HasManyList extends RelationList // Apply relation filter $key = DataObject::getSchema()->sqlColumnForField($this->dataClass(), $this->getForeignKey()); if (is_array($id)) { - return array("$key IN (".DB::placeholders($id).")" => $id); + return array("$key IN (" . DB::placeholders($id) . ")" => $id); } elseif ($id !== null) { return array($key => $id); } diff --git a/src/ORM/ManyManyList.php b/src/ORM/ManyManyList.php index 9b75d851a..c259890fa 100644 --- a/src/ORM/ManyManyList.php +++ b/src/ORM/ManyManyList.php @@ -178,7 +178,7 @@ class ManyManyList extends RelationList // Apply relation filter $key = "\"{$this->joinTable}\".\"{$this->foreignKey}\""; if (is_array($id)) { - return array("$key IN (".DB::placeholders($id).")" => $id); + return array("$key IN (" . DB::placeholders($id) . ")" => $id); } elseif ($id !== null) { return array($key => $id); } diff --git a/src/ORM/Queries/SQLAssignmentRow.php b/src/ORM/Queries/SQLAssignmentRow.php index 95b1b33c7..8213f8eb0 100644 --- a/src/ORM/Queries/SQLAssignmentRow.php +++ b/src/ORM/Queries/SQLAssignmentRow.php @@ -76,7 +76,7 @@ class SQLAssignmentRow throw new InvalidArgumentException( "Nested field assignments should be given as a single parameterised item array in " - . "array('?' => array('value')) format)" + . "array('?' => array('value')) format)" ); } diff --git a/src/ORM/Queries/SQLConditionalExpression.php b/src/ORM/Queries/SQLConditionalExpression.php index 0c916a98d..32bc44e56 100644 --- a/src/ORM/Queries/SQLConditionalExpression.php +++ b/src/ORM/Queries/SQLConditionalExpression.php @@ -227,7 +227,7 @@ abstract class SQLConditionalExpression extends SQLExpression foreach ($this->from as $key => $tableClause) { if (is_array($tableClause)) { - $table = '"'.$tableClause['table'].'"'; + $table = '"' . $tableClause['table'] . '"'; } elseif (is_string($tableClause) && preg_match('/JOIN +("[^"]+") +(AS|ON) +/i', $tableClause, $matches)) { $table = $matches[1]; } else { @@ -526,7 +526,7 @@ abstract class SQLConditionalExpression extends SQLExpression $filters = $this->normalisePredicates(func_get_args()); $this->splitQueryParameters($filters, $predicates, $parameters); - $clause = "(".implode(") OR (", $predicates).")"; + $clause = "(" . implode(") OR (", $predicates) . ")"; return $this->addWhere(array($clause => $parameters)); } @@ -595,7 +595,7 @@ abstract class SQLConditionalExpression extends SQLExpression // then run a quick check over the contents and recursively parse if (count($value) != 1) { user_error('Nested predicates should be given as a single item array in ' - . 'array($predicate => array($prameters)) format)', E_USER_ERROR); + . 'array($predicate => array($prameters)) format)', E_USER_ERROR); } foreach ($value as $key => $pairValue) { return $this->parsePredicate($key, $pairValue); diff --git a/src/Security/CMSSecurity.php b/src/Security/CMSSecurity.php index 9aa9e262b..ddacc50de 100644 --- a/src/Security/CMSSecurity.php +++ b/src/Security/CMSSecurity.php @@ -95,7 +95,7 @@ class CMSSecurity extends Security // Format return _t( - __CLASS__.'.LOGIN_MESSAGE', + __CLASS__ . '.LOGIN_MESSAGE', '

Your session has timed out due to inactivity

' ); } @@ -121,7 +121,7 @@ class CMSSecurity extends Security $loginURLATT = Convert::raw2att($loginURL); $loginURLJS = Convert::raw2js($loginURL); $message = _t( - __CLASS__.'.INVALIDUSER', + __CLASS__ . '.INVALIDUSER', '

Invalid user. Please re-authenticate here to continue.

', 'Message displayed to user if their session cannot be restored', array('link' => $loginURLATT) @@ -181,7 +181,7 @@ PHP } // Get redirect url - $controller = $this->getResponseController(_t(__CLASS__.'.SUCCESS', 'Success')); + $controller = $this->getResponseController(_t(__CLASS__ . '.SUCCESS', 'Success')); $backURLs = array( $this->getRequest()->requestVar('BackURL'), $this->getRequest()->getSession()->get('BackURL'), @@ -197,9 +197,8 @@ PHP // Show login $controller = $controller->customise(array( 'Content' => DBField::create_field(DBHTMLText::class, _t( - __CLASS__.'.SUCCESSCONTENT', - '

Login success. If you are not automatically redirected ' . - 'click here

', + __CLASS__ . '.SUCCESSCONTENT', + '

Login success. If you are not automatically redirected ' . 'click here

', 'Login message displayed in the cms popup once a user has re-authenticated themselves', array('link' => Convert::raw2att($backURL)) )) diff --git a/src/Security/Group.php b/src/Security/Group.php index b57b1f7fb..7c1dfc36a 100755 --- a/src/Security/Group.php +++ b/src/Security/Group.php @@ -88,7 +88,7 @@ class Group extends DataObject parent::populateDefaults(); if (!$this->Title) { - $this->Title = _t(__CLASS__.'.NEWGROUP', "New Group"); + $this->Title = _t(__CLASS__ . '.NEWGROUP', "New Group"); } } @@ -120,7 +120,7 @@ class Group extends DataObject "Root", new Tab( 'Members', - _t(__CLASS__.'.MEMBERS', 'Members'), + _t(__CLASS__ . '.MEMBERS', 'Members'), new TextField("Title", $this->fieldLabel('Title')), $parentidfield = DropdownField::create( 'ParentID', @@ -131,7 +131,7 @@ class Group extends DataObject ), $permissionsTab = new Tab( 'Permissions', - _t(__CLASS__.'.PERMISSIONS', 'Permissions'), + _t(__CLASS__ . '.PERMISSIONS', 'Permissions'), $permissionsField = new PermissionCheckboxSetField( 'Permissions', false, @@ -217,14 +217,14 @@ class Group extends DataObject PermissionRole::get()->count() && class_exists(SecurityAdmin::class) ) { - $fields->findOrMakeTab('Root.Roles', _t(__CLASS__.'.ROLES', 'Roles')); + $fields->findOrMakeTab('Root.Roles', _t(__CLASS__ . '.ROLES', 'Roles')); $fields->addFieldToTab( 'Root.Roles', new LiteralField( "", "

" . _t( - __CLASS__.'.ROLESDESCRIPTION', + __CLASS__ . '.ROLESDESCRIPTION', "Roles are predefined sets of permissions, and can be assigned to groups.
" . "They are inherited from parent groups if required." ) . '
' . @@ -286,7 +286,7 @@ class Group extends DataObject public function fieldLabels($includerelations = true) { $labels = parent::fieldLabels($includerelations); - $labels['Title'] = _t(__CLASS__.'.GROUPNAME', 'Group name'); + $labels['Title'] = _t(__CLASS__ . '.GROUPNAME', 'Group name'); $labels['Description'] = _t('SilverStripe\\Security\\Group.Description', 'Description'); $labels['Code'] = _t('SilverStripe\\Security\\Group.Code', 'Group Code', 'Programmatical code identifying a group'); $labels['Locked'] = _t('SilverStripe\\Security\\Group.Locked', 'Locked?', 'Group is locked in the security administration area'); @@ -514,7 +514,7 @@ class Group extends DataObject // Only set code property when the group has a custom title, and no code exists. // The "Code" attribute is usually treated as a more permanent identifier than database IDs // in custom application logic, so can't be changed after its first set. - if (!$this->Code && $this->Title != _t(__CLASS__.'.NEWGROUP', "New Group")) { + if (!$this->Code && $this->Title != _t(__CLASS__ . '.NEWGROUP', "New Group")) { $this->setCode($this->Title); } } diff --git a/src/Security/InheritedPermissions.php b/src/Security/InheritedPermissions.php index b10014fa5..df69fac2b 100644 --- a/src/Security/InheritedPermissions.php +++ b/src/Security/InheritedPermissions.php @@ -306,8 +306,7 @@ class InheritedPermissions implements PermissionChecker $baseTable = DataObject::getSchema()->baseDataTable($this->getBaseClass()); $uninheritedPermissions = $stageRecords ->where([ - "(\"$typeField\" IN (?, ?) OR " . - "(\"$typeField\" = ? AND \"$groupJoinTable\".\"{$baseTable}ID\" IS NOT NULL))" + "(\"$typeField\" IN (?, ?) OR " . "(\"$typeField\" = ? AND \"$groupJoinTable\".\"{$baseTable}ID\" IS NOT NULL))" => [ self::ANYONE, self::LOGGED_IN_USERS, @@ -316,8 +315,7 @@ class InheritedPermissions implements PermissionChecker ]) ->leftJoin( $groupJoinTable, - "\"$groupJoinTable\".\"{$baseTable}ID\" = \"{$baseTable}\".\"ID\" AND " . - "\"$groupJoinTable\".\"GroupID\" IN ($groupIDsSQLList)" + "\"$groupJoinTable\".\"{$baseTable}ID\" = \"{$baseTable}\".\"ID\" AND " . "\"$groupJoinTable\".\"GroupID\" IN ($groupIDsSQLList)" )->column('ID'); } else { // Only view pages with ViewType = Anyone if not logged in diff --git a/src/Security/LoginAttempt.php b/src/Security/LoginAttempt.php index f3e631792..1a2b68939 100644 --- a/src/Security/LoginAttempt.php +++ b/src/Security/LoginAttempt.php @@ -56,10 +56,10 @@ class LoginAttempt extends DataObject public function fieldLabels($includerelations = true) { $labels = parent::fieldLabels($includerelations); - $labels['Email'] = _t(__CLASS__.'.Email', 'Email Address'); - $labels['EmailHashed'] = _t(__CLASS__.'.EmailHashed', 'Email Address (hashed)'); - $labels['Status'] = _t(__CLASS__.'.Status', 'Status'); - $labels['IP'] = _t(__CLASS__.'.IP', 'IP Address'); + $labels['Email'] = _t(__CLASS__ . '.Email', 'Email Address'); + $labels['EmailHashed'] = _t(__CLASS__ . '.EmailHashed', 'Email Address (hashed)'); + $labels['Status'] = _t(__CLASS__ . '.Status', 'Status'); + $labels['IP'] = _t(__CLASS__ . '.IP', 'IP Address'); return $labels; } diff --git a/src/Security/Member.php b/src/Security/Member.php index 929d60ac3..40bdd9389 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -351,8 +351,7 @@ class Member extends DataObject $result->addError( _t( __CLASS__ . '.ERRORLOCKEDOUT2', - 'Your account has been temporarily disabled because of too many failed attempts at ' . - 'logging in. Please try again in {count} minutes.', + 'Your account has been temporarily disabled because of too many failed attempts at ' . 'logging in. Please try again in {count} minutes.', null, array('count' => static::config()->get('lock_out_delay_mins')) ) diff --git a/src/Security/MemberAuthenticator/CMSMemberLoginForm.php b/src/Security/MemberAuthenticator/CMSMemberLoginForm.php index cd8376282..636df9f1f 100644 --- a/src/Security/MemberAuthenticator/CMSMemberLoginForm.php +++ b/src/Security/MemberAuthenticator/CMSMemberLoginForm.php @@ -86,14 +86,14 @@ class CMSMemberLoginForm extends MemberLoginForm // Make actions $actions = FieldList::create([ - FormAction::create('doLogin', _t(__CLASS__.'.BUTTONLOGIN', "Let me back in")) + FormAction::create('doLogin', _t(__CLASS__ . '.BUTTONLOGIN', "Let me back in")) ->addExtraClass('btn-primary'), LiteralField::create( 'doLogout', sprintf( '%s', Convert::raw2att($logoutLink), - _t(__CLASS__.'.BUTTONLOGOUT', "Log out") + _t(__CLASS__ . '.BUTTONLOGOUT', "Log out") ) ), LiteralField::create( @@ -101,7 +101,7 @@ class CMSMemberLoginForm extends MemberLoginForm sprintf( '%s', $this->getExternalLink('lostpassword'), - _t(__CLASS__.'.BUTTONFORGOTPASSWORD', "Forgot password") + _t(__CLASS__ . '.BUTTONFORGOTPASSWORD', "Forgot password") ) ) ]); @@ -125,6 +125,6 @@ class CMSMemberLoginForm extends MemberLoginForm */ public function getAuthenticatorName() { - return _t(__CLASS__.'.AUTHENTICATORNAME', 'CMS Member Login Form'); + return _t(__CLASS__ . '.AUTHENTICATORNAME', 'CMS Member Login Form'); } } diff --git a/src/Security/Permission.php b/src/Security/Permission.php index bb6d8d381..6c2553c13 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -532,9 +532,9 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl $classes = ClassInfo::implementorsOf('SilverStripe\\Security\\PermissionProvider'); $allCodes = array(); - $adminCategory = _t(__CLASS__.'.AdminGroup', 'Administrator'); + $adminCategory = _t(__CLASS__ . '.AdminGroup', 'Administrator'); $allCodes[$adminCategory]['ADMIN'] = array( - 'name' => _t(__CLASS__.'.FULLADMINRIGHTS', 'Full administrative rights'), + 'name' => _t(__CLASS__ . '.FULLADMINRIGHTS', 'Full administrative rights'), 'help' => _t( 'SilverStripe\\Security\\Permission.FULLADMINRIGHTS_HELP', 'Implies and overrules all other assigned permissions.' @@ -727,10 +727,10 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl $keys = parent::provideI18nEntities(); // TODO: Change the autogenerated stub // Localise all permission categories - $keys[__CLASS__.'.AdminGroup'] = 'Administrator'; - $keys[__CLASS__.'.CMS_ACCESS_CATEGORY'] = 'CMS Access'; - $keys[__CLASS__.'.CONTENT_CATEGORY'] = 'Content permissions'; - $keys[__CLASS__.'.PERMISSIONS_CATEGORY'] = 'Roles and access permissions'; + $keys[__CLASS__ . '.AdminGroup'] = 'Administrator'; + $keys[__CLASS__ . '.CMS_ACCESS_CATEGORY'] = 'CMS Access'; + $keys[__CLASS__ . '.CONTENT_CATEGORY'] = 'Content permissions'; + $keys[__CLASS__ . '.PERMISSIONS_CATEGORY'] = 'Roles and access permissions'; return $keys; } } diff --git a/src/Security/PermissionCheckboxSetField.php b/src/Security/PermissionCheckboxSetField.php index e6faffa21..ef039bd4b 100644 --- a/src/Security/PermissionCheckboxSetField.php +++ b/src/Security/PermissionCheckboxSetField.php @@ -225,7 +225,7 @@ class PermissionCheckboxSetField extends FormField } elseif ($this->records && $this->records->Count() > 1 && isset($uninheritedCodes[$code])) { // If code assignments are collected from more than one "source group", // show its origin automatically - $inheritMessage = ' (' . join(', ', $uninheritedCodes[$code]).')'; + $inheritMessage = ' (' . join(', ', $uninheritedCodes[$code]) . ')'; } // Disallow modification of "privileged" permissions unless currently logged-in user is an admin diff --git a/src/Security/RememberLoginHash.php b/src/Security/RememberLoginHash.php index 9fda0df9a..6666792b7 100644 --- a/src/Security/RememberLoginHash.php +++ b/src/Security/RememberLoginHash.php @@ -145,7 +145,7 @@ class RememberLoginHash extends DataObject $now = DBDatetime::now(); $expiryDate = new DateTime($now->Rfc2822()); $tokenExpiryDays = static::config()->token_expiry_days; - $expiryDate->add(new DateInterval('P'.$tokenExpiryDays.'D')); + $expiryDate->add(new DateInterval('P' . $tokenExpiryDays . 'D')); $rememberLoginHash->ExpiryDate = $expiryDate->format('Y-m-d H:i:s'); $rememberLoginHash->extend('onAfterGenerateToken'); $rememberLoginHash->write(); diff --git a/src/Security/Security.php b/src/Security/Security.php index 16ed75207..c33ce0475 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -675,7 +675,7 @@ class Security extends Controller implements TemplateGlobalProvider return $this->delegateToMultipleHandlers( $handlers, - _t(__CLASS__.'.LOGIN', 'Log in'), + _t(__CLASS__ . '.LOGIN', 'Log in'), $this->getTemplatesFor('login'), [$this, 'aggregateTabbedForms'] ); @@ -712,7 +712,7 @@ class Security extends Controller implements TemplateGlobalProvider return $this->delegateToMultipleHandlers( $handlers, - _t(__CLASS__.'.LOGOUT', 'Log out'), + _t(__CLASS__ . '.LOGOUT', 'Log out'), $this->getTemplatesFor('logout'), [$this, 'aggregateAuthenticatorResponses'] ); diff --git a/src/View/Parsers/HTML4Value.php b/src/View/Parsers/HTML4Value.php index cfa58ed79..0ffb4970a 100644 --- a/src/View/Parsers/HTML4Value.php +++ b/src/View/Parsers/HTML4Value.php @@ -22,8 +22,7 @@ class HTML4Value extends HTMLValue $errorState = libxml_use_internal_errors(true); $result = $this->getDocument()->loadHTML( - '' . - "$content" + '' . "$content" ); libxml_clear_errors(); libxml_use_internal_errors($errorState); diff --git a/src/View/Parsers/HTMLValue.php b/src/View/Parsers/HTMLValue.php index e3f720a7f..d41ef3708 100644 --- a/src/View/Parsers/HTMLValue.php +++ b/src/View/Parsers/HTMLValue.php @@ -49,7 +49,7 @@ abstract class HTMLValue extends ViewableData $i = 0; foreach ($xp->query('//body//@*') as $attr) { - $key = "__HTMLVALUE_".($i++); + $key = "__HTMLVALUE_" . ($i++); $attrs[$key] = $attr->value; $attr->value = $key; } diff --git a/src/View/Parsers/ShortcodeParser.php b/src/View/Parsers/ShortcodeParser.php index 444078ed5..a000f1145 100644 --- a/src/View/Parsers/ShortcodeParser.php +++ b/src/View/Parsers/ShortcodeParser.php @@ -30,7 +30,7 @@ class ShortcodeParser public function img_shortcode($attrs) { - return ""; + return ""; } protected static $instances = array(); @@ -191,9 +191,9 @@ class ShortcodeParser // Missing tag if ($content === false) { if (ShortcodeParser::$error_behavior == ShortcodeParser::ERROR) { - user_error('Unknown shortcode tag '.$tag['open'], E_USER_ERROR); + user_error('Unknown shortcode tag ' . $tag['open'], E_USER_ERROR); } elseif (self::$error_behavior == self::WARN && $isHTMLAllowed) { - $content = ''.$tag['text'].''; + $content = '' . $tag['text'] . ''; } elseif (ShortcodeParser::$error_behavior == ShortcodeParser::STRIP) { return ''; } else { @@ -271,7 +271,7 @@ class ShortcodeParser protected static function attrrx() { - return '/'.self::$attrrx.'/xS'; + return '/' . self::$attrrx . '/xS'; } protected static $tagrx = ' @@ -296,7 +296,7 @@ class ShortcodeParser protected static function tagrx() { - return '/'.sprintf(self::$tagrx, self::$attrrx).'/xS'; + return '/' . sprintf(self::$tagrx, self::$attrrx) . '/xS'; } const WARN = 'warn'; @@ -372,13 +372,11 @@ class ShortcodeParser $err = null; if ($i == 0) { - $err = 'Close tag "'.$tags[$i]['close'].'" is the first found tag, so has no related open tag'; + $err = 'Close tag "' . $tags[$i]['close'] . '" is the first found tag, so has no related open tag'; } elseif (!$tags[$i-1]['open']) { - $err = 'Close tag "'.$tags[$i]['close'].'" preceded by another close tag "'. - $tags[$i-1]['close'].'"'; + $err = 'Close tag "' . $tags[$i]['close'] . '" preceded by another close tag "' . $tags[$i-1]['close'] . '"'; } elseif ($tags[$i]['close'] != $tags[$i-1]['open']) { - $err = 'Close tag "'.$tags[$i]['close'].'" doesn\'t match preceding open tag "'. - $tags[$i-1]['open'].'"'; + $err = 'Close tag "' . $tags[$i]['close'] . '" doesn\'t match preceding open tag "' . $tags[$i-1]['open'] . '"'; } if ($err) { @@ -502,7 +500,7 @@ class ShortcodeParser $markerClass = self::$marker_class; $content = $this->replaceTagsWithText($content, $tags, function ($idx, $tag) use ($markerClass) { - return ''; + return ''; }); } @@ -599,14 +597,13 @@ class ShortcodeParser elseif ($location == self::INLINE) { if (in_array(strtolower($node->tagName), self::$block_level_elements)) { user_error( - 'Requested to insert block tag '.$node->tagName. - ' inline - probably this will break HTML compliance', + 'Requested to insert block tag ' . $node->tagName . ' inline - probably this will break HTML compliance', E_USER_WARNING ); } // NOP } else { - user_error('Unknown value for $location argument '.$location, E_USER_ERROR); + user_error('Unknown value for $location argument ' . $location, E_USER_ERROR); } } @@ -680,7 +677,7 @@ class ShortcodeParser $this->replaceAttributeTagsWithContent($htmlvalue); // Find all the element scoped shortcode markers - $shortcodes = $htmlvalue->query('//img[@class="'.self::$marker_class.'"]'); + $shortcodes = $htmlvalue->query('//img[@class="' . self::$marker_class . '"]'); // Find the parents. Do this before DOM modification, since SPLIT might cause parents to move otherwise $parents = $this->findParentsForMarkers($shortcodes); @@ -729,7 +726,7 @@ class ShortcodeParser $content = preg_replace_callback( // Not a general-case parser; assumes that the HTML generated in replaceElementTagsWithMarkers() // hasn't been heavily modified - '/]+class="'.preg_quote(self::$marker_class).'"[^>]+data-tagid="([^"]+)"[^>]+>/i', + '/]+class="' . preg_quote(self::$marker_class) . '"[^>]+data-tagid="([^"]+)"[^>]+>/i', function ($matches) use ($tags, $parser) { $tag = $tags[$matches[1]]; return $parser->getShortcodeReplacementText($tag); diff --git a/src/View/ThemeManifest.php b/src/View/ThemeManifest.php index 7c782a424..1c74f957d 100644 --- a/src/View/ThemeManifest.php +++ b/src/View/ThemeManifest.php @@ -79,7 +79,7 @@ class ThemeManifest implements ThemeList // build cache from factory if ($this->cacheFactory) { $this->cache = $this->cacheFactory->create( - CacheInterface::class.'.thememanifest', + CacheInterface::class . '.thememanifest', [ 'namespace' => 'thememanifest' . ($includeTests ? '_tests' : '') ] ); } @@ -165,7 +165,7 @@ class ThemeManifest implements ThemeList return; } $dir = trim(substr(dirname($pathname), strlen($this->base)), '/\\'); - $this->themes[] = "/".$dir; + $this->themes[] = "/" . $dir; } /** diff --git a/src/View/ThemeResourceLoader.php b/src/View/ThemeResourceLoader.php index ca06e2ba1..4009e7dd0 100644 --- a/src/View/ThemeResourceLoader.php +++ b/src/View/ThemeResourceLoader.php @@ -108,7 +108,7 @@ class ThemeResourceLoader // If there is no slash / colon it's a legacy theme if ($slashPos === false && count($parts) === 1) { - return THEMES_DIR.'/'.$identifier; + return THEMES_DIR . '/' . $identifier; } // Extract from /: format. diff --git a/src/View/ViewableData.php b/src/View/ViewableData.php index 317cb51db..7c4d26531 100644 --- a/src/View/ViewableData.php +++ b/src/View/ViewableData.php @@ -398,7 +398,7 @@ class ViewableData implements IteratorAggregate } throw new UnexpectedValueException( - "ViewableData::renderWith(): unexpected ".get_class($template)." object, expected an SSViewer instance" + "ViewableData::renderWith(): unexpected " . get_class($template) . " object, expected an SSViewer instance" ); } diff --git a/src/View/ViewableData_Debugger.php b/src/View/ViewableData_Debugger.php index e72e463fe..8c9b5805c 100644 --- a/src/View/ViewableData_Debugger.php +++ b/src/View/ViewableData_Debugger.php @@ -44,9 +44,7 @@ class ViewableData_Debugger extends ViewableData // debugging info for a specific field $class = get_class($this->object); if ($field) { - return "Debugging Information for {$class}->{$field}
" . - ($this->object->hasMethod($field) ? "Has method '$field'
" : null) . - ($this->object->hasField($field) ? "Has field '$field'
" : null); + return "Debugging Information for {$class}->{$field}
" . ($this->object->hasMethod($field) ? "Has method '$field'
" : null) . ($this->object->hasField($field) ? "Has field '$field'
" : null); } // debugging information for the entire class diff --git a/src/i18n/TextCollection/i18nTextCollector.php b/src/i18n/TextCollection/i18nTextCollector.php index 6d57f7ad9..287fcbbeb 100644 --- a/src/i18n/TextCollection/i18nTextCollector.php +++ b/src/i18n/TextCollection/i18nTextCollector.php @@ -343,7 +343,7 @@ class i18nTextCollector // Find FQN that ends with $class $classes = preg_grep( - '/'.preg_quote("\\{$class}", '\/').'$/i', + '/' . preg_quote("\\{$class}", '\/') . '$/i', ClassLoader::inst()->getManifest()->getClassNames() ); @@ -662,7 +662,7 @@ class i18nTextCollector $matches['text'] ); } else { - throw new LogicException("Invalid string escape: " .$text); + throw new LogicException("Invalid string escape: " . $text); } } elseif ($id === T_CLASS_C) { // Evaluate __CLASS__ . '.KEY' and self::class concatenation @@ -907,7 +907,7 @@ class i18nTextCollector return $fileList; } - foreach (glob($folder.'/*') as $path) { + foreach (glob($folder . '/*') as $path) { // Recurse if directory if (is_dir($path)) { $fileList = array_merge( diff --git a/src/includes/constants.php b/src/includes/constants.php index 61592cadf..b560a0521 100644 --- a/src/includes/constants.php +++ b/src/includes/constants.php @@ -135,7 +135,7 @@ if (!defined('ASSETS_PATH')) { // Custom include path - deprecated if (defined('CUSTOM_INCLUDE_PATH')) { - set_include_path(CUSTOM_INCLUDE_PATH . PATH_SEPARATOR . get_include_path()); + set_include_path(CUSTOM_INCLUDE_PATH . PATH_SEPARATOR . get_include_path()); } // Define the temporary folder if it wasn't defined yet diff --git a/tests/bootstrap/init.php b/tests/bootstrap/init.php index 023037ba7..8f31ca384 100644 --- a/tests/bootstrap/init.php +++ b/tests/bootstrap/init.php @@ -1,9 +1,7 @@ assertEquals( 200, $response->getStatusCode(), - 'Access granted on index action without $allowed_actions on defining controller, ' . - 'when called without an action in the URL' + 'Access granted on index action without $allowed_actions on defining controller, ' . 'when called without an action in the URL' ); $response = $this->get("UnsecuredController/index"); $this->assertEquals( 200, $response->getStatusCode(), - 'Access denied on index action without $allowed_actions on defining controller, ' . - 'when called with an action in the URL' + 'Access denied on index action without $allowed_actions on defining controller, ' . 'when called with an action in the URL' ); $response = $this->get("UnsecuredController/method1"); $this->assertEquals( 403, $response->getStatusCode(), - 'Access denied on action without $allowed_actions on defining controller, ' . - 'when called without an action in the URL' + 'Access denied on action without $allowed_actions on defining controller, ' . 'when called without an action in the URL' ); $response = $this->get("AccessBaseController/"); $this->assertEquals( 200, $response->getStatusCode(), - 'Access granted on index with empty $allowed_actions on defining controller, ' . - 'when called without an action in the URL' + 'Access granted on index with empty $allowed_actions on defining controller, ' . 'when called without an action in the URL' ); $response = $this->get("AccessBaseController/index"); $this->assertEquals( 200, $response->getStatusCode(), - 'Access granted on index with empty $allowed_actions on defining controller, ' . - 'when called with an action in the URL' + 'Access granted on index with empty $allowed_actions on defining controller, ' . 'when called with an action in the URL' ); $response = $this->get("AccessBaseController/method1"); @@ -155,48 +150,42 @@ class ControllerTest extends FunctionalTest $this->assertEquals( 403, $response->getStatusCode(), - 'Access denied on action with empty $allowed_actions on defining controller, ' . - 'even when action is allowed in subclasses (allowed_actions don\'t inherit)' + 'Access denied on action with empty $allowed_actions on defining controller, ' . 'even when action is allowed in subclasses (allowed_actions don\'t inherit)' ); $response = $this->get("AccessSecuredController/"); $this->assertEquals( 200, $response->getStatusCode(), - 'Access granted on index with non-empty $allowed_actions on defining controller, ' . - 'even when index isn\'t specifically mentioned in there' + 'Access granted on index with non-empty $allowed_actions on defining controller, ' . 'even when index isn\'t specifically mentioned in there' ); $response = $this->get("AccessSecuredController/method1"); $this->assertEquals( 403, $response->getStatusCode(), - 'Access denied on action which is only defined in parent controller, ' . - 'even when action is allowed in currently called class (allowed_actions don\'t inherit)' + 'Access denied on action which is only defined in parent controller, ' . 'even when action is allowed in currently called class (allowed_actions don\'t inherit)' ); $response = $this->get("AccessSecuredController/method2"); $this->assertEquals( 200, $response->getStatusCode(), - 'Access granted on action originally defined with empty $allowed_actions on parent controller, ' . - 'because it has been redefined in the subclass' + 'Access granted on action originally defined with empty $allowed_actions on parent controller, ' . 'because it has been redefined in the subclass' ); $response = $this->get("AccessSecuredController/templateaction"); $this->assertEquals( 403, $response->getStatusCode(), - 'Access denied on action with $allowed_actions on defining controller, ' . - 'if action is not a method but rather a template discovered by naming convention' + 'Access denied on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention' ); $response = $this->get("AccessSecuredController/templateaction"); $this->assertEquals( 403, $response->getStatusCode(), - 'Access denied on action with $allowed_actions on defining controller, ' . - 'if action is not a method but rather a template discovered by naming convention' + 'Access denied on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention' ); Security::setCurrentUser($adminUser); @@ -204,8 +193,7 @@ class ControllerTest extends FunctionalTest $this->assertEquals( 200, $response->getStatusCode(), - 'Access granted for logged in admin on action with $allowed_actions on defining controller, ' . - 'if action is not a method but rather a template discovered by naming convention' + 'Access granted for logged in admin on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention' ); Security::setCurrentUser(null); @@ -213,16 +201,14 @@ class ControllerTest extends FunctionalTest $this->assertEquals( 403, $response->getStatusCode(), - 'Access denied on action with $allowed_actions on defining controller, ' . - 'when restricted by unmatched permission code' + 'Access denied on action with $allowed_actions on defining controller, ' . 'when restricted by unmatched permission code' ); $response = $this->get("AccessSecuredController/aDmiNOnlY"); $this->assertEquals( 403, $response->getStatusCode(), - 'Access denied on action with $allowed_actions on defining controller, ' . - 'regardless of capitalization' + 'Access denied on action with $allowed_actions on defining controller, ' . 'regardless of capitalization' ); $response = $this->get('AccessSecuredController/protectedmethod'); @@ -245,40 +231,35 @@ class ControllerTest extends FunctionalTest $this->assertEquals( 200, $response->getStatusCode(), - "Access granted to method defined in allowed_actions on extension, " . - "where method is also defined on extension" + "Access granted to method defined in allowed_actions on extension, " . "where method is also defined on extension" ); $response = $this->get('AccessSecuredController/extensionmethod1'); $this->assertEquals( 200, $response->getStatusCode(), - "Access granted to method defined in allowed_actions on extension, " . - "where method is also defined on extension, even when called in a subclass" + "Access granted to method defined in allowed_actions on extension, " . "where method is also defined on extension, even when called in a subclass" ); $response = $this->get('AccessBaseController/extensionmethod2'); $this->assertEquals( 404, $response->getStatusCode(), - "Access denied to method not defined in allowed_actions on extension, " . - "where method is also defined on extension" + "Access denied to method not defined in allowed_actions on extension, " . "where method is also defined on extension" ); $response = $this->get('IndexSecuredController/'); $this->assertEquals( 403, $response->getStatusCode(), - "Access denied when index action is limited through allowed_actions, " . - "and doesn't satisfy checks, and action is empty" + "Access denied when index action is limited through allowed_actions, " . "and doesn't satisfy checks, and action is empty" ); $response = $this->get('IndexSecuredController/index'); $this->assertEquals( 403, $response->getStatusCode(), - "Access denied when index action is limited through allowed_actions, " . - "and doesn't satisfy checks" + "Access denied when index action is limited through allowed_actions, " . "and doesn't satisfy checks" ); Security::setCurrentUser($adminUser); @@ -286,8 +267,7 @@ class ControllerTest extends FunctionalTest $this->assertEquals( 200, $response->getStatusCode(), - "Access granted when index action is limited through allowed_actions, " . - "and does satisfy checks" + "Access granted when index action is limited through allowed_actions, " . "and does satisfy checks" ); Security::setCurrentUser(null); } @@ -433,8 +413,7 @@ class ControllerTest extends FunctionalTest $this->assertFalse( $securedController->hasAction('protectedextensionmethod'), - 'Method is not visible when defined on an extension, part of allowed_actions, ' . - 'but with protected visibility' + 'Method is not visible when defined on an extension, part of allowed_actions, ' . 'but with protected visibility' ); } diff --git a/tests/php/Control/DirectorTest.php b/tests/php/Control/DirectorTest.php index fa3237545..eae00b2b8 100644 --- a/tests/php/Control/DirectorTest.php +++ b/tests/php/Control/DirectorTest.php @@ -821,7 +821,7 @@ class DirectorTest extends SapphireTest $response = Director::test('some-dummy-url'); $this->assertEquals(500, $response->getStatusCode()); - $this->assertEquals(_t(Director::class.'.REQUEST_ABORTED', 'Request aborted'), $response->getBody()); + $this->assertEquals(_t(Director::class . '.REQUEST_ABORTED', 'Request aborted'), $response->getBody()); $this->assertEquals(2, $filter->preCalls); $this->assertEquals(2, $filter->postCalls); @@ -830,7 +830,7 @@ class DirectorTest extends SapphireTest $response = Director::test('some-dummy-url'); $this->assertEquals(400, $response->getStatusCode()); - $this->assertEquals(_t(Director::class.'.INVALID_REQUEST', 'Invalid request'), $response->getBody()); + $this->assertEquals(_t(Director::class . '.INVALID_REQUEST', 'Invalid request'), $response->getBody()); $this->assertEquals(3, $filter->preCalls); diff --git a/tests/php/Control/Email/EmailTest.php b/tests/php/Control/Email/EmailTest.php index a36a7b496..05a2bc2e5 100644 --- a/tests/php/Control/Email/EmailTest.php +++ b/tests/php/Control/Email/EmailTest.php @@ -478,7 +478,7 @@ class EmailTest extends SapphireTest $subClassTemplate = ModuleResourceLoader::singleton()->resolveResource( 'silverstripe/framework:tests/php/Control/Email/EmailTest/templates/' . str_replace('\\', '/', EmailSubClass::class) - .'.ss' + . '.ss' ); $this->assertTrue($emailTemplate->exists()); $this->assertTrue($subClassTemplate->exists()); diff --git a/tests/php/Control/HTTPTest.php b/tests/php/Control/HTTPTest.php index bb556e34b..2945c088d 100644 --- a/tests/php/Control/HTTPTest.php +++ b/tests/php/Control/HTTPTest.php @@ -189,7 +189,7 @@ class HTTPTest extends FunctionalTest foreach ($urls as $testURL) { $this->assertEquals( - $testURL .'?foo=bar', + $testURL . '?foo=bar', HTTP::setGetVar('foo', 'bar', $testURL), 'Absolute URL and Port Number' ); @@ -226,8 +226,7 @@ class HTTPTest extends FunctionalTest // background-image // Note that using /./ in urls is absolutely acceptable $this->assertEquals( - '

'. - 'Content
', + '
' . 'Content
', HTTP::absoluteURLs('
Content
') ); @@ -290,8 +289,7 @@ class HTTPTest extends FunctionalTest // background // Note that using /./ in urls is absolutely acceptable $this->assertEquals( - '
'. - 'SS Blog
', + '
' . 'SS Blog
', HTTP::absoluteURLs('
SS Blog
') ); @@ -342,11 +340,9 @@ class HTTPTest extends FunctionalTest // data uri $this->assertEquals( - 'Red dot', + 'Red dot', HTTP::absoluteURLs( - 'Red dot' + 'Red dot' ), 'Data URI links are not rewritten' ); diff --git a/tests/php/Control/RequestHandlingTest.php b/tests/php/Control/RequestHandlingTest.php index 1ac668602..3f4ad5573 100644 --- a/tests/php/Control/RequestHandlingTest.php +++ b/tests/php/Control/RequestHandlingTest.php @@ -268,7 +268,7 @@ class RequestHandlingTest extends FunctionalTest 403, $response->getStatusCode(), 'Should fail: Invocation through POST form handler, controller action instead of form action,' - .' not contained in $allowed_actions, with CSRF token' + . ' not contained in $allowed_actions, with CSRF token' ); $data = array('action_formaction' => 1, 'SecurityID' => $securityId); diff --git a/tests/php/Control/SimpleResourceURLGeneratorTest.php b/tests/php/Control/SimpleResourceURLGeneratorTest.php index 70eab2207..3ec61d5ae 100644 --- a/tests/php/Control/SimpleResourceURLGeneratorTest.php +++ b/tests/php/Control/SimpleResourceURLGeneratorTest.php @@ -16,7 +16,7 @@ class SimpleResourceURLGeneratorTest extends SapphireTest parent::setUp(); Director::config()->set( 'alternate_base_folder', - __DIR__ .'/SimpleResourceURLGeneratorTest/_fakewebroot' + __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot' ); Director::config()->set( 'alternate_base_url', @@ -28,9 +28,9 @@ class SimpleResourceURLGeneratorTest extends SapphireTest { /** @var SimpleResourceURLGenerator $generator */ $generator = Injector::inst()->get(ResourceURLGenerator::class); - $mtime = filemtime(__DIR__ .'/SimpleResourceURLGeneratorTest/_fakewebroot/basemodule/client/file.js'); + $mtime = filemtime(__DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/basemodule/client/file.js'); $this->assertEquals( - '/basemodule/client/file.js?m='.$mtime, + '/basemodule/client/file.js?m=' . $mtime, $generator->urlForResource('basemodule/client/file.js') ); } @@ -40,10 +40,10 @@ class SimpleResourceURLGeneratorTest extends SapphireTest /** @var SimpleResourceURLGenerator $generator */ $generator = Injector::inst()->get(ResourceURLGenerator::class); $mtime = filemtime( - __DIR__ .'/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/client/style.css' + __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/client/style.css' ); $this->assertEquals( - '/resources/silverstripe/mymodule/client/style.css?m='.$mtime, + '/resources/silverstripe/mymodule/client/style.css?m=' . $mtime, $generator->urlForResource('vendor/silverstripe/mymodule/client/style.css') ); } @@ -53,14 +53,14 @@ class SimpleResourceURLGeneratorTest extends SapphireTest /** @var SimpleResourceURLGenerator $generator */ $generator = Injector::inst()->get(ResourceURLGenerator::class); $module = new Module( - __DIR__ .'/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/', - __DIR__ .'/SimpleResourceURLGeneratorTest/_fakewebroot/' + __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/', + __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/' ); $mtime = filemtime( - __DIR__ .'/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/client/style.css' + __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/client/style.css' ); $this->assertEquals( - '/resources/silverstripe/mymodule/client/style.css?m='.$mtime, + '/resources/silverstripe/mymodule/client/style.css?m=' . $mtime, $generator->urlForResource($module->getResource('client/style.css')) ); } diff --git a/tests/php/Core/Cache/CacheTest.php b/tests/php/Core/Cache/CacheTest.php index 934a3e033..cf9fa180b 100644 --- a/tests/php/Core/Cache/CacheTest.php +++ b/tests/php/Core/Cache/CacheTest.php @@ -44,14 +44,14 @@ class CacheTest extends SapphireTest public function testApcuCacheFactory() { - $cache = Injector::inst()->get(CacheInterface::class .'.TestApcuCache'); + $cache = Injector::inst()->get(CacheInterface::class . '.TestApcuCache'); $this->assertInstanceOf( MockCache::class, $cache ); $this->assertEquals( [ - 'TestApcuCache_'.md5(BASE_PATH), + 'TestApcuCache_' . md5(BASE_PATH), 2600, 'ss40test' ], @@ -61,7 +61,7 @@ class CacheTest extends SapphireTest public function testMemCacheFactory() { - $cache = Injector::inst()->get(CacheInterface::class .'.TestMemcache'); + $cache = Injector::inst()->get(CacheInterface::class . '.TestMemcache'); $this->assertInstanceOf( MockCache::class, $cache @@ -69,7 +69,7 @@ class CacheTest extends SapphireTest $this->assertEquals( [ null, - 'TestMemCache_'.md5(BASE_PATH), + 'TestMemCache_' . md5(BASE_PATH), 5600 ], $cache->getArgs() diff --git a/tests/php/Core/ConvertTest.php b/tests/php/Core/ConvertTest.php index d9dcaf2a3..e92f65330 100644 --- a/tests/php/Core/ConvertTest.php +++ b/tests/php/Core/ConvertTest.php @@ -136,12 +136,7 @@ class ConvertTest extends SapphireTest "Single quotes are decoded correctly" ); - $val8 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor '. - 'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud '. - 'exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute '. - 'irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla '. - 'pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia '. - 'deserunt mollit anim id est laborum.'; + $val8 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ' . 'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud ' . 'exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute ' . 'irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla ' . 'pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia ' . 'deserunt mollit anim id est laborum.'; $this->assertEquals($val8, Convert::html2raw($val8), 'Test long text is unwrapped'); $this->assertEquals( <<assertEquals(TempFolder::getTempFolder(BASE_PATH), $this->tempPath . DIRECTORY_SEPARATOR . $user); } else { $user = TempFolder::getTempFolderUsername(); - $base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . - preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION); + $base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION); // A typical Windows location for where sites are stored on IIS $this->assertEquals( @@ -56,8 +55,7 @@ class CoreTest extends SapphireTest { parent::tearDown(); $user = TempFolder::getTempFolderUsername(); - $base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . - preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION); + $base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION); foreach (array( 'C--inetpub-wwwroot-silverstripe-test-project', '-Users-joebloggs-Sites-silverstripe-test-project', diff --git a/tests/php/Core/Injector/InjectorTest.php b/tests/php/Core/Injector/InjectorTest.php index 10473d035..d2a42af76 100644 --- a/tests/php/Core/Injector/InjectorTest.php +++ b/tests/php/Core/Injector/InjectorTest.php @@ -616,7 +616,7 @@ class InjectorTest extends SapphireTest NewRequirementsBackend::class, DummyRequirements::class => array( 'constructor' => array( - '%$'.OriginalRequirementsBackend::class + '%$' . OriginalRequirementsBackend::class ) ) ); @@ -634,7 +634,7 @@ class InjectorTest extends SapphireTest array( DummyRequirements::class => array( 'constructor' => array( - '%$'.NewRequirementsBackend::class + '%$' . NewRequirementsBackend::class ) ) ) @@ -690,7 +690,7 @@ class InjectorTest extends SapphireTest $config = array( OriginalRequirementsBackend::class, DummyRequirements::class => array( - 'class' => DummyRequirements::class.'(\'%$'.OriginalRequirementsBackend::class.'\')' + 'class' => DummyRequirements::class . '(\'%$' . OriginalRequirementsBackend::class . '\')' ) ); $injector->load($config); @@ -730,7 +730,7 @@ class InjectorTest extends SapphireTest Config::modify()->merge( Injector::class, MyChildClass::class, - '%$'.MyParentClass::class + '%$' . MyParentClass::class ); // Class isn't inherited and parent properties are ignored @@ -766,15 +766,15 @@ class InjectorTest extends SapphireTest // make sure convert service property is not called on direct calls to create, only on configured // declarations to avoid un-needed function calls $injector = new Injector(); - $item = $injector->create(ConstructableObject::class, '%$'.TestObject::class); - $this->assertEquals('%$'.TestObject::class, $item->property); + $item = $injector->create(ConstructableObject::class, '%$' . TestObject::class); + $this->assertEquals('%$' . TestObject::class, $item->property); // do it again but have test object configured as a constructor dependency $injector = new Injector(); $config = array( ConstructableObject::class => array( 'constructor' => array( - '%$'.TestObject::class + '%$' . TestObject::class ) ) ); @@ -788,7 +788,7 @@ class InjectorTest extends SapphireTest $config = array( ConstructableObject::class => array( 'constructor' => array( - '%$'.TestObject::class + '%$' . TestObject::class ) ), ); diff --git a/tests/php/Core/Injector/InjectorTest/InjectorTestConfigLocator.php b/tests/php/Core/Injector/InjectorTest/InjectorTestConfigLocator.php index 09e669d72..8a9d82b72 100644 --- a/tests/php/Core/Injector/InjectorTest/InjectorTestConfigLocator.php +++ b/tests/php/Core/Injector/InjectorTest/InjectorTestConfigLocator.php @@ -16,7 +16,7 @@ class InjectorTestConfigLocator extends SilverStripeServiceConfigurationLocator return $this->configs[$name] = array( 'class' => ConstructableObject::class, 'constructor' => array( - '%$'.OtherTestObject::class + '%$' . OtherTestObject::class ) ); diff --git a/tests/php/Core/Manifest/ConfigManifestTest.php b/tests/php/Core/Manifest/ConfigManifestTest.php index d7868b08a..d12e54883 100644 --- a/tests/php/Core/Manifest/ConfigManifestTest.php +++ b/tests/php/Core/Manifest/ConfigManifestTest.php @@ -181,8 +181,8 @@ class ConfigManifestTest extends SapphireTest foreach (array('dev', 'test', 'live') as $check) { $this->assertEquals( - $env == $check ? $check : 'not'.$check, - @$config[ucfirst($check).'Environment'], + $env == $check ? $check : 'not' . $check, + @$config[ucfirst($check) . 'Environment'], 'Only & except rules correctly detect environment in env ' . $env ); } diff --git a/tests/php/Core/PhpSyntaxTest.php b/tests/php/Core/PhpSyntaxTest.php index e7da91bad..605365a90 100644 --- a/tests/php/Core/PhpSyntaxTest.php +++ b/tests/php/Core/PhpSyntaxTest.php @@ -30,7 +30,7 @@ class PhpSyntaxTest extends SapphireTest $settingTests = array('short_open_tag=Off','short_open_tag=On -d asp_tags=On'); $files = $this->getAllFiles('php'); - $files[] = FRAMEWORK_PATH.'/src/Dev/Install/config-form.html'; + $files[] = FRAMEWORK_PATH . '/src/Dev/Install/config-form.html'; foreach ($files as $i => $file) { $CLI_file = escapeshellarg($file); diff --git a/tests/php/Core/Startup/ParameterConfirmationTokenTest.php b/tests/php/Core/Startup/ParameterConfirmationTokenTest.php index ff9cf2ff7..b3ae253d0 100644 --- a/tests/php/Core/Startup/ParameterConfirmationTokenTest.php +++ b/tests/php/Core/Startup/ParameterConfirmationTokenTest.php @@ -91,7 +91,7 @@ class ParameterConfirmationTokenTest extends SapphireTest // Check redirect url $home = (BASE_URL ?: '/') . '?'; - $current = Controller::join_links(BASE_URL, '/', 'anotherpage'). '?'; + $current = Controller::join_links(BASE_URL, '/', 'anotherpage') . '?'; $this->assertStringStartsWith($current, $withoutToken->redirectURL()); $this->assertStringStartsWith($current, $emptyParameter->redirectURL()); $this->assertStringStartsWith($current, $nullToken->redirectURL()); diff --git a/tests/php/Dev/CSSContentParserTest.php b/tests/php/Dev/CSSContentParserTest.php index 5eefc6738..5377e7865 100644 --- a/tests/php/Dev/CSSContentParserTest.php +++ b/tests/php/Dev/CSSContentParserTest.php @@ -39,11 +39,11 @@ HTML ); $result = $parser->getBySelector('div.one'); - $this->assertEquals("A", $result[0]['id'].''); + $this->assertEquals("A", $result[0]['id'] . ''); $result = $parser->getBySelector('div.two'); - $this->assertEquals("A", $result[0]['id'].''); + $this->assertEquals("A", $result[0]['id'] . ''); $result = $parser->getBySelector('div.three'); - $this->assertEquals("A", $result[0]['id'].''); + $this->assertEquals("A", $result[0]['id'] . ''); $result = $parser->getBySelector('div#A p.other'); $this->assertEquals("result", $result[0] . ''); diff --git a/tests/php/Dev/CSVParserTest.php b/tests/php/Dev/CSVParserTest.php index 6d596ae0d..2a48c27dc 100644 --- a/tests/php/Dev/CSVParserTest.php +++ b/tests/php/Dev/CSVParserTest.php @@ -117,7 +117,7 @@ class CSVParserTest extends SapphireTest public function testParsingWithExplicitHeaderRow() { /* If your CSV file doesn't have a header row */ - $csv = new CSVParser($this->csvPath .'PlayersWithHeader.csv'); + $csv = new CSVParser($this->csvPath . 'PlayersWithHeader.csv'); $csv->provideHeaderRow(array('__fn','__bio','__bd','__reg')); diff --git a/tests/php/Dev/DeprecationTest.php b/tests/php/Dev/DeprecationTest.php index 21455745a..194d08daf 100644 --- a/tests/php/Dev/DeprecationTest.php +++ b/tests/php/Dev/DeprecationTest.php @@ -79,7 +79,7 @@ class DeprecationTest extends SapphireTest { $this->assertEquals( TestDeprecation::get_method(), - static::class.'->testMethodNameCalculation' + static::class . '->testMethodNameCalculation' ); } diff --git a/tests/php/Dev/FixtureBlueprintTest.php b/tests/php/Dev/FixtureBlueprintTest.php index 0495dfbe6..5355d8cc3 100644 --- a/tests/php/Dev/FixtureBlueprintTest.php +++ b/tests/php/Dev/FixtureBlueprintTest.php @@ -44,11 +44,11 @@ class FixtureBlueprintTest extends SapphireTest 'ManyManyRelation' => array( array( - "=>".DataObjectRelation::class.".relation1" => array(), + "=>" . DataObjectRelation::class . ".relation1" => array(), "Label" => 'This is a label for relation 1' ), array( - "=>".DataObjectRelation::class.".relation2" => array(), + "=>" . DataObjectRelation::class . ".relation2" => array(), "Label" => 'This is a label for relation 2' ) ) @@ -109,8 +109,7 @@ class FixtureBlueprintTest extends SapphireTest 'one', array( 'ManyManyRelation' => - '=>'.DataObjectRelation::class.'.relation1,' . - '=>'.DataObjectRelation::class.'.relation2' + '=>' . DataObjectRelation::class . '.relation1,' . '=>' . DataObjectRelation::class . '.relation2' ), array( DataObjectRelation::class => array( @@ -129,8 +128,8 @@ class FixtureBlueprintTest extends SapphireTest array( // Note; using array format here, not comma separated 'HasManyRelation' => array( - '=>'.DataObjectRelation::class.'.relation1', - '=>'.DataObjectRelation::class.'.relation2' + '=>' . DataObjectRelation::class . '.relation1', + '=>' . DataObjectRelation::class . '.relation2' ) ), array( @@ -177,7 +176,7 @@ class FixtureBlueprintTest extends SapphireTest $obj = $blueprint->createObject( 'one', array( - 'ManyManyRelation' => '=>'.DataObjectRelation::class.'.unknown_identifier' + 'ManyManyRelation' => '=>' . DataObjectRelation::class . '.unknown_identifier' ), array( DataObjectRelation::class => array( @@ -202,7 +201,7 @@ class FixtureBlueprintTest extends SapphireTest $obj = $blueprint->createObject( 'one', array( - 'ManyManyRelation' => DataObjectRelation::class.'.relation1' + 'ManyManyRelation' => DataObjectRelation::class . '.relation1' ), array( DataObjectRelation::class => array( diff --git a/tests/php/Forms/FormSchemaTest.php b/tests/php/Forms/FormSchemaTest.php index 1416a4ac1..7af4d8d70 100644 --- a/tests/php/Forms/FormSchemaTest.php +++ b/tests/php/Forms/FormSchemaTest.php @@ -35,7 +35,7 @@ class FormSchemaTest extends SapphireTest { $form = new Form(null, 'TestForm', new FieldList(), new FieldList()); $formSchema = new FormSchema(); - $expected = json_decode(file_get_contents(__DIR__.'/FormSchemaTest/testGetSchema.json'), true); + $expected = json_decode(file_get_contents(__DIR__ . '/FormSchemaTest/testGetSchema.json'), true); $schema = $formSchema->getSchema($form); $this->assertInternalType('array', $schema); @@ -164,7 +164,7 @@ class FormSchemaTest extends SapphireTest ) ); $formSchema = new FormSchema(); - $expected = json_decode(file_get_contents(__DIR__.'/FormSchemaTest/testGetNestedSchema.json'), true); + $expected = json_decode(file_get_contents(__DIR__ . '/FormSchemaTest/testGetNestedSchema.json'), true); $schema = $formSchema->getSchema($form); $this->assertInternalType('array', $schema); @@ -206,7 +206,7 @@ class FormSchemaTest extends SapphireTest ); $formSchema = new FormSchema(); $schema = $formSchema->getSchema($form); - $expected = json_decode(file_get_contents(__DIR__.'/FormSchemaTest/testSchemaValidation.json'), true); + $expected = json_decode(file_get_contents(__DIR__ . '/FormSchemaTest/testSchemaValidation.json'), true); $this->assertInternalType('array', $schema); $this->assertEquals($expected, $schema); } diff --git a/tests/php/Forms/FormTest.php b/tests/php/Forms/FormTest.php index e44ffc88a..de6cb7aac 100644 --- a/tests/php/Forms/FormTest.php +++ b/tests/php/Forms/FormTest.php @@ -560,11 +560,11 @@ class FormTest extends FunctionalTest ); $this->assertEquals(200, $response->getStatusCode(), 'Submission reloads form if security token invalid'); $this->assertTrue( - stripos($response->getBody(), 'name="SecurityID" value="'.$expectedToken.'"') !== false, + stripos($response->getBody(), 'name="SecurityID" value="' . $expectedToken . '"') !== false, 'Submission reloads with correct security token after failure' ); $this->assertTrue( - stripos($response->getBody(), 'name="SecurityID" value="'.$invalidToken.'"') === false, + stripos($response->getBody(), 'name="SecurityID" value="' . $invalidToken . '"') === false, 'Submission reloads without incorrect security token after failure' ); diff --git a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php index c3777b0c4..dfbabf285 100644 --- a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php +++ b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php @@ -95,8 +95,7 @@ class GridFieldDeleteActionTest extends SapphireTest $this->expectException(HTTPResponse_Exception::class); $this->expectExceptionMessage(_t( "SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE", - "There seems to have been a technical problem. Please click the back button, ". - "refresh your browser, and try again." + "There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again." )); $this->expectExceptionCode(400); $stateID = 'testGridStateActionField'; @@ -105,7 +104,7 @@ class GridFieldDeleteActionTest extends SapphireTest 'url', array(), array( - 'action_gridFieldAlterAction?StateID='.$stateID, + 'action_gridFieldAlterAction?StateID=' . $stateID, 'SecurityID' => null, ) ); @@ -138,7 +137,7 @@ class GridFieldDeleteActionTest extends SapphireTest 'url', array(), array( - 'action_gridFieldAlterAction?StateID='.$stateID => true, + 'action_gridFieldAlterAction?StateID=' . $stateID => true, $token->getName() => $token->getValue(), ) ); @@ -172,7 +171,7 @@ class GridFieldDeleteActionTest extends SapphireTest 'url', array(), array( - 'action_gridFieldAlterAction?StateID='.$stateID=>true, + 'action_gridFieldAlterAction?StateID=' . $stateID=>true, $token->getName() => $token->getValue(), ) ); @@ -207,7 +206,7 @@ class GridFieldDeleteActionTest extends SapphireTest 'url', array(), array( - 'action_gridFieldAlterAction?StateID='.$stateID=>true, + 'action_gridFieldAlterAction?StateID=' . $stateID=>true, $token->getName() => $token->getValue(), ) ); diff --git a/tests/php/Forms/GridField/GridFieldExportButtonTest.php b/tests/php/Forms/GridField/GridFieldExportButtonTest.php index 0f6b42323..c9c1bbbeb 100644 --- a/tests/php/Forms/GridField/GridFieldExportButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldExportButtonTest.php @@ -66,9 +66,7 @@ class GridFieldExportButtonTest extends SapphireTest $button->setExportColumns(['Name' => 'My Name']); $this->assertEquals( - '"My Name"'."\n". - 'Test'."\n". - 'Test2'."\n", + '"My Name"' . "\n" . 'Test' . "\n" . 'Test2' . "\n", $button->generateExportFileData($this->gridField) ); } @@ -101,9 +99,7 @@ class GridFieldExportButtonTest extends SapphireTest ]); $this->assertEquals( - 'Name,City'."\n". - 'Test,"City city"'."\n". - 'Test2,"Quoted ""City"" 2 city"'."\n", + 'Name,City' . "\n" . 'Test,"City city"' . "\n" . 'Test2,"Quoted ""City"" 2 city"' . "\n", $button->generateExportFileData($this->gridField) ); } @@ -117,9 +113,7 @@ class GridFieldExportButtonTest extends SapphireTest ]); $this->assertEquals( - 'Name,strtolower'."\n". - 'Test,City'."\n". - 'Test2,"Quoted ""City"" 2"'."\n", + 'Name,strtolower' . "\n" . 'Test,City' . "\n" . 'Test2,"Quoted ""City"" 2"' . "\n", $button->generateExportFileData($this->gridField) ); } @@ -134,8 +128,7 @@ class GridFieldExportButtonTest extends SapphireTest $button->setCsvHasHeader(false); $this->assertEquals( - 'Test,City'."\n". - 'Test2,"Quoted ""City"" 2"'."\n", + 'Test,City' . "\n" . 'Test2,"Quoted ""City"" 2"' . "\n", $button->generateExportFileData($this->gridField) ); } @@ -154,23 +147,7 @@ class GridFieldExportButtonTest extends SapphireTest $this->gridField->setList($arrayList); $this->assertEquals( - "ID\n". - "1\n". - "2\n". - "3\n". - "4\n". - "5\n". - "6\n". - "7\n". - "8\n". - "9\n". - "10\n". - "11\n". - "12\n". - "13\n". - "14\n". - "15\n". - "16\n", + "ID\n" . "1\n" . "2\n" . "3\n" . "4\n" . "5\n" . "6\n" . "7\n" . "8\n" . "9\n" . "10\n" . "11\n" . "12\n" . "13\n" . "14\n" . "15\n" . "16\n", $button->generateExportFileData($this->gridField) ); } diff --git a/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php b/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php index 3b15ae1fb..d41c40f97 100644 --- a/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php +++ b/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php @@ -140,7 +140,7 @@ class HTMLEditorFieldTest extends FunctionalTest = '/assets/HTMLEditorFieldTest/f5c7c2f814/example__ResizedImageWzEwLDIwXQ.jpg'; $this->assertEquals($neededFilename, (string)$xml[0]['src'], 'Correct URL of resized image is set.'); - $this->assertTrue(file_exists(BASE_PATH.DIRECTORY_SEPARATOR.$neededFilename), 'File for resized image exists'); + $this->assertTrue(file_exists(BASE_PATH . DIRECTORY_SEPARATOR . $neededFilename), 'File for resized image exists'); $this->assertEquals(false, $obj->HasBrokenFile, 'Referenced image file exists.'); } diff --git a/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php b/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php index e1512b799..f272002ef 100644 --- a/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php +++ b/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php @@ -35,7 +35,7 @@ class TinyMCECombinedGeneratorTest extends SapphireTest public function testConfig() { - $module = new Module(Director::baseFolder().'/mycode', Director::baseFolder()); + $module = new Module(Director::baseFolder() . '/mycode', Director::baseFolder()); // Disable nonces $c = new TinyMCEConfig(); $c->setTheme('testtheme'); diff --git a/tests/php/Forms/HTMLEditor/TinyMCEConfigTest.php b/tests/php/Forms/HTMLEditor/TinyMCEConfigTest.php index 7178945a3..26edbb3e2 100644 --- a/tests/php/Forms/HTMLEditor/TinyMCEConfigTest.php +++ b/tests/php/Forms/HTMLEditor/TinyMCEConfigTest.php @@ -19,7 +19,7 @@ class TinyMCEConfigTest extends SapphireTest $this->markTestSkipped("Test skipped without TinyMCE resources folder being installed"); } - $langs = Director::baseFolder().'/'.ModuleResourceLoader::resourcePath($configDir).'/langs'; + $langs = Director::baseFolder() . '/' . ModuleResourceLoader::resourcePath($configDir) . '/langs'; // Test all langs exist as real files foreach (TinyMCEConfig::config()->get('tinymce_lang') as $locale => $resource) { diff --git a/tests/php/Forms/TreeDropdownFieldTest.php b/tests/php/Forms/TreeDropdownFieldTest.php index 0ef977009..dfc49bbce 100644 --- a/tests/php/Forms/TreeDropdownFieldTest.php +++ b/tests/php/Forms/TreeDropdownFieldTest.php @@ -56,7 +56,7 @@ class TreeDropdownFieldTest extends SapphireTest $this->assertContains( $folder1->Name, array_column($tree['children'], 'title'), - $folder1->Name.' is found in the json' + $folder1->Name . ' is found in the json' ); $filtered = array_filter($tree['children'], function ($entry) use ($folder1) { @@ -67,7 +67,7 @@ class TreeDropdownFieldTest extends SapphireTest $this->assertContains( $folder1Subfolder1->Name, array_column($folder1Tree['children'], 'title'), - $folder1Subfolder1->Name.' is found in the folder1 entry in the json' + $folder1Subfolder1->Name . ' is found in the folder1 entry in the json' ); } @@ -87,13 +87,13 @@ class TreeDropdownFieldTest extends SapphireTest $this->assertNotContains( $folder1->Name, array_column($tree['children'], 'title'), - $folder1->Name.' is not found in the json' + $folder1->Name . ' is not found in the json' ); $this->assertContains( $folder1Subfolder1->Name, array_column($tree['children'], 'title'), - $folder1Subfolder1->Name.' is found in the json' + $folder1Subfolder1->Name . ' is found in the json' ); } @@ -111,31 +111,30 @@ class TreeDropdownFieldTest extends SapphireTest $folder1Subfolder1 = $this->objFromFixture(Folder::class, 'folder1-subfolder1'); $parser = new CSSContentParser($tree); - $cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'. - $folder1Subfolder1->ID.' a span.item'; + $cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item'; $firstResult = $parser->getBySelector($cssPath); $this->assertEquals( $folder1Subfolder1->Name, (string)$firstResult[0], - $folder1Subfolder1->Name.' is found, nested under '.$folder1->Name + $folder1Subfolder1->Name . ' is found, nested under ' . $folder1->Name ); $subfolder = $this->objFromFixture(Folder::class, 'subfolder'); - $cssPath = 'ul.tree li#selector-TestTree-'.$subfolder->ID.' a span.item'; + $cssPath = 'ul.tree li#selector-TestTree-' . $subfolder->ID . ' a span.item'; $secondResult = $parser->getBySelector($cssPath); $this->assertEquals( $subfolder->Name, (string)$secondResult[0], - $subfolder->Name.' is found at root level' + $subfolder->Name . ' is found at root level' ); // other folders which don't contain the keyword 'sub' are not returned in search results $folder2 = $this->objFromFixture(Folder::class, 'folder2'); - $cssPath = 'ul.tree li#selector-TestTree-'.$folder2->ID.' a span.item'; + $cssPath = 'ul.tree li#selector-TestTree-' . $folder2->ID . ' a span.item'; $noResult = $parser->getBySelector($cssPath); $this->assertEmpty( $noResult, - $folder2.' is not found' + $folder2 . ' is not found' ); $field = new TreeDropdownField('TestTree', 'Test tree', File::class); @@ -149,49 +148,48 @@ class TreeDropdownFieldTest extends SapphireTest $parser = new CSSContentParser($tree); // Even if we used File as the source object, folders are still returned because Folder is a File - $cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'. - $folder1Subfolder1->ID.' a span.item'; + $cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item'; $firstResult = $parser->getBySelector($cssPath); $this->assertEquals( $folder1Subfolder1->Name, (string)$firstResult[0], - $folder1Subfolder1->Name.' is found, nested under '.$folder1->Name + $folder1Subfolder1->Name . ' is found, nested under ' . $folder1->Name ); // Looking for two files with 'sub' in their name, both under the same folder $file1 = $this->objFromFixture(File::class, 'subfolderfile1'); $file2 = $this->objFromFixture(File::class, 'subfolderfile2'); - $cssPath = 'ul.tree li#selector-TestTree-'.$subfolder->ID.' li#selector-TestTree-'.$file1->ID.' a'; + $cssPath = 'ul.tree li#selector-TestTree-' . $subfolder->ID . ' li#selector-TestTree-' . $file1->ID . ' a'; $firstResult = $parser->getBySelector($cssPath); $this->assertNotEmpty( $firstResult, - $file1->Name.' with ID '.$file1->ID.' is in search results' + $file1->Name . ' with ID ' . $file1->ID . ' is in search results' ); $this->assertEquals( $file1->Name, (string)$firstResult[0], - $file1->Name.' is found nested under '.$subfolder->Name + $file1->Name . ' is found nested under ' . $subfolder->Name ); - $cssPath = 'ul.tree li#selector-TestTree-'.$subfolder->ID.' li#selector-TestTree-'.$file2->ID.' a'; + $cssPath = 'ul.tree li#selector-TestTree-' . $subfolder->ID . ' li#selector-TestTree-' . $file2->ID . ' a'; $secondResult = $parser->getBySelector($cssPath); $this->assertNotEmpty( $secondResult, - $file2->Name.' with ID '.$file2->ID.' is in search results' + $file2->Name . ' with ID ' . $file2->ID . ' is in search results' ); $this->assertEquals( $file2->Name, (string)$secondResult[0], - $file2->Name.' is found nested under '.$subfolder->Name + $file2->Name . ' is found nested under ' . $subfolder->Name ); // other files which don't include 'sub' are not returned in search results $file3 = $this->objFromFixture(File::class, 'asdf'); - $cssPath = 'ul.tree li#selector-TestTree-'.$file3->ID; + $cssPath = 'ul.tree li#selector-TestTree-' . $file3->ID; $noResult = $parser->getBySelector($cssPath); $this->assertEmpty( $noResult, - $file3->Name.' is not found' + $file3->Name . ' is not found' ); } diff --git a/tests/php/Logging/DetailedErrorFormatterTest.php b/tests/php/Logging/DetailedErrorFormatterTest.php index 3e6e979bd..40f9b75a7 100644 --- a/tests/php/Logging/DetailedErrorFormatterTest.php +++ b/tests/php/Logging/DetailedErrorFormatterTest.php @@ -14,7 +14,7 @@ class DetailedErrorFormatterTest extends SapphireTest $formatter = new DetailedErrorFormatter(); $exception = $generator->mockException(); - $output = ''.$formatter->format(['context' => [ + $output = '' . $formatter->format(['context' => [ 'exception' => $exception, ]]); diff --git a/tests/php/ORM/DBHTMLTextTest.php b/tests/php/ORM/DBHTMLTextTest.php index e028b0de4..1070755b1 100644 --- a/tests/php/ORM/DBHTMLTextTest.php +++ b/tests/php/ORM/DBHTMLTextTest.php @@ -193,7 +193,7 @@ class DBHTMLTextTest extends SapphireTest foreach ($cases as $add) { $textObj = DBField::create_field('HTMLFragment', $orig); $result = $textObj->obj('Summary', [4, $add])->forTemplate(); - $this->assertEquals($match.Convert::raw2xml($add), $result); + $this->assertEquals($match . Convert::raw2xml($add), $result); } } diff --git a/tests/php/ORM/DBStringTest.php b/tests/php/ORM/DBStringTest.php index 9fdf39b4c..70ab2dcd5 100644 --- a/tests/php/ORM/DBStringTest.php +++ b/tests/php/ORM/DBStringTest.php @@ -26,7 +26,7 @@ class DBStringTest extends SapphireTest { /** @var DBString $dbField */ $dbField = Injector::inst()->create( - DBStringTest\MyStringField::class."(['default' => 'Here is my default text'])", + DBStringTest\MyStringField::class . "(['default' => 'Here is my default text'])", 'Myfield' ); $this->assertEquals( diff --git a/tests/php/ORM/DBTest.php b/tests/php/ORM/DBTest.php index f14d19bcf..5cae70c8e 100644 --- a/tests/php/ORM/DBTest.php +++ b/tests/php/ORM/DBTest.php @@ -19,14 +19,14 @@ class DBTest extends SapphireTest $prefix = Environment::getEnv('SS_DATABASE_PREFIX') ?: 'ss_'; $kernel->setEnvironment(Kernel::DEV); - $this->assertTrue(DB::valid_alternative_database_name($prefix.'tmpdb1234567')); - $this->assertFalse(DB::valid_alternative_database_name($prefix.'tmpdb12345678')); + $this->assertTrue(DB::valid_alternative_database_name($prefix . 'tmpdb1234567')); + $this->assertFalse(DB::valid_alternative_database_name($prefix . 'tmpdb12345678')); $this->assertFalse(DB::valid_alternative_database_name('tmpdb1234567')); $this->assertFalse(DB::valid_alternative_database_name('random')); $this->assertFalse(DB::valid_alternative_database_name('')); $kernel->setEnvironment(Kernel::LIVE); - $this->assertFalse(DB::valid_alternative_database_name($prefix.'tmpdb1234567')); + $this->assertFalse(DB::valid_alternative_database_name($prefix . 'tmpdb1234567')); $kernel->setEnvironment(Kernel::DEV); } diff --git a/tests/php/ORM/DataListTest.php b/tests/php/ORM/DataListTest.php index 363bc43d9..2bf84821b 100755 --- a/tests/php/ORM/DataListTest.php +++ b/tests/php/ORM/DataListTest.php @@ -1663,7 +1663,7 @@ class DataListTest extends SapphireTest // with a complex sort expression, so keep using column() below $teamClass = Convert::raw2sql(SubTeam::class); $list = Team::get()->sort( - 'CASE WHEN "DataObjectTest_Team"."ClassName" = \''.$teamClass.'\' THEN 0 ELSE 1 END, "Title" DESC' + 'CASE WHEN "DataObjectTest_Team"."ClassName" = \'' . $teamClass . '\' THEN 0 ELSE 1 END, "Title" DESC' ); $this->assertEquals( array( diff --git a/tests/php/ORM/DataObjectLazyLoadingTest.php b/tests/php/ORM/DataObjectLazyLoadingTest.php index e1c9e06b4..4b64bf977 100644 --- a/tests/php/ORM/DataObjectLazyLoadingTest.php +++ b/tests/php/ORM/DataObjectLazyLoadingTest.php @@ -28,14 +28,7 @@ class DataObjectLazyLoadingTest extends SapphireTest $db = DB::get_conn(); $playerList = new DataList(SubTeam::class); $playerList = $playerList->setQueriedColumns(array('ID')); - $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . - '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."ID", CASE WHEN '. - '"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . - $db->quoteString(Team::class).' END AS "RecordClassName", "DataObjectTest_Team"."Title" '. - 'FROM "DataObjectTest_Team" ' . - 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" ' . - 'WHERE ("DataObjectTest_Team"."ClassName" IN (?))' . - ' ORDER BY "DataObjectTest_Team"."Title" ASC'; + $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."ID", CASE WHEN ' . '"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END AS "RecordClassName", "DataObjectTest_Team"."Title" ' . 'FROM "DataObjectTest_Team" ' . 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" ' . 'WHERE ("DataObjectTest_Team"."ClassName" IN (?))' . ' ORDER BY "DataObjectTest_Team"."Title" ASC'; $this->assertSQLEquals($expected, $playerList->sql($parameters)); } @@ -44,14 +37,7 @@ class DataObjectLazyLoadingTest extends SapphireTest $db = DB::get_conn(); $playerList = new DataList(SubTeam::class); $playerList = $playerList->setQueriedColumns(array('Title', 'SubclassDatabaseField')); - $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . - '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", ' . - '"DataObjectTest_SubTeam"."SubclassDatabaseField", "DataObjectTest_Team"."ID", CASE WHEN ' . - '"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . - $db->quoteString(Team::class).' END AS "RecordClassName" FROM "DataObjectTest_Team" ' . - 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' . - '("DataObjectTest_Team"."ClassName" IN (?)) ' . - 'ORDER BY "DataObjectTest_Team"."Title" ASC'; + $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", ' . '"DataObjectTest_SubTeam"."SubclassDatabaseField", "DataObjectTest_Team"."ID", CASE WHEN ' . '"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END AS "RecordClassName" FROM "DataObjectTest_Team" ' . 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' . '("DataObjectTest_Team"."ClassName" IN (?)) ' . 'ORDER BY "DataObjectTest_Team"."Title" ASC'; $this->assertSQLEquals($expected, $playerList->sql($parameters)); } @@ -60,13 +46,7 @@ class DataObjectLazyLoadingTest extends SapphireTest $db = DB::get_conn(); $playerList = new DataList(SubTeam::class); $playerList = $playerList->setQueriedColumns(array('Title')); - $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . - '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", "DataObjectTest_Team"."ID", ' . - 'CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . - $db->quoteString(Team::class).' END AS "RecordClassName" FROM "DataObjectTest_Team" ' . - 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' . - '("DataObjectTest_Team"."ClassName" IN (?)) ' . - 'ORDER BY "DataObjectTest_Team"."Title" ASC'; + $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", "DataObjectTest_Team"."ID", ' . 'CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END AS "RecordClassName" FROM "DataObjectTest_Team" ' . 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' . '("DataObjectTest_Team"."ClassName" IN (?)) ' . 'ORDER BY "DataObjectTest_Team"."Title" ASC'; $this->assertSQLEquals($expected, $playerList->sql($parameters)); } @@ -75,14 +55,7 @@ class DataObjectLazyLoadingTest extends SapphireTest $db = DB::get_conn(); $playerList = new DataList(SubTeam::class); $playerList = $playerList->setQueriedColumns(array('SubclassDatabaseField')); - $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . - '"DataObjectTest_Team"."Created", "DataObjectTest_SubTeam"."SubclassDatabaseField", ' . - '"DataObjectTest_Team"."ID", CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN ' . - '"DataObjectTest_Team"."ClassName" ELSE '.$db->quoteString(Team::class).' END ' . - 'AS "RecordClassName", "DataObjectTest_Team"."Title" ' . - 'FROM "DataObjectTest_Team" LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = ' . - '"DataObjectTest_Team"."ID" WHERE ("DataObjectTest_Team"."ClassName" IN (?)) ' . - 'ORDER BY "DataObjectTest_Team"."Title" ASC'; + $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_SubTeam"."SubclassDatabaseField", ' . '"DataObjectTest_Team"."ID", CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN ' . '"DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END ' . 'AS "RecordClassName", "DataObjectTest_Team"."Title" ' . 'FROM "DataObjectTest_Team" LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = ' . '"DataObjectTest_Team"."ID" WHERE ("DataObjectTest_Team"."ClassName" IN (?)) ' . 'ORDER BY "DataObjectTest_Team"."Title" ASC'; $this->assertSQLEquals($expected, $playerList->sql($parameters)); } diff --git a/tests/php/ORM/DataObjectSchemaTest.php b/tests/php/ORM/DataObjectSchemaTest.php index fad7d8d27..da2a51d23 100644 --- a/tests/php/ORM/DataObjectSchemaTest.php +++ b/tests/php/ORM/DataObjectSchemaTest.php @@ -179,29 +179,29 @@ class DataObjectSchemaTest extends SapphireTest ); $this->assertEquals( [ - 'ID' => DataObjectSchemaTest\HasFields::class.'.PrimaryKey', - 'ClassName' => DataObjectSchemaTest\BaseDataClass::class.'.DBClassName', - 'LastEdited' => DataObjectSchemaTest\BaseDataClass::class.'.DBDatetime', - 'Created' => DataObjectSchemaTest\BaseDataClass::class.'.DBDatetime', - 'Title' => DataObjectSchemaTest\BaseDataClass::class.'.Varchar', - 'Description' => DataObjectSchemaTest\HasFields::class.'.Varchar', - 'MoneyFieldCurrency' => DataObjectSchemaTest\HasFields::class.'.Varchar(3)', - 'MoneyFieldAmount' => DataObjectSchemaTest\HasFields::class.'.Decimal(19,4)', - 'MoneyField' => DataObjectSchemaTest\HasFields::class.'.Money', + 'ID' => DataObjectSchemaTest\HasFields::class . '.PrimaryKey', + 'ClassName' => DataObjectSchemaTest\BaseDataClass::class . '.DBClassName', + 'LastEdited' => DataObjectSchemaTest\BaseDataClass::class . '.DBDatetime', + 'Created' => DataObjectSchemaTest\BaseDataClass::class . '.DBDatetime', + 'Title' => DataObjectSchemaTest\BaseDataClass::class . '.Varchar', + 'Description' => DataObjectSchemaTest\HasFields::class . '.Varchar', + 'MoneyFieldCurrency' => DataObjectSchemaTest\HasFields::class . '.Varchar(3)', + 'MoneyFieldAmount' => DataObjectSchemaTest\HasFields::class . '.Decimal(19,4)', + 'MoneyField' => DataObjectSchemaTest\HasFields::class . '.Money', ], $schema->fieldSpecs(HasFields::class, DataObjectSchema::INCLUDE_CLASS) ); // DB_ONLY excludes composite field MoneyField $this->assertEquals( [ - 'ID' => DataObjectSchemaTest\HasFields::class.'.PrimaryKey', - 'ClassName' => DataObjectSchemaTest\BaseDataClass::class.'.DBClassName', - 'LastEdited' => DataObjectSchemaTest\BaseDataClass::class.'.DBDatetime', - 'Created' => DataObjectSchemaTest\BaseDataClass::class.'.DBDatetime', - 'Title' => DataObjectSchemaTest\BaseDataClass::class.'.Varchar', - 'Description' => DataObjectSchemaTest\HasFields::class.'.Varchar', - 'MoneyFieldCurrency' => DataObjectSchemaTest\HasFields::class.'.Varchar(3)', - 'MoneyFieldAmount' => DataObjectSchemaTest\HasFields::class.'.Decimal(19,4)' + 'ID' => DataObjectSchemaTest\HasFields::class . '.PrimaryKey', + 'ClassName' => DataObjectSchemaTest\BaseDataClass::class . '.DBClassName', + 'LastEdited' => DataObjectSchemaTest\BaseDataClass::class . '.DBDatetime', + 'Created' => DataObjectSchemaTest\BaseDataClass::class . '.DBDatetime', + 'Title' => DataObjectSchemaTest\BaseDataClass::class . '.Varchar', + 'Description' => DataObjectSchemaTest\HasFields::class . '.Varchar', + 'MoneyFieldCurrency' => DataObjectSchemaTest\HasFields::class . '.Varchar(3)', + 'MoneyFieldAmount' => DataObjectSchemaTest\HasFields::class . '.Decimal(19,4)' ], $schema->fieldSpecs( HasFields::class, @@ -212,10 +212,10 @@ class DataObjectSchemaTest extends SapphireTest // Use all options at once $this->assertEquals( [ - 'ID' => DataObjectSchemaTest\HasFields::class.'.PrimaryKey', - 'Description' => DataObjectSchemaTest\HasFields::class.'.Varchar', - 'MoneyFieldCurrency' => DataObjectSchemaTest\HasFields::class.'.Varchar(3)', - 'MoneyFieldAmount' => DataObjectSchemaTest\HasFields::class.'.Decimal(19,4)', + 'ID' => DataObjectSchemaTest\HasFields::class . '.PrimaryKey', + 'Description' => DataObjectSchemaTest\HasFields::class . '.Varchar', + 'MoneyFieldCurrency' => DataObjectSchemaTest\HasFields::class . '.Varchar(3)', + 'MoneyFieldAmount' => DataObjectSchemaTest\HasFields::class . '.Decimal(19,4)', ], $schema->fieldSpecs( HasFields::class, diff --git a/tests/php/ORM/DataObjectTest.php b/tests/php/ORM/DataObjectTest.php index d25edc1f7..7aaf739a5 100644 --- a/tests/php/ORM/DataObjectTest.php +++ b/tests/php/ORM/DataObjectTest.php @@ -155,8 +155,7 @@ class DataObjectTest extends SapphireTest $helper = $obj->dbObject($field); $this->assertTrue( ($helper instanceof DBField), - "for {$field} expected helper to be DBField, but was " . - (is_object($helper) ? get_class($helper) : "null") + "for {$field} expected helper to be DBField, but was " . (is_object($helper) ? get_class($helper) : "null") ); } } diff --git a/tests/php/ORM/DataObjectTest/CEO.php b/tests/php/ORM/DataObjectTest/CEO.php index 99274fffc..f6a345cf4 100644 --- a/tests/php/ORM/DataObjectTest/CEO.php +++ b/tests/php/ORM/DataObjectTest/CEO.php @@ -7,8 +7,8 @@ class CEO extends Staff private static $table_name = 'DataObjectTest_CEO'; private static $belongs_to = array( - 'Company' => Company::class.'.CEO', - 'PreviousCompany' => Company::class.'.PreviousCEO', - 'CompanyOwned' => Company::class.'.Owner' + 'Company' => Company::class . '.CEO', + 'PreviousCompany' => Company::class . '.PreviousCEO', + 'CompanyOwned' => Company::class . '.Owner' ); } diff --git a/tests/php/ORM/DataObjectTest/Company.php b/tests/php/ORM/DataObjectTest/Company.php index 40ea9e562..c17e47d40 100644 --- a/tests/php/ORM/DataObjectTest/Company.php +++ b/tests/php/ORM/DataObjectTest/Company.php @@ -20,7 +20,7 @@ class Company extends DataObject implements TestOnly ]; private static $has_many = array( - 'CurrentStaff' => Staff::class.'.CurrentCompany', - 'PreviousStaff' => Staff::class.'.PreviousCompany' + 'CurrentStaff' => Staff::class . '.CurrentCompany', + 'PreviousStaff' => Staff::class . '.PreviousCompany' ); } diff --git a/tests/php/ORM/DataObjectTest/Player.php b/tests/php/ORM/DataObjectTest/Player.php index ef49ce58f..666afdf13 100644 --- a/tests/php/ORM/DataObjectTest/Player.php +++ b/tests/php/ORM/DataObjectTest/Player.php @@ -24,13 +24,13 @@ class Player extends Member implements TestOnly ); private static $has_many = array( - 'Fans' => Fan::class.'.Favourite', // Polymorphic - Player fans - 'CaptainTeams' => Team::class.'.Captain', - 'FoundingTeams' => Team::class.'.Founder' + 'Fans' => Fan::class . '.Favourite', // Polymorphic - Player fans + 'CaptainTeams' => Team::class . '.Captain', + 'FoundingTeams' => Team::class . '.Founder' ); private static $belongs_to = array( - 'CompanyOwned' => Company::class.'.Owner' + 'CompanyOwned' => Company::class . '.Owner' ); private static $searchable_fields = array( diff --git a/tests/php/ORM/DataObjectTest/Team.php b/tests/php/ORM/DataObjectTest/Team.php index 999250843..d9436a1fa 100644 --- a/tests/php/ORM/DataObjectTest/Team.php +++ b/tests/php/ORM/DataObjectTest/Team.php @@ -39,8 +39,8 @@ class Team extends DataObject implements TestOnly private static $has_many = array( 'SubTeams' => SubTeam::class, 'Comments' => TeamComment::class, - 'Fans' => Fan::class.'.Favourite', // Polymorphic - Team fans - 'PlayerFans' => Player::class.'.FavouriteTeam' + 'Fans' => Fan::class . '.Favourite', // Polymorphic - Team fans + 'PlayerFans' => Player::class . '.FavouriteTeam' ); private static $many_many = array( @@ -54,8 +54,8 @@ class Team extends DataObject implements TestOnly ); private static $belongs_many_many = array( - 'Sponsors' => EquipmentCompany::class.'.SponsoredTeams', - 'EquipmentSuppliers' => EquipmentCompany::class.'.EquipmentCustomers' + 'Sponsors' => EquipmentCompany::class . '.SponsoredTeams', + 'EquipmentSuppliers' => EquipmentCompany::class . '.EquipmentCustomers' ); private static $summary_fields = array( diff --git a/tests/php/ORM/ManyManyListTest.php b/tests/php/ORM/ManyManyListTest.php index 7c5c0e415..aa6218474 100644 --- a/tests/php/ORM/ManyManyListTest.php +++ b/tests/php/ORM/ManyManyListTest.php @@ -356,15 +356,15 @@ class ManyManyListTest extends SapphireTest // ensure that ManyManyListTest_ExtraFields_Clients.ValueCurrency is // selected. $expected = 'SELECT DISTINCT "ManyManyListTest_ExtraFields_Clients"."WorthCurrency",' - .' "ManyManyListTest_ExtraFields_Clients"."WorthAmount", "ManyManyListTest_ExtraFields_Clients"."Reference",' - .' "ManyManyListTest_ExtraFields"."ClassName", "ManyManyListTest_ExtraFields"."LastEdited",' - .' "ManyManyListTest_ExtraFields"."Created", "ManyManyListTest_ExtraFields"."ID",' - .' CASE WHEN "ManyManyListTest_ExtraFields"."ClassName" IS NOT NULL THEN' - .' "ManyManyListTest_ExtraFields"."ClassName" ELSE '. Convert::raw2sql(ManyManyListTest\ExtraFieldsObject::class, true) - .' END AS "RecordClassName" FROM "ManyManyListTest_ExtraFields" INNER JOIN' - .' "ManyManyListTest_ExtraFields_Clients" ON' - .' "ManyManyListTest_ExtraFields_Clients"."ManyManyListTest_ExtraFieldsID" =' - .' "ManyManyListTest_ExtraFields"."ID"'; + . ' "ManyManyListTest_ExtraFields_Clients"."WorthAmount", "ManyManyListTest_ExtraFields_Clients"."Reference",' + . ' "ManyManyListTest_ExtraFields"."ClassName", "ManyManyListTest_ExtraFields"."LastEdited",' + . ' "ManyManyListTest_ExtraFields"."Created", "ManyManyListTest_ExtraFields"."ID",' + . ' CASE WHEN "ManyManyListTest_ExtraFields"."ClassName" IS NOT NULL THEN' + . ' "ManyManyListTest_ExtraFields"."ClassName" ELSE ' . Convert::raw2sql(ManyManyListTest\ExtraFieldsObject::class, true) + . ' END AS "RecordClassName" FROM "ManyManyListTest_ExtraFields" INNER JOIN' + . ' "ManyManyListTest_ExtraFields_Clients" ON' + . ' "ManyManyListTest_ExtraFields_Clients"."ManyManyListTest_ExtraFieldsID" =' + . ' "ManyManyListTest_ExtraFields"."ID"'; $this->assertSQLEquals($expected, $list->sql($parameters)); } diff --git a/tests/php/ORM/SQLSelectTest.php b/tests/php/ORM/SQLSelectTest.php index fd2de1feb..1a6d2de91 100755 --- a/tests/php/ORM/SQLSelectTest.php +++ b/tests/php/ORM/SQLSelectTest.php @@ -478,8 +478,8 @@ class SQLSelectTest extends SapphireTest $query->addLeftJoin('MyLastTable', 'MyOtherTable.ID = MyLastTable.ID'); $this->assertSQLEquals( - 'SELECT * FROM MyTable '. - 'INNER JOIN "MyOtherTable" ON MyOtherTable.ID = 2 '. + 'SELECT * FROM MyTable ' . + 'INNER JOIN "MyOtherTable" ON MyOtherTable.ID = 2 ' . 'LEFT JOIN "MyLastTable" ON MyOtherTable.ID = MyLastTable.ID', $query->sql($parameters) ); @@ -490,8 +490,8 @@ class SQLSelectTest extends SapphireTest $query->addLeftJoin('MyLastTable', 'MyOtherTable.ID = MyLastTable.ID', 'table2'); $this->assertSQLEquals( - 'SELECT * FROM MyTable '. - 'INNER JOIN "MyOtherTable" AS "table1" ON MyOtherTable.ID = 2 '. + 'SELECT * FROM MyTable ' . + 'INNER JOIN "MyOtherTable" AS "table1" ON MyOtherTable.ID = 2 ' . 'LEFT JOIN "MyLastTable" AS "table2" ON MyOtherTable.ID = MyLastTable.ID', $query->sql($parameters) ); @@ -516,7 +516,7 @@ class SQLSelectTest extends SapphireTest $query->setOrderBy('COALESCE(Mlt.MyLastTableCount, 0) DESC'); $this->assertSQLEquals( - 'SELECT *, COALESCE(Mlt.MyLastTableCount, 0) AS "_SortColumn0" FROM MyTable '. + 'SELECT *, COALESCE(Mlt.MyLastTableCount, 0) AS "_SortColumn0" FROM MyTable ' . 'INNER JOIN (SELECT * FROM MyOtherTable) AS "Mot" ON Mot.MyTableID = MyTable.ID ' . 'LEFT JOIN (SELECT MyLastTable.MyOtherTableID, COUNT(1) as MyLastTableCount FROM MyLastTable ' . 'GROUP BY MyOtherTableID) AS "Mlt" ON Mlt.MyOtherTableID = Mot.ID ' . diff --git a/tests/php/Security/InheritedPermissionsTest.php b/tests/php/Security/InheritedPermissionsTest.php index 0d4cbc7f6..5b9258908 100644 --- a/tests/php/Security/InheritedPermissionsTest.php +++ b/tests/php/Security/InheritedPermissionsTest.php @@ -35,7 +35,7 @@ class InheritedPermissionsTest extends SapphireTest ->setDefaultPermissions($this->rootPermissions = new TestDefaultPermissionChecker()); Injector::inst()->registerService( $permission, - PermissionChecker::class.'.testpermissions' + PermissionChecker::class . '.testpermissions' ); // Reset root permission diff --git a/tests/php/Security/InheritedPermissionsTest/TestPermissionNode.php b/tests/php/Security/InheritedPermissionsTest/TestPermissionNode.php index f8f321943..2e06d6149 100644 --- a/tests/php/Security/InheritedPermissionsTest/TestPermissionNode.php +++ b/tests/php/Security/InheritedPermissionsTest/TestPermissionNode.php @@ -40,7 +40,7 @@ class TestPermissionNode extends DataObject implements TestOnly public static function getInheritedPermissions() { /** @var InheritedPermissions $permissions */ - return Injector::inst()->get(PermissionChecker::class.'.testpermissions'); + return Injector::inst()->get(PermissionChecker::class . '.testpermissions'); } public function canEdit($member = null) diff --git a/tests/php/Security/MemberTest.php b/tests/php/Security/MemberTest.php index b75c90155..8476380ca 100644 --- a/tests/php/Security/MemberTest.php +++ b/tests/php/Security/MemberTest.php @@ -246,7 +246,7 @@ class MemberTest extends FunctionalTest "testuser@example.com", null, 'Your password reset link', - '/Security\/changepassword\?m='.$member->ID.'&t=[^"]+/' + '/Security\/changepassword\?m=' . $member->ID . '&t=[^"]+/' ); } @@ -805,11 +805,11 @@ class MemberTest extends FunctionalTest $this->assertTrue( in_array($admin->getTitle(), $members), - $admin->getTitle().' should be in the returned list.' + $admin->getTitle() . ' should be in the returned list.' ); $this->assertTrue( in_array($otherAdmin->getTitle(), $members), - $otherAdmin->getTitle().' should be in the returned list.' + $otherAdmin->getTitle() . ' should be in the returned list.' ); $this->assertEquals(2, count($members), 'There should be 2 members from the admin group'); } @@ -920,7 +920,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':'.$token, + 'alc_enc' => $m1->ID . ':' . $token, 'alc_device' => $firstHash->DeviceID ) ); @@ -941,7 +941,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':asdfasd'.str_rot13($token), + 'alc_enc' => $m1->ID . ':asdfasd' . str_rot13($token), 'alc_device' => $firstHash->DeviceID ) ); @@ -952,7 +952,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':'.$token, + 'alc_enc' => $m1->ID . ':' . $token, 'alc_device' => str_rot13($firstHash->DeviceID) ) ); @@ -1000,7 +1000,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':'.$token, + 'alc_enc' => $m1->ID . ':' . $token, 'alc_device' => $firstHash->DeviceID ) ); @@ -1028,7 +1028,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':'.$token, + 'alc_enc' => $m1->ID . ':' . $token, 'alc_device' => $firstHash->DeviceID ) ); @@ -1076,7 +1076,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':'.$firstToken, + 'alc_enc' => $m1->ID . ':' . $firstToken, 'alc_device' => $firstHash->DeviceID ) ); @@ -1101,7 +1101,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':'.$secondToken, + 'alc_enc' => $m1->ID . ':' . $secondToken, 'alc_device' => $secondHash->DeviceID ) ); @@ -1114,7 +1114,7 @@ class MemberTest extends FunctionalTest $this->session(), null, array( - 'alc_enc' => $m1->ID.':'.$secondToken, + 'alc_enc' => $m1->ID . ':' . $secondToken, 'alc_device' => $secondHash->DeviceID ) ); diff --git a/tests/php/Security/SecurityTest.php b/tests/php/Security/SecurityTest.php index 469371ec0..9a419c32d 100644 --- a/tests/php/Security/SecurityTest.php +++ b/tests/php/Security/SecurityTest.php @@ -404,7 +404,7 @@ class SecurityTest extends FunctionalTest $expiredResponse = $this->doTestLoginForm('expired@silverstripe.com', '1nitialPassword'); $this->assertEquals(302, $expiredResponse->getStatusCode()); $this->assertEquals( - Director::absoluteURL('Security/changepassword').'?BackURL=test%2Flink', + Director::absoluteURL('Security/changepassword') . '?BackURL=test%2Flink', Director::absoluteURL($expiredResponse->getHeader('Location')) ); $this->assertEquals( @@ -471,7 +471,7 @@ class SecurityTest extends FunctionalTest $token = $admin->generateAutologinTokenAndStoreHash(); // Check. - $response = $this->get('Security/changepassword/?m='.$admin->ID.'&t=' . $token); + $response = $this->get('Security/changepassword/?m=' . $admin->ID . '&t=' . $token); $this->assertEquals(302, $response->getStatusCode()); $this->assertEquals( Director::absoluteURL('Security/changepassword'), @@ -533,8 +533,7 @@ class SecurityTest extends FunctionalTest } $msg = _t( 'SilverStripe\\Security\\Member.ERRORLOCKEDOUT2', - 'Your account has been temporarily disabled because of too many failed attempts at ' . - 'logging in. Please try again in {count} minutes.', + 'Your account has been temporarily disabled because of too many failed attempts at ' . 'logging in. Please try again in {count} minutes.', null, array('count' => 15) ); diff --git a/tests/php/View/Parsers/ShortcodeParserTest.php b/tests/php/View/Parsers/ShortcodeParserTest.php index b9471317d..5abbadb36 100644 --- a/tests/php/View/Parsers/ShortcodeParserTest.php +++ b/tests/php/View/Parsers/ShortcodeParserTest.php @@ -83,8 +83,7 @@ class ShortcodeParserTest extends SapphireTest { $tests = array( '[test_shortcode]', - '[test_shortcode ]', '[test_shortcode,]', '[test_shortcode, ]'. - '[test_shortcode/]', '[test_shortcode /]', '[test_shortcode,/]', '[test_shortcode, /]' + '[test_shortcode ]', '[test_shortcode,]', '[test_shortcode, ]' . '[test_shortcode/]', '[test_shortcode /]', '[test_shortcode,/]', '[test_shortcode, /]' ); foreach ($tests as $test) { diff --git a/tests/php/View/RequirementsTest.php b/tests/php/View/RequirementsTest.php index a620817fd..ca742cf90 100644 --- a/tests/php/View/RequirementsTest.php +++ b/tests/php/View/RequirementsTest.php @@ -585,7 +585,7 @@ class RequirementsTest extends SapphireTest /* BLOCKED UNCOMBINED FILES ARE NOT INCLUDED */ $this->setupCombinedRequirements($backend); - $backend->block($basePath .'/javascript/RequirementsTest_b.js'); + $backend->block($basePath . '/javascript/RequirementsTest_b.js'); $combinedFileName2 = '/_combinedfiles/RequirementsTest_bc-3748f67.js'; // SHA1 without file b included $combinedFilePath2 = TestAssetStore::base_path() . $combinedFileName2; clearstatcache(); // needed to get accurate file_exists() results @@ -750,22 +750,22 @@ class RequirementsTest extends SapphireTest // Note: SSViewer theme automatically registered due to 'templates' directory $data->renderWith('RequirementsTest_Conditionals'); - $this->assertFileIncluded($backend, 'css', $testPath .'/css/RequirementsTest_a.css'); + $this->assertFileIncluded($backend, 'css', $testPath . '/css/RequirementsTest_a.css'); $this->assertFileIncluded( $backend, 'js', array( - $testPath .'/javascript/RequirementsTest_b.js', - $testPath .'/javascript/RequirementsTest_c.js' + $testPath . '/javascript/RequirementsTest_b.js', + $testPath . '/javascript/RequirementsTest_c.js' ) ); - $this->assertFileNotIncluded($backend, 'js', $testPath .'/javascript/RequirementsTest_a.js'); + $this->assertFileNotIncluded($backend, 'js', $testPath . '/javascript/RequirementsTest_a.js'); $this->assertFileNotIncluded( $backend, 'css', array( - $testPath .'/css/RequirementsTest_b.css', - $testPath .'/css/RequirementsTest_c.css' + $testPath . '/css/RequirementsTest_b.css', + $testPath . '/css/RequirementsTest_c.css' ) ); $backend->clear(); @@ -775,22 +775,22 @@ class RequirementsTest extends SapphireTest ) ); $data->renderWith('RequirementsTest_Conditionals'); - $this->assertFileNotIncluded($backend, 'css', $testPath .'/css/RequirementsTest_a.css'); + $this->assertFileNotIncluded($backend, 'css', $testPath . '/css/RequirementsTest_a.css'); $this->assertFileNotIncluded( $backend, 'js', array( - $testPath .'/javascript/RequirementsTest_b.js', - $testPath .'/javascript/RequirementsTest_c.js' + $testPath . '/javascript/RequirementsTest_b.js', + $testPath . '/javascript/RequirementsTest_c.js' ) ); - $this->assertFileIncluded($backend, 'js', $testPath .'/javascript/RequirementsTest_a.js'); + $this->assertFileIncluded($backend, 'js', $testPath . '/javascript/RequirementsTest_a.js'); $this->assertFileIncluded( $backend, 'css', array( - $testPath .'/css/RequirementsTest_b.css', - $testPath .'/css/RequirementsTest_c.css' + $testPath . '/css/RequirementsTest_b.css', + $testPath . '/css/RequirementsTest_c.css' ) ); Requirements::set_backend($holder); @@ -929,10 +929,10 @@ EOS $backend = Injector::inst()->create(Requirements_Backend::class); $this->setupRequirements($backend); - $backend->javascript($basePath .'/javascript/RequirementsTest_a.js'); - $backend->javascript($basePath .'/javascript/RequirementsTest_b.js?foo=bar&bla=blubb'); - $backend->css($basePath .'/css/RequirementsTest_a.css'); - $backend->css($basePath .'/css/RequirementsTest_b.css?foo=bar&bla=blubb'); + $backend->javascript($basePath . '/javascript/RequirementsTest_a.js'); + $backend->javascript($basePath . '/javascript/RequirementsTest_b.js?foo=bar&bla=blubb'); + $backend->css($basePath . '/css/RequirementsTest_a.css'); + $backend->css($basePath . '/css/RequirementsTest_b.css?foo=bar&bla=blubb'); $urlGenerator->setNonceStyle('mtime'); $html = $backend->includeInHTML($template); diff --git a/tests/php/View/SSViewerTest.php b/tests/php/View/SSViewerTest.php index 2f3351002..098a2272b 100644 --- a/tests/php/View/SSViewerTest.php +++ b/tests/php/View/SSViewerTest.php @@ -206,7 +206,7 @@ class SSViewerTest extends SapphireTest if (!$data) { $data = new SSViewerTest\TestFixture(); } - return trim(''.$t->process($data)); + return trim('' . $t->process($data)); } public function testRequirements() @@ -254,7 +254,7 @@ class SSViewerTest extends SapphireTest // and make sure the combined content matches the input content, i.e. no loss of functionality if (!file_exists($combinedTestFilePath)) { - $this->fail('No combined file was created at expected path: '.$combinedTestFilePath); + $this->fail('No combined file was created at expected path: ' . $combinedTestFilePath); } $combinedTestFileContents = file_get_contents($combinedTestFilePath); $this->assertContains($jsFileContents, $combinedTestFileContents); @@ -1398,7 +1398,7 @@ after' 'BazBarQux', $this->render( '<% with Foo.Bar.Baz %>{$Name}<% with $Up %>{$Name}{$Qux.Name}<% end_with %>' - .'<% end_with %>', + . '<% end_with %>', $data ) ); @@ -1586,7 +1586,7 @@ after' public function testLayout() { $this->useTestTheme( - __DIR__.'/SSViewerTest', + __DIR__ . '/SSViewerTest', 'layouttest', function () { $template = new SSViewer(array('Page')); @@ -1871,7 +1871,7 @@ EOC; ), ); foreach ($templates as $template) { - $this->_renderWithSourceFileComments('SSViewerTestComments/'.$template['name'], $template['expected']); + $this->_renderWithSourceFileComments('SSViewerTestComments/' . $template['name'], $template['expected']); } } private function _renderWithSourceFileComments($name, $expected) @@ -1935,7 +1935,7 @@ EOC; ); } else { $this->markTestSkipped( - 'Requirement will always fail if the framework dir is not '. + 'Requirement will always fail if the framework dir is not ' . 'named \'framework\', since templates require hard coded paths' ); } diff --git a/tests/php/i18n/i18nTest.php b/tests/php/i18n/i18nTest.php index fa16bab6e..be0e85f7d 100644 --- a/tests/php/i18n/i18nTest.php +++ b/tests/php/i18n/i18nTest.php @@ -81,17 +81,17 @@ class i18nTest extends SapphireTest $provider = Injector::inst()->get(MessageProvider::class); $provider->getTranslator()->addResource( 'array', - [ i18nTest\TestDataObject::class.'.MyProperty' => 'MyProperty' ], + [ i18nTest\TestDataObject::class . '.MyProperty' => 'MyProperty' ], 'en_US' ); $provider->getTranslator()->addResource( 'array', - [ i18nTest\TestDataObject::class.'.MyProperty' => 'Mein Attribut' ], + [ i18nTest\TestDataObject::class . '.MyProperty' => 'Mein Attribut' ], 'de_DE' ); $provider->getTranslator()->addResource( 'array', - [ i18nTest\TestDataObject::class.'.MyUntranslatedProperty' => 'Mein Attribut' ], + [ i18nTest\TestDataObject::class . '.MyUntranslatedProperty' => 'Mein Attribut' ], 'en_US' ); @@ -113,12 +113,12 @@ class i18nTest extends SapphireTest $provider = Injector::inst()->get(MessageProvider::class); $provider->getTranslator()->addResource( 'array', - [ i18nTest\TestObject::class.'.MyProperty' => 'Untranslated' ], + [ i18nTest\TestObject::class . '.MyProperty' => 'Untranslated' ], 'en_US' ); $provider->getTranslator()->addResource( 'array', - [ i18nTest\TestObject::class.'.my_translatable_property' => 'Übersetzt' ], + [ i18nTest\TestObject::class . '.my_translatable_property' => 'Übersetzt' ], 'de_DE' ); @@ -260,7 +260,7 @@ class i18nTest extends SapphireTest // Test missing entity key $translated = i18n::_t( - $entity.'_DOES_NOT_EXIST', + $entity . '_DOES_NOT_EXIST', $default, array("name"=>"Mark", "greeting"=>"welcome", "goodbye"=>"bye") ); @@ -341,7 +341,7 @@ class i18nTest extends SapphireTest //test injected calls $this->assertContains( Convert::nl2os( - "TRANS Hello ".Director::absoluteBaseURL()." ".i18n::get_locale().". But it is late, global calls\n" + "TRANS Hello " . Director::absoluteBaseURL() . " " . i18n::get_locale() . ". But it is late, global calls\n" ), $parsedHtml, "Testing a translation with just entity and injection array, but with global variables injected in" diff --git a/tests/php/i18n/i18nTest/MyObject.php b/tests/php/i18n/i18nTest/MyObject.php index 2ccb995c5..b4d4e787c 100644 --- a/tests/php/i18n/i18nTest/MyObject.php +++ b/tests/php/i18n/i18nTest/MyObject.php @@ -28,7 +28,7 @@ class MyObject extends DataObject implements TestOnly { $entities = parent::provideI18nEntities(); return array_merge($entities, [ - LeftAndMain::class.'.OTHER_TITLE' => [ + LeftAndMain::class . '.OTHER_TITLE' => [ 'default' => 'Other title', 'module' => 'admin', ], diff --git a/tests/php/i18n/i18nTest/TestDataObject.php b/tests/php/i18n/i18nTest/TestDataObject.php index 69145034b..bb93b1480 100644 --- a/tests/php/i18n/i18nTest/TestDataObject.php +++ b/tests/php/i18n/i18nTest/TestDataObject.php @@ -34,7 +34,7 @@ class TestDataObject extends DataObject implements TestOnly public function fieldLabels($includerelations = true) { $labels = parent::fieldLabels($includerelations); - $labels['MyProperty'] = _t(__CLASS__.'.MyProperty', 'My Property'); + $labels['MyProperty'] = _t(__CLASS__ . '.MyProperty', 'My Property'); return $labels; } diff --git a/tests/php/i18n/i18nTest/TestObject.php b/tests/php/i18n/i18nTest/TestObject.php index 3b214f64e..3d7e7df6a 100644 --- a/tests/php/i18n/i18nTest/TestObject.php +++ b/tests/php/i18n/i18nTest/TestObject.php @@ -11,13 +11,13 @@ class TestObject implements TestOnly, i18nEntityProvider public static function my_translatable_property() { - return _t(__CLASS__.".my_translatable_property", self::$my_translatable_property); + return _t(__CLASS__ . ".my_translatable_property", self::$my_translatable_property); } public function provideI18nEntities() { return [ - __CLASS__.".my_translatable_property" => self::$my_translatable_property, + __CLASS__ . ".my_translatable_property" => self::$my_translatable_property, ]; } }