Commit f8359262 authored by Wouter Wolters's avatar Wouter Wolters Committed by Benni Mack
Browse files

[TASK] Apply CGL compatibility (PSR-1 and PSR-2)

Regular code cleanup about CGL standards.

Executed via php-cs-fixer fix --config-file Build/.php_cs typo3

Resolves: #72860
Releases: master
Change-Id: I5f9382a5ab9ad7ce1ab92da06c272e587ec78010
Reviewed-on: https://review.typo3.org/46131

Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent ff55b9c7
......@@ -22,12 +22,10 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendLayoutView;
use TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Service\DependencyOrderingService;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* Script Class for the New Content element wizard
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Script Class, creating the content for the dummy script - which is just blank output.
......
......@@ -23,7 +23,6 @@ use TYPO3\CMS\Core\Resource\DuplicationBehavior;
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
/**
* Gateway for TCE (TYPO3 Core Engine) file-handling through POST forms.
......
......@@ -22,7 +22,6 @@ use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
/**
......
......@@ -150,5 +150,4 @@ class EditController extends AbstractWizardController
return $this->closeWindow;
}
}
}
......@@ -112,5 +112,4 @@ class ContentLayoutPagePositionMap extends PagePositionMap
unset($params['new_unique_uid']);
return GeneralUtility::linkThisScript($params);
}
}
......@@ -48,7 +48,7 @@ class BackendUserRepository extends \TYPO3\CMS\Extbase\Domain\Repository\Backend
if ($demand->getUserName() !== '') {
$searchConstraints = array();
foreach (array('userName', 'uid', 'realName') as $field) {
$searchConstraints[] = $query->like(
$searchConstraints[] = $query->like(
$field, '%' . $GLOBALS['TYPO3_DB']->escapeStrForLike($demand->getUserName(), 'be_users') . '%'
);
}
......
......@@ -53,7 +53,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*/
class CharsetConverter implements SingletonInterface
{
/**
* Possible strategies for handling multi-byte data
* Only used for internal purpose
......
......@@ -51,7 +51,7 @@ class HtmlParser
public function splitIntoBlock($tag, $content, $eliminateExtraEndTags = false)
{
$tags = array_unique(GeneralUtility::trimExplode(',', $tag, true));
array_walk($tags, function(&$tag) {
array_walk($tags, function (&$tag) {
$tag = preg_quote($tag, '/');
});
$regexStr = '/\\<\\/?(' . implode('|', $tags) . ')(\\s*\\>|\\s[^\\>]*\\>)/si';
......
......@@ -46,5 +46,4 @@ class ErrorpageMessage extends AbstractStandaloneMessage
$defaultMarkers['###EXTPATH_BACKEND###'] = ExtensionManagementUtility::siteRelPath('backend');
return $defaultMarkers;
}
}
......@@ -15,8 +15,8 @@ namespace TYPO3\CMS\Core\Resource\Driver;
*/
use TYPO3\CMS\Core\Charset\CharsetConverter;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Resource\Exception\InvalidPathException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
/**
......
......@@ -39,7 +39,6 @@ class ListUtility
$name = $folder->getName();
$role = $folder->getRole();
if ($role !== FolderInterface::ROLE_DEFAULT) {
$tempName = $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:role_folder_' . $role, true);
if (!empty($tempName) && ($tempName !== $name)) {
// Set new name and append original name
......
......@@ -36,7 +36,6 @@ use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
......
......@@ -18,8 +18,8 @@
namespace Composer\Autoload;
use Symfony\Component\Finder\Finder;
use Composer\IO\IOInterface;
use Symfony\Component\Finder\Finder;
/**
* ClassMapGenerator
......@@ -66,7 +66,7 @@ class ClassMapGenerator
$path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
} else {
throw new \RuntimeException(
'Could not scan for classes inside "'.$path.
'Could not scan for classes inside "' . $path .
'" which does not appear to be a file nor a folder'
);
}
......@@ -95,10 +95,10 @@ class ClassMapGenerator
if (!isset($map[$class])) {
$map[$class] = $filePath;
} elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
} elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class] . ' ' . $filePath, '\\', '/'))) {
$io->writeError(
'<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
'<warning>Warning: Ambiguous class resolution, "' . $class . '"' .
' was found in both "' . $map[$class] . '" and "' . $filePath . '", the first will be used.</warning>'
);
}
}
......@@ -132,11 +132,11 @@ class ClassMapGenerator
}
}
} catch (\Exception $e) {
throw new \RuntimeException('Could not scan for classes inside '.$path.": \n".$e->getMessage(), 0, $e);
throw new \RuntimeException('Could not scan for classes inside ' . $path . ": \n" . $e->getMessage(), 0, $e);
}
// return early if there is no chance of matching anything in this file
if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
if (!preg_match('{\b(?:class|interface' . $extraTypes . ')\s}i', $contents)) {
return array();
}
......@@ -161,7 +161,7 @@ class ClassMapGenerator
preg_match_all('{
(?:
\b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
\b(?<![\$:>])(?P<type>class|interface' . $extraTypes . ') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
| \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
)
}ix', $contents, $matches);
......@@ -176,7 +176,7 @@ class ClassMapGenerator
$name = $matches['name'][$i];
if ($name[0] === ':') {
// This is an XHP class, https://github.com/facebook/xhp
$name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
$name = 'xhp' . substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
} elseif ($matches['type'][$i] === 'enum') {
// In Hack, something like:
// enum Foo: int { HERP = '123'; }
......
......@@ -5,5 +5,4 @@
*/
class TestClass
{
}
\ No newline at end of file
}
......@@ -5,5 +5,4 @@
*/
class ext_update
{
}
\ No newline at end of file
}
......@@ -25,7 +25,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*/
class PresetRepository
{
/**
* @param int $pageId
* @return array
......
......@@ -311,7 +311,8 @@ class Import extends ImportExport
* @param array $storageRecord The storage record which should get compared
* @return bool Returns TRUE when both object storages can be seen as equivalent
*/
protected function isEquivalentObjectStorage(ResourceStorage $storageObject, array $storageRecord) {
protected function isEquivalentObjectStorage(ResourceStorage $storageObject, array $storageRecord)
{
// compare the properties: driver, writable and online
if (
$storageObject->getDriverType() === $storageRecord['driver']
......@@ -336,7 +337,8 @@ class Import extends ImportExport
*
* @return array Messages explaining issues which need to get resolved before import
*/
public function checkImportPrerequisites() {
public function checkImportPrerequisites()
{
$messages = array();
// Check #1: Extension dependencies
......@@ -354,7 +356,7 @@ class Import extends ImportExport
// Check #2: If the path for every local storage object exists.
// Else files can't get moved into a newly imported storage.
if(is_array($this->dat['header']['records']['sys_file_storage'])) {
if (is_array($this->dat['header']['records']['sys_file_storage'])) {
foreach ($this->dat['header']['records']['sys_file_storage'] as $sysFileStorageUid => $_) {
$storageRecord = $this->dat['records']['sys_file_storage:' . $sysFileStorageUid]['data'];
// continue with Local, writable and online storage only
......@@ -385,7 +387,6 @@ class Import extends ImportExport
$configuration = $resourceStorage->getConfiguration();
$messages['resourceStorageFolderMissing_' . $storageRecordUid] = 'The resource storage "' . $resourceStorage->getName() . '" will get imported. The storage target directory "' . $configuration['basePath'] . '" does not exist. Please create the directory prior to starting the import!';
}
}
}
}
......
......@@ -731,4 +731,4 @@ class CrawlerHook
}
}
}
}
\ No newline at end of file
}
......@@ -100,7 +100,6 @@ class InfoPageTyposcriptConfigController extends \TYPO3\CMS\Backend\Module\Abstr
$theOutput = '<h1>' . htmlspecialchars($this->getLanguageService()->getLL('tsconf_title')) . '</h1>';
if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
$TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, null, true);
$lines = array();
$pUids = array();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment