Skip to content

Commit f8003bc

Browse files
authored
[5.1] Updating php-cs-fixer and php_codesniffer to latest versions (#42603)
* Updating php-cs-fixer and php_codesniffer to latest versions * Fixing codestyle for newer php-cs-fixer version
1 parent 7c6e2ca commit f8003bc

File tree

71 files changed

+384
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+384
-613
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
'@PSR12' => true,
7171
// Short array syntax
7272
'array_syntax' => ['syntax' => 'short'],
73-
// Lists should not have a trailing comma like list($foo, $bar,) = ...
74-
'no_trailing_comma_in_list_call' => true,
73+
// List of values separated by a comma is contained on a single line should not have a trailing comma like [$foo, $bar,] = ...
74+
'no_trailing_comma_in_singleline' => true,
7575
// Arrays on multiline should have a trailing comma
7676
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
7777
// Align elements in multiline array and variable declarations on new lines below each other

administrator/components/com_admin/src/Model/SysinfoModel.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,17 @@ public function &getPhpSettings(): array
244244
}
245245

246246
$this->php_settings = [
247-
'memory_limit' => ini_get('memory_limit'),
248-
'upload_max_filesize' => ini_get('upload_max_filesize'),
249-
'post_max_size' => ini_get('post_max_size'),
250-
'display_errors' => ini_get('display_errors') == '1',
251-
'short_open_tag' => ini_get('short_open_tag') == '1',
252-
'file_uploads' => ini_get('file_uploads') == '1',
253-
'output_buffering' => (int) ini_get('output_buffering') !== 0,
254-
'open_basedir' => ini_get('open_basedir'),
255-
'session.save_path' => ini_get('session.save_path'),
256-
'session.auto_start' => ini_get('session.auto_start'),
257-
'disable_functions' => ini_get('disable_functions'),
247+
'memory_limit' => \ini_get('memory_limit'),
248+
'upload_max_filesize' => \ini_get('upload_max_filesize'),
249+
'post_max_size' => \ini_get('post_max_size'),
250+
'display_errors' => \ini_get('display_errors') == '1',
251+
'short_open_tag' => \ini_get('short_open_tag') == '1',
252+
'file_uploads' => \ini_get('file_uploads') == '1',
253+
'output_buffering' => (int) \ini_get('output_buffering') !== 0,
254+
'open_basedir' => \ini_get('open_basedir'),
255+
'session.save_path' => \ini_get('session.save_path'),
256+
'session.auto_start' => \ini_get('session.auto_start'),
257+
'disable_functions' => \ini_get('disable_functions'),
258258
'xml' => \extension_loaded('xml'),
259259
'zlib' => \extension_loaded('zlib'),
260260
'zip' => \function_exists('zip_open') && \function_exists('zip_read'),
@@ -263,7 +263,7 @@ public function &getPhpSettings(): array
263263
'gd' => \extension_loaded('gd'),
264264
'iconv' => \function_exists('iconv'),
265265
'intl' => \function_exists('transliterator_transliterate'),
266-
'max_input_vars' => ini_get('max_input_vars'),
266+
'max_input_vars' => \ini_get('max_input_vars'),
267267
];
268268

269269
return $this->php_settings;
@@ -355,7 +355,7 @@ private function getCompatPluginParameters()
355355
public function phpinfoEnabled(): bool
356356
{
357357
// remove any spaces from the ini value before exploding it
358-
$disabledFunctions = str_replace(' ', '', ini_get('disable_functions'));
358+
$disabledFunctions = str_replace(' ', '', \ini_get('disable_functions'));
359359
return !\in_array('phpinfo', explode(',', $disabledFunctions));
360360
}
361361

@@ -666,7 +666,7 @@ public function getDirectory(bool $public = false): array
666666
*/
667667
private function addDirectory(string $name, string $path, string $message = ''): void
668668
{
669-
$this->directories[$name] = ['writable' => is_writable($path), 'message' => $message,];
669+
$this->directories[$name] = ['writable' => is_writable($path), 'message' => $message];
670670
}
671671

672672
/**
@@ -718,7 +718,7 @@ protected function parsePhpInfo(string $html): array
718718
foreach ($vals as $val) {
719719
// 3cols
720720
if (preg_match($p2, $val, $matches)) {
721-
$r[$name][trim($matches[1])] = [trim($matches[2]), trim($matches[3]),];
721+
$r[$name][trim($matches[1])] = [trim($matches[2]), trim($matches[3])];
722722
} elseif (preg_match($p3, $val, $matches)) {
723723
// 2cols
724724
$r[$name][trim($matches[1])] = trim($matches[2]);

administrator/components/com_categories/src/Model/CategoriesModel.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ protected function getListQuery()
249249
$categoryId = $categoryId ? [$categoryId] : [];
250250
}
251251

252-
// Case: Using both categories filter and by level filter
253252
if (\count($categoryId)) {
253+
// Case: Using both categories filter and by level filter
254254
$categoryTable = Table::getInstance('Category', 'JTable');
255255
$subCatItemsWhere = [];
256256

@@ -263,9 +263,8 @@ protected function getListQuery()
263263
}
264264

265265
$query->where('(' . implode(' OR ', $subCatItemsWhere) . ')');
266-
267-
// Case: Using only the by level filter
268266
} elseif ($level) {
267+
// Case: Using only the by level filter
269268
$query->where($db->quoteName('a.level') . ' <= :level')
270269
->bind(':level', $level, ParameterType::INTEGER);
271270
}

administrator/components/com_finder/src/Indexer/Adapter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,20 +922,20 @@ protected function translateState($item, $category = null)
922922

923923
// Translate the state
924924
switch ($item) {
925-
// Published items should always show up in search results
926925
case 1:
926+
// Published items should always show up in search results
927927
return 1;
928928

929-
// Archived items should only show up when option is enabled
930929
case 2:
930+
// Archived items should only show up when option is enabled
931931
if ($this->params->get('search_archived', 1) == 0) {
932932
return 0;
933933
}
934934

935935
return 1;
936936

937-
// All other states should return an unpublished state
938937
default:
938+
// All other states should return an unpublished state
939939
return 0;
940940
}
941941
}

administrator/components/com_finder/src/Indexer/DebugAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,13 +920,13 @@ protected function translateState($item, $category = null)
920920

921921
// Translate the state
922922
switch ($item) {
923-
// Published and archived items only should return a published state
924923
case 1:
925924
case 2:
925+
// Published and archived items only should return a published state
926926
return 1;
927927

928-
// All other states should return an unpublished state
929928
default:
929+
// All other states should return an unpublished state
930930
return 0;
931931
}
932932
}

administrator/components/com_finder/src/Indexer/Parser/Html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Html extends Parser
3838
public function parse($input)
3939
{
4040
// Strip invalid UTF-8 characters.
41-
$oldSetting = ini_get('mbstring.substitute_character');
41+
$oldSetting = \ini_get('mbstring.substitute_character');
4242
ini_set('mbstring.substitute_character', 'none');
4343
$input = mb_convert_encoding($input, 'UTF-8', 'UTF-8');
4444
ini_set('mbstring.substitute_character', $oldSetting);

administrator/components/com_finder/src/Indexer/Query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ protected function processString($input, $lang, $mode)
794794

795795
// Now we have to handle the filter string.
796796
switch ($modifier) {
797-
// Handle a before and after date filters.
798797
case 'before':
799798
case 'after':
799+
// Handle a before and after date filters.
800800
// Get the time offset.
801801
$offset = Factory::getApplication()->get('offset');
802802

@@ -820,8 +820,8 @@ protected function processString($input, $lang, $mode)
820820

821821
break;
822822

823-
// Handle a taxonomy branch filter.
824823
default:
824+
// Handle a taxonomy branch filter.
825825
// Try to find the node id.
826826
$return = Taxonomy::getNodeByTitle($modifier, $value);
827827

administrator/components/com_installer/src/Model/InstallModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ protected function _getPackageFromUpload()
274274
$userfile = $input->files->get('install_package', null, 'raw');
275275

276276
// Make sure that file uploads are enabled in php.
277-
if (!(bool) ini_get('file_uploads')) {
277+
if (!(bool) \ini_get('file_uploads')) {
278278
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE'), 'error');
279279

280280
return false;

administrator/components/com_installer/src/Model/InstallerModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected function translate(&$items)
176176
break;
177177
case 'file':
178178
$extension = 'files_' . $item->element;
179-
$lang->load("$extension.sys", JPATH_SITE);
179+
$lang->load("$extension.sys", JPATH_SITE);
180180
break;
181181
case 'library':
182182
$parts = explode('/', $item->element);

administrator/components/com_installer/src/Model/UpdateModel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,8 @@ protected function loadFormData()
552552
protected function preparePreUpdate($update, $table)
553553
{
554554
switch ($table->type) {
555-
// Components could have a helper which adds additional data
556555
case 'component':
556+
// Components could have a helper which adds additional data
557557
$ename = str_replace('com_', '', $table->element);
558558
$fname = $ename . '.php';
559559
$cname = ucfirst($ename) . 'Helper';
@@ -570,8 +570,8 @@ protected function preparePreUpdate($update, $table)
570570

571571
break;
572572

573-
// Modules could have a helper which adds additional data
574573
case 'module':
574+
// Modules could have a helper which adds additional data
575575
$cname = str_replace('_', '', $table->element) . 'Helper';
576576
$path = ($table->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $table->element . '/helper.php';
577577

@@ -585,9 +585,9 @@ protected function preparePreUpdate($update, $table)
585585

586586
break;
587587

588-
// If we have a plugin, we can use the plugin trigger "onInstallerBeforePackageDownload"
589-
// But we should make sure, that our plugin is loaded, so we don't need a second "installer" plugin
590588
case 'plugin':
589+
// If we have a plugin, we can use the plugin trigger "onInstallerBeforePackageDownload"
590+
// But we should make sure, that our plugin is loaded, so we don't need a second "installer" plugin
591591
$cname = str_replace('plg_', '', $table->element);
592592
PluginHelper::importPlugin($table->folder, $cname);
593593
break;

0 commit comments

Comments
 (0)