diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e5c4f7cfcde..8c1bf39a95b 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -6,7 +6,10 @@ */ $config = new PhpCsFixer\Config(); return $config + ->setRiskyAllowed(true) ->setRules([ + // PHP arrays should be declared using the configured syntax. + 'array_syntax' => ['syntax' => 'short'], // There MUST be one blank line after the namespace declaration. 'blank_line_after_namespace' => true, // Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line. @@ -33,6 +36,8 @@ 'indentation_type' => true, // All PHP files must use same line ending. 'line_ending' => true, + // Use && and || logical operators instead of and and or. + 'logical_operators' => true, // Cast should be written in lower case. 'lowercase_cast' => true, // PHP keywords MUST be in lower case. @@ -41,6 +46,8 @@ 'lowercase_static_reference' => true, // In method arguments and method call, there MUST NOT be a space before each comma and there MUST be one space after each comma. Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. 'method_argument_space' => true, + // Replaces intval, floatval, doubleval, strval and boolval function calls with according type casting operator. + 'modernize_types_casting' => true, // All instances created with new keyword must be followed by braces. 'new_with_braces' => true, // There should be no empty lines after class opening brace. diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php index dae7ed1771d..60e76866ed5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php @@ -42,18 +42,18 @@ public function getButtonsHtml() { $html = ''; - $addButtonData = array( + $addButtonData = [ 'label' => Mage::helper('sales')->__('Create New Customer'), 'onclick' => 'order.setCustomerId(false)', 'class' => 'add', - ); + ]; $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml(); - $addButtonData = array( + $addButtonData = [ 'label' => Mage::helper('sales')->__('Create Guest Order'), 'onclick' => 'order.setCustomerIsGuest()', 'class' => 'add', - ); + ]; $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml(); return $html; diff --git a/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php b/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php index c7acb46678e..5899c40acb9 100644 --- a/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php +++ b/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php @@ -110,7 +110,7 @@ protected function getConfigKey(string $configKey): array 'trim' ); list($_, $scope) = $configKeyParts; - return array($configKeyParts, $scope); + return [$configKeyParts, $scope]; } protected function isConfigKeyValid(string $configKey): bool diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php index 4561ae0b327..be3bd15544d 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php @@ -366,7 +366,7 @@ protected function insertOrder(&$page, $obj, $putOrderId = true) if (!$order->getIsVirtual()) { $this->y = $addressesStartY; - if (isset($shippingAddress) and is_iterable($shippingAddress)) { + if (isset($shippingAddress) && is_iterable($shippingAddress)) { foreach ($shippingAddress as $value) { if ($value !== '') { $text = [];