Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP-CS-Fixer: added check for double quotes #4126

Merged
merged 9 commits into from
Sep 2, 2024
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
name: Labeler
on:
pull_request_target:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
triage:
Expand Down
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
'single_import_per_statement' => true,
// Each namespace use MUST go on its own line and there MUST be one blank line after the use statements block.
'single_line_after_imports' => true,
// Convert double quotes to single quotes for simple strings.
'single_quote' => true,
// Each trait `use` must be done as single statement.
'single_trait_insert_per_statement' => true,
// A case should be followed by a colon and not a semicolon.
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Admin/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function __construct()
public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $parentName = null)
{
if (is_null($resource)) {
$resource = $this->getAdminhtmlConfig()->getNode("acl/resources");
$resource = $this->getAdminhtmlConfig()->getNode('acl/resources');
$resourceName = null;
} else {
$resourceName = (is_null($parentName) ? '' : $parentName . '/') . $resource->getName();
Expand Down Expand Up @@ -117,7 +117,7 @@ public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $p
*/
public function getAclAssert($name = '')
{
$asserts = $this->getNode("admin/acl/asserts");
$asserts = $this->getNode('admin/acl/asserts');
if ($name === '') {
return $asserts;
}
Expand All @@ -133,7 +133,7 @@ public function getAclAssert($name = '')
*/
public function getAclPrivilegeSet($name = '')
{
$sets = $this->getNode("admin/acl/privilegeSets");
$sets = $this->getNode('admin/acl/privilegeSets');
if ($name === '') {
return $sets;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function actionPreDispatchAdmin($observer)
/** @var Mage_Core_Model_Session $coreSession */
$coreSession = Mage::getSingleton('core/session');

if ($coreSession->validateFormKey($request->getPost("form_key"))) {
if ($coreSession->validateFormKey($request->getPost('form_key'))) {
$postLogin = $request->getPost('login');
$username = $postLogin['username'] ?? '';
$password = $postLogin['password'] ?? '';
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Resource/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function loadRules(Mage_Admin_Model_Acl $acl, array $rulesArr)
Mage::helper('adminhtml')->__(
'The following role resources are no longer available in the system: %s. You can delete them by <a href="%s">clicking here</a>.',
implode(', ', $orphanedResources),
Mage::helper("adminhtml")->getUrl('adminhtml/permissions_orphanedResource')
Mage::helper('adminhtml')->getUrl('adminhtml/permissions_orphanedResource')
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function _initSelect()
{
parent::_initSelect();

$this->getSelect()->where("main_table.role_type = ?", 'G');
$this->getSelect()->where('main_table.role_type = ?', 'G');

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function _initSelect()
{
parent::_initSelect();

$this->getSelect()->where("user_id > 0");
$this->getSelect()->where('user_id > 0');

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ protected function _buildResourcesArray(
}

if ($rawNodes) {
$resource->addAttribute("aclpath", $resourceName);
$resource->addAttribute("module_c", $module);
$resource->addAttribute('aclpath', $resourceName);
$resource->addAttribute('module_c', $module);
}

if (is_null($represent2Darray)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
->addColumn('variable_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, [
'primary' => true,
'nullable' => false,
'default' => "",
'default' => '',
], 'Config Path')
->addColumn('is_allowed', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, [
'nullable' => false,
Expand Down Expand Up @@ -73,7 +73,7 @@
], 'Block ID')
->addColumn('block_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, [
'nullable' => false,
'default' => "",
'default' => '',
], 'Block Name')
->addColumn('is_allowed', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, [
'nullable' => false,
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Api/Editroles.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct()
protected function _beforeToHtml()
{
$roleId = $this->getRequest()->getParam('rid', false);
$role = Mage::getModel("api/roles")
$role = Mage::getModel('api/roles')
->load($roleId);

$this->addTab('info', [
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct()

protected function _prepareCollection()
{
$collection = Mage::getModel("api/roles")->getCollection();
$collection = Mage::getModel('api/roles')->getCollection();
$this->setCollection($collection);

return parent::_prepareCollection();
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function getGridUrl()
*/
protected function _getUsers($json = false)
{
if ($this->getRequest()->getParam('in_role_user') != "") {
if ($this->getRequest()->getParam('in_role_user') != '') {
return (int)$this->getRequest()->getParam('in_role_user');
}
$roleId = ($this->getRequest()->getParam('rid') > 0) ? $this->getRequest()->getParam('rid') : Mage::registry('RID');
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct()

$roleId = $this->getRequest()->getParam('rid', false);

$users = Mage::getModel("api/user")->getCollection()->load();
$users = Mage::getModel('api/user')->getCollection()->load();
$this->setTemplate('api/rolesusers.phtml')
->assign('users', $users->getItems())
->assign('roleId', $roleId);
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Api/Tab/Userroles.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public function __construct()

$uid = $this->getRequest()->getParam('id', false);
$uid = !empty($uid) ? $uid : 0;
$roles = Mage::getModel("api/roles")
$roles = Mage::getModel('api/roles')
->getCollection()
->load();

$user_roles = Mage::getModel("api/roles")
$user_roles = Mage::getModel('api/roles')
->getUsersCollection()
->setUserFilter($uid)
->load();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getGridUrl()
*/
protected function _getSelectedRoles($json = false)
{
if ($this->getRequest()->getParam('user_roles') != "") {
if ($this->getRequest()->getParam('user_roles') != '') {
return $this->getRequest()->getParam('user_roles');
}
$uRoles = Mage::registry('api_user')->getRoles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function getSaveUrl(array $args = [])

public function getEditUrl()
{
return $this->getUrl("*/catalog_category/edit", ['_current' => true, 'store' => null, '_query' => false, 'id' => null, 'parent' => null]);
return $this->getUrl('*/catalog_category/edit', ['_current' => true, 'store' => null, '_query' => false, 'id' => null, 'parent' => null]);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Mage_Adminhtml_Block_Catalog_Category_Helper_Pricestep extends Varien_Data
public function getToggleCode()
{
$htmlId = 'use_config_' . $this->getHtmlId();
return "toggleValueElements(this, this.parentNode.parentNode);"
return 'toggleValueElements(this, this.parentNode.parentNode);'
. "if (!this.checked) toggleValueElements($('$htmlId'), $('$htmlId').parentNode);";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Mage_Adminhtml_Block_Catalog_Category_Helper_Sortby_Available extends Vari
public function getToggleCode()
{
$htmlId = 'use_config_' . $this->getHtmlId();
return "toggleValueElements(this, this.parentNode.parentNode);"
return 'toggleValueElements(this, this.parentNode.parentNode);'
. "if (!this.checked) toggleValueElements($('$htmlId'), $('$htmlId').parentNode);";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Mage_Adminhtml_Block_Catalog_Category_Helper_Sortby_Default extends Varien
public function getToggleCode()
{
$htmlId = 'use_config_' . $this->getHtmlId();
return "toggleValueElements(this, this.parentNode.parentNode);"
return 'toggleValueElements(this, this.parentNode.parentNode);'
. "if (!this.checked) toggleValueElements($('$htmlId'), $('$htmlId').parentNode);";
}

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct()

protected function _prepareLayout()
{
$addUrl = $this->getUrl("*/*/add", [
$addUrl = $this->getUrl('*/*/add', [
'_current' => true,
'id' => null,
'_query' => false
Expand Down Expand Up @@ -141,7 +141,7 @@ public function getNodesUrl()
public function getSwitchTreeUrl()
{
return $this->getUrl(
"*/catalog_category/tree",
'*/catalog_category/tree',
['_current' => true, 'store' => null, '_query' => false, 'id' => null, 'parent' => null]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function _prepareForm()

$fieldset->addField('is_filterable', 'select', [
'name' => 'is_filterable',
'label' => Mage::helper('catalog')->__("Use In Layered Navigation"),
'label' => Mage::helper('catalog')->__('Use In Layered Navigation'),
'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
'values' => [
Expand All @@ -160,7 +160,7 @@ protected function _prepareForm()

$fieldset->addField('is_filterable_in_search', 'select', [
'name' => 'is_filterable_in_search',
'label' => Mage::helper('catalog')->__("Use In Search Results Layered Navigation"),
'label' => Mage::helper('catalog')->__('Use In Search Results Layered Navigation'),
'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
'values' => $yesnoSource,
Expand Down Expand Up @@ -233,9 +233,9 @@ protected function _prepareForm()
/** @var Mage_Adminhtml_Block_Widget_Form_Element_Dependence $block */
$block = $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence');
$this->setChild('form_after', $block
->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')
->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')
->addFieldMap("frontend_input", 'frontend_input_type')
->addFieldMap('is_wysiwyg_enabled', 'wysiwyg_enabled')
->addFieldMap('is_html_allowed_on_front', 'html_allowed_on_front')
->addFieldMap('frontend_input', 'frontend_input_type')
->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')
->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public function usedDefault($attribute)

// special management for "label" and "position" since they're columns of the
// catalog_product_entity_media_gallery_value database table
if ($attributeCode == "label" || $attributeCode == "position") {
if ($attributeCode == 'label' || $attributeCode == 'position') {
$media_gallery = $this->getDataObject()->getMediaGallery();
if (!count($media_gallery["images"])) {
if (!count($media_gallery['images'])) {
return true;
}
return $media_gallery["images"][0]["{$attributeCode}_use_default"];
return $media_gallery['images'][0]["{$attributeCode}_use_default"];
}

$defaultValue = $this->getDataObject()->getAttributeDefaultValue($attributeCode);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Checkout/Formkey.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public function canShow()
*/
public function getSecurityAdminUrl()
{
return Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/admin');
return Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit/section/admin');
}
}
20 changes: 10 additions & 10 deletions app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ public function getChartUrl($directUrl = true)
$this->_allSeries = $datas;

// Image-Charts Awesome data format values
$params['chd'] = "a:";
$dataDelimiter = ",";
$dataSetdelimiter = "|";
$dataMissing = "_";
$params['chd'] = 'a:';
$dataDelimiter = ',';
$dataSetdelimiter = '|';
$dataMissing = '_';

// process each string in the array, and find the max length
foreach ($this->getAllSeries() as $index => $serie) {
Expand Down Expand Up @@ -321,9 +321,9 @@ public function getChartUrl($directUrl = true)

$params['chd'] .= $buffer;

$labelBuffer = "";
$labelBuffer = '';
$valueBuffer = [];
$rangeBuffer = "";
$rangeBuffer = '';

if (count($this->_axisLabels)) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
Expand Down Expand Up @@ -353,7 +353,7 @@ public function getChartUrl($directUrl = true)
case '2y':
$formats = Mage::app()->getLocale()->getTranslationList('datetime');
$format = $formats['yyMM'] ?? 'MM/yyyy';
$format = str_replace(["yyyy", "yy", "MM"], ["Y", "y", "m"], $format);
$format = str_replace(['yyyy', 'yy', 'MM'], ['Y', 'y', 'm'], $format);
$this->_axisLabels[$idx][$_index] = date($format, strtotime($_label));
break;
}
Expand All @@ -364,21 +364,21 @@ public function getChartUrl($directUrl = true)

$tmpstring = implode('|', $this->_axisLabels[$idx]);

$valueBuffer[] = $indexid . ":|" . $tmpstring;
$valueBuffer[] = $indexid . ':|' . $tmpstring;
if (count($this->_axisLabels[$idx]) > 1) {
$deltaX = 100 / (count($this->_axisLabels[$idx]) - 1);
} else {
$deltaX = 100;
}
} elseif ($idx === 'y') {
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
$valueBuffer[] = $indexid . ':|' . implode('|', $yLabels);
if (count($yLabels) - 1) {
$deltaY = 100 / (count($yLabels) - 1);
} else {
$deltaY = 100;
}
// setting range values for y axis
$rangeBuffer = $indexid . "," . $miny . "," . $maxy . "|";
$rangeBuffer = $indexid . ',' . $miny . ',' . $maxy . '|';
}
$indexid++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function _toHtml()
$storeId = Mage::app()->getAnyStoreView()->getId();
}

Varien_Profiler::start("newsletter_queue_proccessing");
Varien_Profiler::start('newsletter_queue_proccessing');
$vars = [];

$vars['subscriber'] = Mage::getModel('newsletter/subscriber');
Expand All @@ -59,13 +59,13 @@ protected function _toHtml()
$template->revertDesign();

if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
$templateProcessed = '<pre>' . htmlspecialchars($templateProcessed) . '</pre>';
}

$templateProcessed = Mage::getSingleton('core/input_filter_maliciousCode')
->linkFilter($templateProcessed);

Varien_Profiler::stop("newsletter_queue_proccessing");
Varien_Profiler::stop('newsletter_queue_proccessing');

return $templateProcessed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function _toHtml()
$storeId = Mage::app()->getAnyStoreView()->getId();
}

Varien_Profiler::start("newsletter_template_proccessing");
Varien_Profiler::start('newsletter_template_proccessing');
$vars = [];

$vars['subscriber'] = Mage::getModel('newsletter/subscriber');
Expand All @@ -58,13 +58,13 @@ protected function _toHtml()
$template->revertDesign();

if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
$templateProcessed = '<pre>' . htmlspecialchars($templateProcessed) . '</pre>';
}

$templateProcessed = Mage::getSingleton('core/input_filter_maliciousCode')
->linkFilter($templateProcessed);

Varien_Profiler::stop("newsletter_template_proccessing");
Varien_Profiler::stop('newsletter_template_proccessing');

return $templateProcessed;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Notification/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function _canShow()
public function getMessage()
{
return $this->helper('adminhtml')->__(
"Your current version of cURL php5 module is %s, which can prevent services that require TLS v1.2 from working correctly. It is recommended to update your cURL php5 module to version %s or higher.",
'Your current version of cURL php5 module is %s, which can prevent services that require TLS v1.2 from working correctly. It is recommended to update your cURL php5 module to version %s or higher.',
$this->_curlVersion['version'],
$this::REQUIRED_CURL_VERSION
);
Expand Down
Loading
Loading