Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .phpmd.dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
[-] LongClassName
[x] ShortClassName
[-] LongVariable
[x] ShortVariable
[-] ShortVariable
[x] ShortMethodName - TMP disabled
-->
<rule ref="rulesets/naming.xml">
Expand Down
1 change: 0 additions & 1 deletion .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
CodeQuality\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, # todo: TMP
CodeQuality\Ternary\UnnecessaryTernaryExpressionRector::class, # todo: TMP
CodingStyle\Assign\SplitDoubleAssignRector::class, # todo: TMP
CodingStyle\Catch_\CatchExceptionNameMatchingTypeRector::class, # todo: TMP
CodingStyle\ClassMethod\FuncGetArgsToVariadicParamRector::class, # todo: TMP
CodingStyle\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector::class, # todo: TMP
CodingStyle\Encapsed\EncapsedStringsToSprintfRector::class, # todo: TMP
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/Acl/Role/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function addParent($role, $parents)
$roleId = $role;
$role = $this->get($role);
}
} catch (Zend_Acl_Role_Registry_Exception $e) {
throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist", $e->getCode(), $e);
} catch (Zend_Acl_Role_Registry_Exception $zendAclRoleRegistryException) {
throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist", $zendAclRoleRegistryException->getCode(), $zendAclRoleRegistryException);
}

if (!is_array($parents)) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/Resource/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ public function delete(Mage_Core_Model_Abstract $user)
$adapter->delete($this->getMainTable(), $conditions);
$adapter->delete($this->getTable('admin/role'), $conditions);
$adapter->commit();
} catch (Throwable $e) {
} catch (Throwable $throwable) {
$adapter->rollBack();
throw $e;
throw $throwable;
}

$this->_afterDelete($user);
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ public function authenticate($username, $password)
'user' => $this,
'result' => $result,
]);
} catch (Mage_Core_Exception $e) {
} catch (Mage_Core_Exception $mageCoreException) {
$this->unsetData();
throw $e;
throw $mageCoreException;
}

if (!$result) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,9 @@ protected function _beforeToHtml()
{
try {
$this->_prepareGrid();
} catch (Exception $e) {
} catch (Exception $exception) {
$this->resetSavedParametersInSession();
throw $e;
throw $exception;
}

return parent::_beforeToHtml();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ public function renderConfigureResult($controller, Varien_Object $configureResul

$isOk = true;
$productType = $product->getTypeId();
} catch (Exception $e) {
} catch (Exception $exception) {
$isOk = false;
$productType = null;
Mage::register('composite_configure_result_error_message', $e->getMessage());
Mage::register('composite_configure_result_error_message', $exception->getMessage());
}

$this->_initConfigureResultLayout($controller, $isOk, $productType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ protected function _afterSave()
->setValue($cronExprString)
->setPath(self::CRON_STRING_PATH)
->save();
} catch (Exception $e) {
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $e->getCode(), $e);
} catch (Exception $exception) {
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $exception->getCode(), $exception);
}

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ protected function _afterSave()
->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH))
->setPath(self::CRON_MODEL_PATH)
->save();
} catch (Exception $e) {
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $e->getCode(), $e);
} catch (Exception $exception) {
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $exception->getCode(), $exception);
}

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ protected function _afterSave()
->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH))
->setPath(self::CRON_MODEL_PATH)
->save();
} catch (Exception $e) {
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $e->getCode(), $e);
} catch (Exception $exception) {
throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'), $exception->getCode(), $exception);
}

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ protected function _deleteUserFromRole($userId, $roleId)
->setRoleId($roleId)
->setUserId($userId)
->deleteFromRole();
} catch (Exception $e) {
throw $e;
} catch (Exception $exception) {
throw $exception;
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public function uploadAction()
'path' => $this->_getSession()->getCookiePath(),
'domain' => $this->_getSession()->getCookieDomain(),
];
} catch (Exception $e) {
} catch (Exception $exception) {
$result = [
'error' => $e->getMessage(),
'errorcode' => $e->getCode()];
'error' => $exception->getMessage(),
'errorcode' => $exception->getCode()];
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,9 +826,9 @@ public function duplicateAction()
$newProduct = $product->duplicate();
$this->_getSession()->addSuccess($this->__('The product has been duplicated.'));
$this->_redirect('*/*/edit', ['_current' => true, 'id' => $newProduct->getId()]);
} catch (Exception $e) {
Mage::logException($e);
$this->_getSession()->addError($e->getMessage());
} catch (Exception $exception) {
Mage::logException($exception);
$this->_getSession()->addError($exception->getMessage());
$this->_redirect('*/*/edit', ['_current' => true]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function indexAction()

try {
Mage::helper('cms/wysiwyg_images')->getCurrentPath();
} catch (Exception $e) {
$this->_getSession()->addError($e->getMessage());
} catch (Exception $exception) {
$this->_getSession()->addError($exception->getMessage());
}

$this->_initAction()->loadLayout('overlay_popup');
Expand Down Expand Up @@ -69,8 +69,8 @@ public function contentsAction()
$this->_initAction()->_saveSessionCurrentPath();
$this->loadLayout('empty');
$this->renderLayout();
} catch (Exception $e) {
$result = ['error' => true, 'message' => $e->getMessage()];
} catch (Exception $exception) {
$result = ['error' => true, 'message' => $exception->getMessage()];
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
Expand All @@ -82,8 +82,8 @@ public function newFolderAction()
$name = $this->getRequest()->getPost('name');
$path = $this->getStorage()->getSession()->getCurrentPath();
$result = $this->getStorage()->createDirectory($name, $path);
} catch (Exception $e) {
$result = ['error' => true, 'message' => $e->getMessage()];
} catch (Exception $exception) {
$result = ['error' => true, 'message' => $exception->getMessage()];
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
Expand All @@ -94,8 +94,8 @@ public function deleteFolderAction()
try {
$path = $this->getStorage()->getSession()->getCurrentPath();
$this->getStorage()->deleteDirectory($path);
} catch (Exception $e) {
$result = ['error' => true, 'message' => $e->getMessage()];
} catch (Exception $exception) {
$result = ['error' => true, 'message' => $exception->getMessage()];
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
Expand Down Expand Up @@ -124,8 +124,8 @@ public function deleteFilesAction()
$this->getStorage()->deleteFile($path . DS . $file);
}
}
} catch (Exception $e) {
$result = ['error' => true, 'message' => $e->getMessage()];
} catch (Exception $exception) {
$result = ['error' => true, 'message' => $exception->getMessage()];
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
Expand All @@ -140,8 +140,8 @@ public function uploadAction()
$this->_initAction();
$targetPath = $this->getStorage()->getSession()->getCurrentPath();
$result = $this->getStorage()->uploadFile($targetPath, $this->getRequest()->getParam('type'));
} catch (Exception $e) {
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
} catch (Exception $exception) {
$result = ['error' => $exception->getMessage(), 'errorcode' => $exception->getCode()];
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public function configureAction()
$configureResult->setBuyRequest($quoteItem->getBuyRequest());
$configureResult->setCurrentStoreId($quoteItem->getStoreId());
$configureResult->setCurrentCustomer($this->_customer);
} catch (Exception $e) {
} catch (Exception $exception) {
$configureResult->setError(true);
$configureResult->setMessage($e->getMessage());
$configureResult->setMessage($exception->getMessage());
}

/** @var Mage_Adminhtml_Helper_Catalog_Product_Composite $helper */
Expand Down Expand Up @@ -125,9 +125,9 @@ public function updateAction()
->save();

$updateResult->setOk(true);
} catch (Exception $e) {
} catch (Exception $exception) {
$updateResult->setError(true);
$updateResult->setMessage($e->getMessage());
$updateResult->setMessage($exception->getMessage());
}

$updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public function configureAction()
$configureResult->setCurrentCustomerId($this->_wishlist->getCustomerId());

$configureResult->setOk(true);
} catch (Exception $e) {
} catch (Exception $exception) {
$configureResult->setError(true);
$configureResult->setMessage($e->getMessage());
$configureResult->setMessage($exception->getMessage());
}

/** @var Mage_Adminhtml_Helper_Catalog_Product_Composite $helper */
Expand Down Expand Up @@ -111,9 +111,9 @@ public function updateAction()
->save();

$updateResult->setOk(true);
} catch (Exception $e) {
} catch (Exception $exception) {
$updateResult->setError(true);
$updateResult->setMessage($e->getMessage());
$updateResult->setMessage($exception->getMessage());
}

$updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ public function saveAction()

$queue->save();
$this->_redirect('*/*');
} catch (Mage_Core_Exception $e) {
$this->_getSession()->addError($e->getMessage());
} catch (Mage_Core_Exception $mageCoreException) {
$this->_getSession()->addError($mageCoreException->getMessage());
$id = $this->getRequest()->getParam('id');
if ($id) {
$this->_redirect('*/*/edit', ['id' => $id]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public function deleteAction()
try {
$role->delete();
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The role has been deleted.'));
} catch (Exception $e) {
Mage::logException($e);
} catch (Exception $exception) {
Mage::logException($exception);
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while deleting this role.'));
}

Expand Down Expand Up @@ -269,8 +269,8 @@ protected function _deleteUserFromRole($userId, $roleId)
->setRoleId($roleId)
->setUserId($userId)
->deleteFromRole();
} catch (Exception $e) {
throw $e;
} catch (Exception $exception) {
throw $exception;
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ public function addConfiguredAction()
try {
$this->_initSession()
->_processData();
} catch (Exception $e) {
} catch (Exception $exception) {
$this->_reloadQuote();
$errorMessage = $e->getMessage();
$errorMessage = $exception->getMessage();
}

// Form result for client javascript
Expand Down Expand Up @@ -610,9 +610,9 @@ public function configureQuoteItemsAction()
$configureResult->setProductId($quoteItem->getProductId());
$sessionQuote = Mage::getSingleton('adminhtml/session_quote');
$configureResult->setCurrentCustomerId($sessionQuote->getCustomerId());
} catch (Exception $e) {
} catch (Exception $exception) {
$configureResult->setError(true);
$configureResult->setMessage($e->getMessage());
$configureResult->setMessage($exception->getMessage());
}

// Render page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public function ordersAction()
try {
$this->_initProfile();
$this->loadLayout()->renderLayout();
} catch (Exception $e) {
Mage::logException($e);
} catch (Exception $exception) {
Mage::logException($exception);
$this->norouteAction();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public function synchronizeAction()

try {
$this->_getSyncSingleton()->synchronize($storage);
} catch (Exception $e) {
Mage::logException($e);
$flag->passError($e);
} catch (Exception $exception) {
Mage::logException($exception);
$flag->passError($exception);
}

$flag->setState(Mage_Core_Model_File_Storage_Flag::STATE_FINISHED)->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function fetchRatesAction()
$importModel = Mage::getModel(
Mage::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray(),
);
} catch (Exception $e) {
} catch (Exception) {
Mage::throwException(Mage::helper('adminhtml')->__('Unable to initialize import model'));
}

Expand All @@ -78,8 +78,8 @@ public function fetchRatesAction()
}

Mage::getSingleton('adminhtml/session')->setRates($rates);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
} catch (Exception $exception) {
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
}

$this->_redirect('*/*/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ public function saveAction()
Mage::helper('adminhtml')->__('The email template has been saved.'),
);
$this->_redirect('*/*');
} catch (Exception $e) {
} catch (Exception $exception) {
Mage::getSingleton('adminhtml/session')->setData(
'email_template_form_data',
$this->getRequest()->getParams(),
);
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
$this->_forward('new');
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Api/Model/Acl/Role/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function addParent($role, $parents)
$roleId = $role;
$role = $this->get($role);
}
} catch (Zend_Acl_Role_Registry_Exception $e) {
throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist", $e->getCode(), $e);
} catch (Zend_Acl_Role_Registry_Exception $zendAclRoleRegistryException) {
throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist", $zendAclRoleRegistryException->getCode(), $zendAclRoleRegistryException);
}

if (!is_array($parents)) {
Expand Down
Loading
Loading