Skip to content

Commit 861faa0

Browse files
authored
rector: CatchExceptionNameMatchingTypeRector (#5015)
* rector: `CatchExceptionNameMatchingTypeRector` * phpstan
1 parent 34388fb commit 861faa0

File tree

204 files changed

+683
-684
lines changed

Some content is hidden

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

204 files changed

+683
-684
lines changed

.phpmd.dist.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
[-] LongClassName
7777
[x] ShortClassName
7878
[-] LongVariable
79-
[x] ShortVariable
79+
[-] ShortVariable
8080
[x] ShortMethodName - TMP disabled
8181
-->
8282
<rule ref="rulesets/naming.xml">

.rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
CodeQuality\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, # todo: TMP
7272
CodeQuality\Ternary\UnnecessaryTernaryExpressionRector::class, # todo: TMP
7373
CodingStyle\Assign\SplitDoubleAssignRector::class, # todo: TMP
74-
CodingStyle\Catch_\CatchExceptionNameMatchingTypeRector::class, # todo: TMP
7574
CodingStyle\ClassMethod\FuncGetArgsToVariadicParamRector::class, # todo: TMP
7675
CodingStyle\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector::class, # todo: TMP
7776
CodingStyle\Encapsed\EncapsedStringsToSprintfRector::class, # todo: TMP

app/code/core/Mage/Admin/Model/Acl/Role/Registry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function addParent($role, $parents)
3030
$roleId = $role;
3131
$role = $this->get($role);
3232
}
33-
} catch (Zend_Acl_Role_Registry_Exception $e) {
34-
throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist", $e->getCode(), $e);
33+
} catch (Zend_Acl_Role_Registry_Exception $zendAclRoleRegistryException) {
34+
throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist", $zendAclRoleRegistryException->getCode(), $zendAclRoleRegistryException);
3535
}
3636

3737
if (!is_array($parents)) {

app/code/core/Mage/Admin/Model/Resource/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ public function delete(Mage_Core_Model_Abstract $user)
175175
$adapter->delete($this->getMainTable(), $conditions);
176176
$adapter->delete($this->getTable('admin/role'), $conditions);
177177
$adapter->commit();
178-
} catch (Throwable $e) {
178+
} catch (Throwable $throwable) {
179179
$adapter->rollBack();
180-
throw $e;
180+
throw $throwable;
181181
}
182182

183183
$this->_afterDelete($user);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ public function authenticate($username, $password)
404404
'user' => $this,
405405
'result' => $result,
406406
]);
407-
} catch (Mage_Core_Exception $e) {
407+
} catch (Mage_Core_Exception $mageCoreException) {
408408
$this->unsetData();
409-
throw $e;
409+
throw $mageCoreException;
410410
}
411411

412412
if (!$result) {

app/code/core/Mage/Adminhtml/Block/Widget/Grid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,9 +777,9 @@ protected function _beforeToHtml()
777777
{
778778
try {
779779
$this->_prepareGrid();
780-
} catch (Exception $e) {
780+
} catch (Exception $exception) {
781781
$this->resetSavedParametersInSession();
782-
throw $e;
782+
throw $exception;
783783
}
784784

785785
return parent::_beforeToHtml();

app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ public function renderConfigureResult($controller, Varien_Object $configureResul
125125

126126
$isOk = true;
127127
$productType = $product->getTypeId();
128-
} catch (Exception $e) {
128+
} catch (Exception $exception) {
129129
$isOk = false;
130130
$productType = null;
131-
Mage::register('composite_configure_result_error_message', $e->getMessage());
131+
Mage::register('composite_configure_result_error_message', $exception->getMessage());
132132
}
133133

134134
$this->_initConfigureResultLayout($controller, $isOk, $productType);

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ protected function _afterSave()
4040
->setValue($cronExprString)
4141
->setPath(self::CRON_STRING_PATH)
4242
->save();
43-
} catch (Exception $e) {
44-
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $e->getCode(), $e);
43+
} catch (Exception $exception) {
44+
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $exception->getCode(), $exception);
4545
}
4646

4747
return $this;

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ protected function _afterSave()
4747
->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH))
4848
->setPath(self::CRON_MODEL_PATH)
4949
->save();
50-
} catch (Exception $e) {
51-
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $e->getCode(), $e);
50+
} catch (Exception $exception) {
51+
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $exception->getCode(), $exception);
5252
}
5353

5454
return $this;

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ protected function _afterSave()
4747
->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH))
4848
->setPath(self::CRON_MODEL_PATH)
4949
->save();
50-
} catch (Exception $e) {
51-
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $e->getCode(), $e);
50+
} catch (Exception $exception) {
51+
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $exception->getCode(), $exception);
5252
}
5353

5454
return $this;

0 commit comments

Comments
 (0)