From: Wouter Wolters Date: Fri, 20 Nov 2015 15:33:31 +0000 (+0100) Subject: [TASK] Use single quotes instead of double quotes X-Git-Tag: 7.6.1~184 X-Git-Url: https://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/refs/changes/30/44830/3 [TASK] Use single quotes instead of double quotes Resolves: #71735 Releases: master Change-Id: Iabf78aeab4262909980351a1570d9b561e94ff7f Reviewed-on: https://review.typo3.org/44830 Reviewed-by: Michael Oehlhof Reviewed-by: Markus Klein Tested-by: Markus Klein Reviewed-by: Oliver Hader Tested-by: Oliver Hader --- diff --git a/Build/.php_cs b/Build/.php_cs index 119b5ce..c924a6a 100644 --- a/Build/.php_cs +++ b/Build/.php_cs @@ -61,6 +61,7 @@ return Symfony\CS\Config\Config::create() 'unused_use', 'concat_with_spaces', 'whitespacy_lines', - 'ordered_use' + 'ordered_use', + 'single_quote' ]) ->finder($finder); \ No newline at end of file diff --git a/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php b/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php index 0756cb5..288c673 100644 --- a/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php @@ -263,26 +263,26 @@ class PaletteAndSingleContainer extends AbstractContainer $numberOfItems = count($fields); $colWidth = (int)floor(12 / $numberOfItems); // Column class calculation - $colClass = "col-md-12"; + $colClass = 'col-md-12'; $colClear = array(); if ($colWidth == 6) { - $colClass = "col-sm-6"; + $colClass = 'col-sm-6'; $colClear = array( 2 => 'visible-sm-block visible-md-block visible-lg-block', ); } elseif ($colWidth === 4) { - $colClass = "col-sm-4"; + $colClass = 'col-sm-4'; $colClear = array( 3 => 'visible-sm-block visible-md-block visible-lg-block', ); } elseif ($colWidth === 3) { - $colClass = "col-sm-6 col-md-3"; + $colClass = 'col-sm-6 col-md-3'; $colClear = array( 2 => 'visible-sm-block', 4 => 'visible-md-block visible-lg-block', ); } elseif ($colWidth <= 2) { - $colClass = "checkbox-column col-sm-6 col-md-3 col-lg-2"; + $colClass = 'checkbox-column col-sm-6 col-md-3 col-lg-2'; $colClear = array( 2 => 'visible-sm-block', 4 => 'visible-md-block', diff --git a/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php b/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php index f52471f..f34816d 100644 --- a/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php @@ -45,26 +45,26 @@ class CheckboxElement extends AbstractFormElement $cols = (int)$this->data['parameterArray']['fieldConf']['config']['cols']; if ($cols > 1) { $colWidth = (int)floor(12 / $cols); - $colClass = "col-md-12"; + $colClass = 'col-md-12'; $colClear = array(); if ($colWidth == 6) { - $colClass = "col-sm-6"; + $colClass = 'col-sm-6'; $colClear = array( 2 => 'visible-sm-block visible-md-block visible-lg-block', ); } elseif ($colWidth === 4) { - $colClass = "col-sm-4"; + $colClass = 'col-sm-4'; $colClear = array( 3 => 'visible-sm-block visible-md-block visible-lg-block', ); } elseif ($colWidth === 3) { - $colClass = "col-sm-6 col-md-3"; + $colClass = 'col-sm-6 col-md-3'; $colClear = array( 2 => 'visible-sm-block', 4 => 'visible-md-block visible-lg-block', ); } elseif ($colWidth <= 2) { - $colClass = "checkbox-column col-sm-6 col-md-3 col-lg-2"; + $colClass = 'checkbox-column col-sm-6 col-md-3 col-lg-2'; $colClear = array( 2 => 'visible-sm-block', 4 => 'visible-md-block', @@ -120,7 +120,7 @@ class CheckboxElement extends AbstractFormElement protected function renderSingleCheckboxElement($label, $itemCounter, $formElementValue, $numberOfItems, $additionalInformation, $disabled) { $config = $additionalInformation['fieldConf']['config']; - $inline = !empty($config['cols']) && $config['cols'] === "inline"; + $inline = !empty($config['cols']) && $config['cols'] === 'inline'; $checkboxParameters = $this->checkBoxParams( $additionalInformation['itemFormElName'], $formElementValue, diff --git a/typo3/sysext/backend/Classes/Provider/PageTsBackendLayoutDataProvider.php b/typo3/sysext/backend/Classes/Provider/PageTsBackendLayoutDataProvider.php index 3acd9a1..8325a7c 100644 --- a/typo3/sysext/backend/Classes/Provider/PageTsBackendLayoutDataProvider.php +++ b/typo3/sysext/backend/Classes/Provider/PageTsBackendLayoutDataProvider.php @@ -181,7 +181,7 @@ class PageTsBackendLayoutDataProvider implements DataProviderInterface $config = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($data['config.']); $backendLayout['config'] = ''; foreach ($config as $row => $value) { - $backendLayout['config'] .= $row . " = " . $value . "\r\n"; + $backendLayout['config'] .= $row . ' = ' . $value . "\r\n"; } return $backendLayout; } diff --git a/typo3/sysext/core/Classes/Database/DatabaseConnection.php b/typo3/sysext/core/Classes/Database/DatabaseConnection.php index 007fa68..d5b5944 100644 --- a/typo3/sysext/core/Classes/Database/DatabaseConnection.php +++ b/typo3/sysext/core/Classes/Database/DatabaseConnection.php @@ -1373,7 +1373,7 @@ class DatabaseConnection public function admin_get_dbs() { $dbArr = array(); - $db_list = $this->query("SELECT SCHEMA_NAME FROM information_schema.SCHEMATA"); + $db_list = $this->query('SELECT SCHEMA_NAME FROM information_schema.SCHEMATA'); if ($db_list === false) { throw new \RuntimeException( 'MySQL Error: Cannot get tablenames: "' . $this->sql_error() . '"!', diff --git a/typo3/sysext/core/Classes/Package/Package.php b/typo3/sysext/core/Classes/Package/Package.php index a4eb9cb..c19645b 100644 --- a/typo3/sysext/core/Classes/Package/Package.php +++ b/typo3/sysext/core/Classes/Package/Package.php @@ -119,8 +119,8 @@ class Package implements PackageInterface protected function loadFlagsFromComposerManifest() { $extraFlags = $this->getValueFromComposerManifest('extra'); - if ($extraFlags !== null && isset($extraFlags->{"typo3/cms"}->{"Package"})) { - foreach ($extraFlags->{"typo3/cms"}->{"Package"} as $flagName => $flagValue) { + if ($extraFlags !== null && isset($extraFlags->{'typo3/cms'}->{'Package'})) { + foreach ($extraFlags->{'typo3/cms'}->{'Package'} as $flagName => $flagValue) { if (property_exists($this, $flagName)) { $this->{$flagName} = $flagValue; } diff --git a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php index e2d59a7..b3f12cf 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php +++ b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php @@ -764,7 +764,7 @@ class ResourceCompressor // Strip all comment blocks, but keep double/single quoted strings. $contents = preg_replace( "<($double_quot|$single_quot)|$comment>Ss", - "$1", + '$1', $contents ); // Remove certain whitespace. diff --git a/typo3/sysext/core/Tests/Legacy/typo3/contrib/class.removexssTest.php b/typo3/sysext/core/Tests/Legacy/typo3/contrib/class.removexssTest.php index f3e97c9..4c8b3fe 100644 --- a/typo3/sysext/core/Tests/Legacy/typo3/contrib/class.removexssTest.php +++ b/typo3/sysext/core/Tests/Legacy/typo3/contrib/class.removexssTest.php @@ -36,7 +36,7 @@ class RemoveXSSTest extends \TYPO3\CMS\Core\Tests\UnitTestCase public function checkAttackScriptSrcJs() { $testString = ''; - $expectedString = "ript SRC=http://ha.ckers.org/xss.js>"; + $expectedString = 'ript SRC=http://ha.ckers.org/xss.js>'; $actualString = RemoveXSS::process($testString); $this->assertEquals($expectedString, $actualString); @@ -222,8 +222,8 @@ class RemoveXSSTest extends \TYPO3\CMS\Core\Tests\UnitTestCase */ public function checkAttackLayer() { - $testString = ""; - $expectedString = "yer SRC=\"http://ha.ckers.org/scriptlet.html\">"; + $testString = ''; + $expectedString = 'yer SRC="http://ha.ckers.org/scriptlet.html">'; $actualString = RemoveXSS::process($testString); $this->assertEquals($expectedString, $actualString); diff --git a/typo3/sysext/core/Tests/Unit/Cache/Backend/Typo3DatabaseBackendTest.php b/typo3/sysext/core/Tests/Unit/Cache/Backend/Typo3DatabaseBackendTest.php index 3666b9c..4ce6d11 100644 --- a/typo3/sysext/core/Tests/Unit/Cache/Backend/Typo3DatabaseBackendTest.php +++ b/typo3/sysext/core/Tests/Unit/Cache/Backend/Typo3DatabaseBackendTest.php @@ -347,7 +347,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase $GLOBALS['TYPO3_DB'] ->expects($this->at(1)) ->method('exec_DELETEquery') - ->with('cf_Testing', "identifier = aIdentifier"); + ->with('cf_Testing', 'identifier = aIdentifier'); $GLOBALS['TYPO3_DB'] ->expects($this->at(2)) ->method('fullQuoteStr') @@ -355,7 +355,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase $GLOBALS['TYPO3_DB'] ->expects($this->at(3)) ->method('exec_DELETEquery') - ->with('cf_Testing_tags', "identifier = aIdentifier"); + ->with('cf_Testing_tags', 'identifier = aIdentifier'); $backend->remove('aIdentifier'); } diff --git a/typo3/sysext/core/Tests/Unit/Http/UriTest.php b/typo3/sysext/core/Tests/Unit/Http/UriTest.php index 7e15455..623a776 100644 --- a/typo3/sysext/core/Tests/Unit/Http/UriTest.php +++ b/typo3/sysext/core/Tests/Unit/Http/UriTest.php @@ -104,7 +104,7 @@ class UriTest extends \TYPO3\CMS\Core\Tests\UnitTestCase { return [ 'int' => [3000], - 'string' => ["3000"] + 'string' => ['3000'] ]; } diff --git a/typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php index 03a816a..ccbf924 100644 --- a/typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php +++ b/typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php @@ -1027,7 +1027,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase 'test', ), 'commas' => array( - "test,", + 'test,', 'test', ), 'multiple commas with trailing spaces' => array( diff --git a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php index ea4d193..0ccbe61 100644 --- a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php +++ b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php @@ -4486,7 +4486,7 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase public function callUserFunctionCanCallFunction() { $inputData = array('foo' => 'bar'); - $result = GeneralUtility::callUserFunction(function () { return "Worked fine"; }, $inputData, $this, ''); + $result = GeneralUtility::callUserFunction(function () { return 'Worked fine'; }, $inputData, $this, ''); $this->assertEquals('Worked fine', $result); } diff --git a/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php b/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php index 31cd673..0bc83b4 100644 --- a/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php +++ b/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php @@ -2690,7 +2690,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection switch ($this->handlerCfg['_DEFAULT']['type']) { case 'native': /** @var \mysqli_result $db_list */ - $db_list = $this->query("SELECT SCHEMA_NAME FROM information_schema.SCHEMATA"); + $db_list = $this->query('SELECT SCHEMA_NAME FROM information_schema.SCHEMATA'); $oldDb = $this->handlerCfg[$this->lastHandlerKey]['config']['database']; while ($row = $db_list->fetch_object()) { $this->handlerCfg[$this->lastHandlerKey]['config']['database'] = $row->SCHEMA_NAME; diff --git a/typo3/sysext/dbal/Tests/Unit/Database/DatabaseSpecificsPostgresqlTest.php b/typo3/sysext/dbal/Tests/Unit/Database/DatabaseSpecificsPostgresqlTest.php index ede0465..dacfe79 100644 --- a/typo3/sysext/dbal/Tests/Unit/Database/DatabaseSpecificsPostgresqlTest.php +++ b/typo3/sysext/dbal/Tests/Unit/Database/DatabaseSpecificsPostgresqlTest.php @@ -157,9 +157,9 @@ class DatabaseSpecificsPostgresqlTest extends DatabaseSpecificsTest array(array('type' => 'int4', 'has_default' => true, 'default_value' => 0), 0), array(array('type' => 'int4', 'has_default' => true, 'default_value' => '(-1)'), -1), array(array('type' => 'text', 'has_default' => false, 'default_value' => null), null), - array(array('type' => 'varchar', 'has_default' => true, 'default_value' => "''::character varying"), ""), - array(array('type' => 'varchar', 'has_default' => true, 'default_value' => "NULL::character varying"), null), - array(array('type' => 'varchar', 'has_default' => true, 'default_value' => "'something'::character varying"), "something"), + array(array('type' => 'varchar', 'has_default' => true, 'default_value' => "''::character varying"), ''), + array(array('type' => 'varchar', 'has_default' => true, 'default_value' => 'NULL::character varying'), null), + array(array('type' => 'varchar', 'has_default' => true, 'default_value' => "'something'::character varying"), 'something'), array(array('type' => 'varchar', 'has_default' => true, 'default_value' => "'some''thing'::character varying"), "some''thing"), ); } diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php index 9c3c413..fd774b7 100644 --- a/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php @@ -425,7 +425,7 @@ class RelationTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase /** @var \ExtbaseTeam\BlogExample\Domain\Repository\PostRepository $postRepository */ $postRepository = $this->objectManager->get(\ExtbaseTeam\BlogExample\Domain\Repository\PostRepository::class); $post = $postRepository->findByUid(1); - $post->setTitle("newTitle"); + $post->setTitle('newTitle'); $postRepository->update($post); $this->persistentManager->persistAll(); diff --git a/typo3/sysext/form/Classes/Domain/Filter/CurrencyFilter.php b/typo3/sysext/form/Classes/Domain/Filter/CurrencyFilter.php index 94d2da8..8106faa 100644 --- a/typo3/sysext/form/Classes/Domain/Filter/CurrencyFilter.php +++ b/typo3/sysext/form/Classes/Domain/Filter/CurrencyFilter.php @@ -102,7 +102,7 @@ class CurrencyFilter extends AbstractFilter implements FilterInterface ); // replace all non numeric characters, decimalPoint and negativ sign - $value = preg_replace("/[^0-9.-]/", "", $value); + $value = preg_replace('/[^0-9.-]/', '', $value); $value = (double)$value; return number_format($value, 2, $this->decimalsPoint, $this->thousandSeparator); } diff --git a/typo3/sysext/form/Tests/Unit/Validator/RequiredValidatorTest.php b/typo3/sysext/form/Tests/Unit/Validator/RequiredValidatorTest.php index e08c500..4309f18 100644 --- a/typo3/sysext/form/Tests/Unit/Validator/RequiredValidatorTest.php +++ b/typo3/sysext/form/Tests/Unit/Validator/RequiredValidatorTest.php @@ -40,7 +40,7 @@ class RequiredValidatorTest extends AbstractValidatorTest 'array with value 0' => array(array(0)), 'array with strings "a" and "b"' => array(array('a', 'b')), 'array with empty string and "a"' => array(array('', 'a')), - 'array with empty string and "0"' => array(array('', "0")), + 'array with empty string and "0"' => array(array('', '0')), 'array with empty string and 0' => array(array('', 0)), ); } diff --git a/typo3/sysext/install/Classes/Controller/ToolController.php b/typo3/sysext/install/Classes/Controller/ToolController.php index f507b9c3..9058e43 100644 --- a/typo3/sysext/install/Classes/Controller/ToolController.php +++ b/typo3/sysext/install/Classes/Controller/ToolController.php @@ -99,7 +99,7 @@ class ToolController extends AbstractController register_shutdown_function(function () { $error = error_get_last(); if ($error !== null) { - $errorType = $error["type"]; + $errorType = $error['type']; if ($errorType & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR)) { $getPostValues = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('install'); diff --git a/typo3/sysext/install/Tests/Functional/SqlSchemaMigrationServiceTest.php b/typo3/sysext/install/Tests/Functional/SqlSchemaMigrationServiceTest.php index 69bfc38..4e94eb2 100644 --- a/typo3/sysext/install/Tests/Functional/SqlSchemaMigrationServiceTest.php +++ b/typo3/sysext/install/Tests/Functional/SqlSchemaMigrationServiceTest.php @@ -50,7 +50,7 @@ class SqlSchemaMigrationServiceTest extends \TYPO3\CMS\Core\Tests\FunctionalTest // Create a key and a field that belongs to that key: $expectedDatabaseSchemaForBeUsers = $currentDatabaseSchemaForBeUsers; $expectedDatabaseSchemaForBeUsers['be_users']['fields']['functional_test_field_1'] = "tinyint(1) unsigned NOT NULL default '0'"; - $expectedDatabaseSchemaForBeUsers['be_users']['keys']['functional_test_key_1'] = "KEY functional_test_key_1 (functional_test_field_1)"; + $expectedDatabaseSchemaForBeUsers['be_users']['keys']['functional_test_key_1'] = 'KEY functional_test_key_1 (functional_test_field_1)'; $createFieldDiff = $this->sqlSchemaMigrationService->getDatabaseExtra($expectedDatabaseSchemaForBeUsers, $currentDatabaseSchemaForBeUsers); $createFieldDiff = $this->sqlSchemaMigrationService->getUpdateSuggestions($createFieldDiff); $this->sqlSchemaMigrationService->performUpdateQueries($createFieldDiff['add'], $createFieldDiff['add']); diff --git a/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php index 1f914de..690fa6d 100644 --- a/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/EnableFileServiceTest.php @@ -64,7 +64,7 @@ class EnableFileServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase */ public function getFirstInstallFilePaths($structure, $expected) { - $vfs = vfsStream::setup("root"); + $vfs = vfsStream::setup('root'); vfsStream::create($structure, $vfs); /** @var $instance \TYPO3\CMS\Install\Service\EnableFileService|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\PHPUnit_Framework_MockObject_MockObject */ $instance = $this->getAccessibleMock(\TYPO3\CMS\Install\Service\EnableFileService::class, array('dummy'), array(), '', false); @@ -126,7 +126,7 @@ class EnableFileServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase */ public function removeFirstInstallFile($structure, $expected) { - $vfs = vfsStream::setup("root"); + $vfs = vfsStream::setup('root'); vfsStream::create($structure, $vfs); /** @var $instance \TYPO3\CMS\Install\Service\EnableFileService|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\PHPUnit_Framework_MockObject_MockObject */ $instance = $this->getAccessibleMock(\TYPO3\CMS\Install\Service\EnableFileService::class, array('dummy'), array(), '', false); diff --git a/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php b/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php index 4e80b4d..e7fa455 100644 --- a/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php +++ b/typo3/sysext/workspaces/Tests/Functional/Service/WorkspaceServiceTest.php @@ -37,7 +37,7 @@ class WorkspaceServiceTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase */ public function emptyWorkspaceReturnsEmptyArray() { - $this->markTestSkipped("This test need a review. It is green even if all fixtures are commented out"); + $this->markTestSkipped('This test need a review. It is green even if all fixtures are commented out'); $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService(); $result = $service->selectVersionsInWorkspace(90); $this->assertTrue(empty($result), 'The workspace 90 contains no changes and the result was supposed to be empty'); @@ -135,7 +135,7 @@ class WorkspaceServiceTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase */ public function movedElementsCanNotBeFoundAtTheirOrigin() { - $this->markTestSkipped("This test need a review. It is green even if all fixtures are commented out"); + $this->markTestSkipped('This test need a review. It is green even if all fixtures are commented out'); $this->importDataSet(__DIR__ . '/Fixtures/WorkspaceServiceTestMovedContent.xml'); // Test if the placeholder can be found when we ask using recursion (same result) $service = new \TYPO3\CMS\Workspaces\Service\WorkspaceService();