Skip to content

Commit f0b1a60

Browse files
authored
Merge branch 'main' into rector/php80/ClassOnObjectRector
2 parents b661922 + 60b7a16 commit f0b1a60

File tree

116 files changed

+939
-1228
lines changed

Some content is hidden

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

116 files changed

+939
-1228
lines changed

.phpstan.dist.baseline.neon

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,10 +1422,16 @@ parameters:
14221422
count: 1
14231423
path: app/code/core/Mage/Catalog/Model/Api/Resource.php
14241424

1425+
-
1426+
message: '#^Elseif condition is always false\.$#'
1427+
identifier: elseif.alwaysFalse
1428+
count: 1
1429+
path: app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php
1430+
14251431
-
14261432
message: '#^If condition is always false\.$#'
14271433
identifier: if.alwaysFalse
1428-
count: 2
1434+
count: 1
14291435
path: app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php
14301436

14311437
-

.rector.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
CodeQuality\Class_\CompleteDynamicPropertiesRector::class, # todo: TMP (!?!)
4747
CodeQuality\Class_\InlineConstructorDefaultToPropertyRector::class, # todo: TMP
4848
CodeQuality\ClassMethod\ExplicitReturnNullRector::class, # todo: TMP
49-
CodeQuality\ClassMethod\InlineArrayReturnAssignRector::class, # todo: TMP
5049
CodeQuality\Concat\JoinStringConcatRector::class, # todo: TMP
5150
CodeQuality\Empty_\SimplifyEmptyCheckOnEmptyArrayRector::class, # todo: TMP
5251
CodeQuality\Equal\UseIdenticalOverEqualWithSameTypeRector::class, # todo: TMP
@@ -63,10 +62,8 @@
6362
CodeQuality\If_\ExplicitBoolCompareRector::class, # todo: TMP
6463
CodeQuality\If_\SimplifyIfElseToTernaryRector::class,
6564
CodeQuality\If_\SimplifyIfReturnBoolRector::class,
66-
CodeQuality\If_\ShortenElseIfRector::class, # todo: TMP
6765
CodeQuality\Include_\AbsolutizeRequireAndIncludePathRector::class, # todo: TMP
6866
CodeQuality\Isset_\IssetOnPropertyObjectToPropertyExistsRector::class, # todo: TMP
69-
CodeQuality\Switch_\SingularSwitchToIfRector::class, # todo: TMP
7067
CodeQuality\Ternary\NumberCompareToMaxFuncCallRector::class, # todo: TMP
7168
CodeQuality\Ternary\SwitchNegatedTernaryRector::class, # todo: TMP
7269
CodeQuality\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, # todo: TMP
@@ -90,10 +87,8 @@
9087
DeadCode\ClassMethod\RemoveUnusedConstructorParamRector::class, # todo: TMP (!?!)
9188
DeadCode\ClassMethod\RemoveEmptyClassMethodRector::class, # todo: TMP
9289
DeadCode\ClassMethod\RemoveNullTagValueNodeRector::class, # todo: TMP
93-
DeadCode\ClassMethod\RemoveUnusedPrivateMethodRector::class, # todo: TMP
9490
DeadCode\ClassMethod\RemoveUnusedPrivateMethodParameterRector::class, # todo: TMP (!?!)
9591
DeadCode\Concat\RemoveConcatAutocastRector::class, # todo: TMP (!?!)
96-
DeadCode\For_\RemoveDeadIfForeachForRector::class, # todo: TMP
9792
DeadCode\Foreach_\RemoveUnusedForeachKeyRector::class, # todo: TMP
9893
DeadCode\FunctionLike\RemoveDeadReturnRector::class, # todo: TMP
9994
DeadCode\If_\ReduceAlwaysFalseIfOrRector::class, # todo: TMP
@@ -135,9 +130,9 @@
135130
Strict\Empty_\DisallowedEmptyRuleFixerRector::class, # todo: TMP
136131
TypeDeclaration\BooleanAnd\BinaryOpNullableToInstanceofRector::class, # todo: TMP
137132
TypeDeclaration\ClassMethod\ReturnNeverTypeRector::class,
138-
TypeDeclaration\Empty_\EmptyOnNullableObjectToInstanceOfRector::class, # todo: TMP
139-
TypeDeclaration\StmtsAwareInterface\DeclareStrictTypesRector::class, # SKIP
140-
# use static methods
133+
# skip: cannot be applied to OpenMage codebase - yet
134+
TypeDeclaration\StmtsAwareInterface\DeclareStrictTypesRector::class,
135+
# skip: use static methods
141136
PreferPHPUnitThisCallRector::class,
142137
__DIR__ . '/shell/translations.php',
143138
__DIR__ . '/shell/update-copyright.php',

app/code/core/Mage/Admin/Model/Observer.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ public function actionPreDispatchAdmin($observer)
5454
$password = $postLogin['password'] ?? '';
5555
$session->login($username, $password, $request);
5656
$request->setPost('login', null);
57-
} else {
58-
if (!$request->getParam('messageSent')) {
59-
Mage::getSingleton('adminhtml/session')->addError(
60-
Mage::helper('adminhtml')->__('Invalid Form Key. Please refresh the page.'),
61-
);
62-
$request->setParam('messageSent', true);
63-
}
57+
} elseif (!$request->getParam('messageSent')) {
58+
Mage::getSingleton('adminhtml/session')->addError(
59+
Mage::helper('adminhtml')->__('Invalid Form Key. Please refresh the page.'),
60+
);
61+
$request->setParam('messageSent', true);
6462
}
6563

6664
$coreSession->renewFormKey();

app/code/core/Mage/Admin/Model/Redirectpolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getRedirectUrl(
3939
?Zend_Controller_Request_Http $request = null,
4040
$alternativeUrl = null
4141
) {
42-
if (empty($request)) {
42+
if (!$request instanceof Zend_Controller_Request_Http) {
4343
return null;
4444
}
4545
$countRequiredParams = ($this->_urlModel->useSecretKey()

app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ protected function _prepareForm()
2828
$fieldset->addField('user_id', 'hidden', [
2929
'name' => 'user_id',
3030
]);
31-
} else {
32-
if (!$model->hasData('is_active')) {
33-
$model->setIsActive(1);
34-
}
31+
} elseif (!$model->hasData('is_active')) {
32+
$model->setIsActive(1);
3533
}
3634

3735
$fieldset->addField('username', 'text', [

app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ protected function _addColumnFilterToCollection($column)
3333
}
3434
if ($column->getFilter()->getValue()) {
3535
$this->getCollection()->addFieldToFilter('user_id', ['in' => $inRoleIds]);
36-
} else {
37-
if ($inRoleIds) {
38-
$this->getCollection()->addFieldToFilter('user_id', ['nin' => $inRoleIds]);
39-
}
36+
} elseif ($inRoleIds) {
37+
$this->getCollection()->addFieldToFilter('user_id', ['nin' => $inRoleIds]);
4038
}
4139
} else {
4240
parent::_addColumnFilterToCollection($column);
@@ -148,12 +146,10 @@ protected function _getUsers($json = false)
148146
} else {
149147
return array_values($users);
150148
}
149+
} elseif ($json) {
150+
return '{}';
151151
} else {
152-
if ($json) {
153-
return '{}';
154-
} else {
155-
return [];
156-
}
152+
return [];
157153
}
158154
}
159155
}

app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Main.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ protected function _prepareForm()
2828
$fieldset->addField('user_id', 'hidden', [
2929
'name' => 'user_id',
3030
]);
31-
} else {
32-
if (!$model->hasData('is_active')) {
33-
$model->setIsActive(1);
34-
}
31+
} elseif (!$model->hasData('is_active')) {
32+
$model->setIsActive(1);
3533
}
3634

3735
$fieldset->addField('username', 'text', [

app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Roles.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ protected function _addColumnFilterToCollection($column)
3232
}
3333
if ($column->getFilter()->getValue()) {
3434
$this->getCollection()->addFieldToFilter('role_id', ['in' => $userRoles]);
35-
} else {
36-
if ($userRoles) {
37-
$this->getCollection()->addFieldToFilter('role_id', ['nin' => $userRoles]);
38-
}
35+
} elseif ($userRoles) {
36+
$this->getCollection()->addFieldToFilter('role_id', ['nin' => $userRoles]);
3937
}
4038
} else {
4139
parent::_addColumnFilterToCollection($column);

app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ protected function _prepareForm()
3636
$customerText = '';
3737
if ($customer->getId()) {
3838
$customerText = Mage::helper('review')->__('<a href="%1$s" onclick="this.target=\'blank\'">%2$s</a> <a href="mailto:%3$s">(%3$s)</a>', $this->getUrl('*/customer/edit', ['id' => $customer->getId(), 'active_tab' => 'review']), $this->escapeHtml($customer->getName()), $this->escapeHtml($customer->getEmail()));
39-
} else {
40-
if (is_null($review->getCustomerId())) {
41-
$customerText = Mage::helper('review')->__('Guest');
42-
} elseif ($review->getCustomerId() == 0) {
43-
$customerText = Mage::helper('review')->__('Administrator');
44-
}
39+
} elseif (is_null($review->getCustomerId())) {
40+
$customerText = Mage::helper('review')->__('Guest');
41+
} elseif ($review->getCustomerId() == 0) {
42+
$customerText = Mage::helper('review')->__('Administrator');
4543
}
4644

4745
$fieldset->addField('customer', 'note', [

app/code/core/Mage/Adminhtml/Block/Review/Main.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ public function __construct()
4242
$this->_headerText = Mage::helper('review')->__('Pending Reviews');
4343
}
4444
$this->_removeButton('add');
45+
} elseif ($customerName) {
46+
$this->_headerText = Mage::helper('review')->__('All Reviews of Customer `%s`', $customerName);
47+
} elseif ($productName) {
48+
$this->_headerText = Mage::helper('review')->__('All Reviews of Product `%s`', $productName);
4549
} else {
46-
if ($customerName) {
47-
$this->_headerText = Mage::helper('review')->__('All Reviews of Customer `%s`', $customerName);
48-
} elseif ($productName) {
49-
$this->_headerText = Mage::helper('review')->__('All Reviews of Product `%s`', $productName);
50-
} else {
51-
$this->_headerText = Mage::helper('review')->__('All Reviews');
52-
}
50+
$this->_headerText = Mage::helper('review')->__('All Reviews');
5351
}
5452
}
5553
}

0 commit comments

Comments
 (0)