Skip to content

Commit

Permalink
Added rules (#4181)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Sep 4, 2024
1 parent b9e1be5 commit 25ddeb1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down

0 comments on commit 25ddeb1

Please sign in to comment.