Skip to content

Commit 075519a

Browse files
authored
Merge branch 'main' into validation
2 parents 353f077 + fb5f95d commit 075519a

File tree

36 files changed

+732
-67
lines changed

36 files changed

+732
-67
lines changed

.php-cs-fixer.dist.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
'nullable_type_declaration_for_default_null_value' => true,
1919
// Operators - when multiline - must always be at the beginning or at the end of the line.
2020
'operator_linebreak' => true,
21+
// Sort union types and intersection types using configured order.
22+
'ordered_types' => true,
2123
// Calls to PHPUnit\Framework\TestCase static methods must all be of the same type, either $this->, self:: or static::
2224
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
2325
// PHPDoc annotation descriptions should not be a sentence.
@@ -44,12 +46,16 @@
4446
'phpdoc_var_annotation_correct_order' => true,
4547
// @var and @type annotations of classy properties should not contain the name.
4648
'phpdoc_var_without_name' => true,
49+
// There MUST NOT be more than one property or constant declared per statement.
50+
'single_class_element_per_statement' => true,
4751
// Convert double quotes to single quotes for simple strings.
4852
'single_quote' => true,
4953
// Arguments lists, array destructuring lists, arrays that are multi-line, match-lines and parameters lists must have a trailing comma.
5054
// removed "match" and "parameters" for PHP7
5155
// see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8308
5256
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arguments', 'array_destructuring', 'arrays']],
57+
// A single space or none should be around union type and intersection type operators.
58+
'types_spaces' => true,
5359
])
5460
->setFinder(
5561
PhpCsFixer\Finder::create()

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public function delete(Mage_Core_Model_Abstract $object)
194194
*
195195
* @param Mage_Admin_Model_User $user
196196
* @throws Mage_Core_Exception
197+
* @throws Zend_Db_Adapter_Exception
197198
* @return $this|Mage_Admin_Model_User|Mage_Core_Model_Abstract
198199
*/
199200
public function _saveRelations(Mage_Core_Model_Abstract $user)
@@ -239,7 +240,10 @@ public function _saveRelations(Mage_Core_Model_Abstract $user)
239240
}
240241

241242
$adapter->commit();
242-
} catch (Mage_Core_Exception|Exception $exception) {
243+
} catch (Mage_Core_Exception $mageCoreException) {
244+
$adapter->rollBack();
245+
throw $mageCoreException;
246+
} catch (Exception $exception) {
243247
$adapter->rollBack();
244248
throw $exception;
245249
}

app/code/core/Mage/Adminhtml/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function setPageHelpUrl($url = null, $suffix = null)
6565
/**
6666
* Add suffix for help page url
6767
*
68-
* @param string $suffix
68+
* @param null|string $suffix
6969
* @return $this
7070
* @deprecated
7171
*/

app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function _initValidator()
105105
/**
106106
* Initialize messages templates with translating
107107
*
108-
* @return Mage_Adminhtml_Model_LayoutUpdate_Validator
108+
* @return $this
109109
*/
110110
protected function _initMessageTemplates()
111111
{

app/code/core/Mage/Api/Model/Server/Adapter/Soap.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ public function run()
153153
$this->_soap->handle(),
154154
),
155155
);
156-
} catch (Zend_Soap_Server_Exception|Exception $e) {
157-
$this->fault($e->getCode(), $e->getMessage());
156+
} catch (Zend_Soap_Server_Exception $zendSoapServerException) {
157+
$this->fault($zendSoapServerException->getCode(), $zendSoapServerException->getMessage());
158+
} catch (Exception $exception) {
159+
$this->fault($exception->getCode(), $exception->getMessage());
158160
}
159161
}
160162

app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ public function run()
6666
->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)
6767
->setHeader('Content-Length', strlen($content), true)
6868
->setBody($content);
69-
} catch (Zend_Soap_Server_Exception|Exception $e) {
70-
$this->fault($e->getCode(), $e->getMessage());
69+
} catch (Zend_Soap_Server_Exception $zendSoapServerException) {
70+
$this->fault($zendSoapServerException->getCode(), $zendSoapServerException->getMessage());
71+
} catch (Exception $exception) {
72+
$this->fault($exception->getCode(), $exception->getMessage());
7173
}
7274
}
7375

app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ public function run()
8787
->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)
8888
->setHeader('Content-Length', strlen($content), true)
8989
->setBody($content);
90-
} catch (Zend_Soap_Server_Exception|Exception $e) {
91-
$this->fault($e->getCode(), $e->getMessage());
90+
} catch (Zend_Soap_Server_Exception $zendSoapServerException) {
91+
$this->fault($zendSoapServerException->getCode(), $zendSoapServerException->getMessage());
92+
} catch (Exception $exception) {
93+
$this->fault($exception->getCode(), $exception->getMessage());
9294
}
9395
}
9496

app/code/core/Mage/Catalog/Model/Category/Api.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,10 @@ public function create($parentId, $categoryData, $store = null)
274274
}
275275

276276
$category->save();
277-
} catch (Mage_Core_Exception|Exception $e) {
278-
$this->_fault('data_invalid', $e->getMessage());
277+
} catch (Mage_Core_Exception $mageCoreException) {
278+
$this->_fault('data_invalid', $mageCoreException->getMessage());
279+
} catch (Exception $exception) {
280+
$this->_fault('data_invalid', $exception->getMessage());
279281
}
280282

281283
return $category->getId();

app/code/core/Mage/Wishlist/Model/Item.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ public function addToCart(Mage_Checkout_Model_Cart $cart, $delete = false)
382382
*
383383
* If product has required options add special key to URL
384384
*
385+
* @throws Mage_Core_Exception
385386
* @return string
386387
*/
387388
public function getProductUrl()
@@ -509,6 +510,7 @@ public function isRepresent($product, $buyRequest)
509510
* Check product representation in item
510511
*
511512
* @param Mage_Catalog_Model_Product $product
513+
* @throws Mage_Core_Exception
512514
* @return bool
513515
*/
514516
public function representProduct($product)
@@ -661,6 +663,7 @@ public function getOptionByCode($code)
661663
/**
662664
* Returns whether Qty field is valid for this item
663665
*
666+
* @throws Mage_Core_Exception
664667
* @return bool
665668
*/
666669
public function canHaveQty()
@@ -679,11 +682,14 @@ public function getCustomDownloadUrl()
679682

680683
/**
681684
* Sets custom option download url
685+
*
682686
* @param string $url
687+
* @return $this
683688
*/
684689
public function setCustomDownloadUrl($url)
685690
{
686691
$this->_customOptionDownloadUrl = $url;
692+
return $this;
687693
}
688694

689695
/**

tests/unit/Base/DefaultConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class DefaultConfigTest extends TestCase
2222
/**
2323
* @dataProvider provideGetStoreConfig
2424
*/
25-
public function testGetStoreConfig(string $expectedResult, string $path, bool|int|Mage_Core_Model_Store|null|string $store = null): void
25+
public function testGetStoreConfig(string $expectedResult, string $path, null|bool|int|Mage_Core_Model_Store|string $store = null): void
2626
{
2727
self::assertSame($expectedResult, Mage::getStoreConfig($path, $store));
2828
}

0 commit comments

Comments
 (0)