Skip to content

Commit 66855b4

Browse files
authored
phpcs-fixer: phpdoc_var_annotation_correct_order (#5056)
* phpcs-fixer: `phpdoc_var_annotation_correct_order` - see https://cs.symfony.com/doc/rules/phpdoc/phpdoc_var_annotation_correct_order.html * typo * fix docs * minor * phpcs-fixer
1 parent deebcdc commit 66855b4

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
'phpdoc_single_line_var_spacing' => true,
3131
// Sorts PHPDoc types.
3232
'phpdoc_types_order' => true,
33+
// @var and @type annotations must have type and name in the correct order.
34+
'phpdoc_var_annotation_correct_order' => true,
3335
// Convert double quotes to single quotes for simple strings.
3436
'single_quote' => true,
3537
// Arguments lists, array destructuring lists, arrays that are multi-line, match-lines and parameters lists must have a trailing comma.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ public function prepareCatalogProductPriceIndexTable(Varien_Event_Observer $obse
298298
*
299299
* @param string $attributeCode
300300
*
301+
* @throws Throwable
301302
* @return $this
302303
*/
303304
protected function _checkCatalogRulesAvailability($attributeCode)
@@ -307,10 +308,9 @@ protected function _checkCatalogRulesAvailability($attributeCode)
307308
->addAttributeInConditionFilter($attributeCode);
308309

309310
$disabledRulesCount = 0;
311+
/** @var Mage_CatalogRule_Model_Rule $rule */
310312
foreach ($collection as $rule) {
311-
/** @var Mage_CatalogRule_Model_Rule $rule */
312313
$rule->setIsActive(0);
313-
/** @var $rule->getConditions() Mage_CatalogRule_Model_Rule_Condition_Combine */
314314
$this->_removeAttributeFromConditions($rule->getConditions(), $attributeCode);
315315
$rule->save();
316316

app/code/core/Mage/Rule/Model/Condition/Combine.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @method $this setActions(array $value)
1414
* @method string getAggregator()
1515
* @method $this setAggregator(string $value)
16-
* @method string getAggregatorOption()
16+
* @method array|string getAggregatorOption()
1717
* @method array getAggregatorOptions()
1818
* @method $this setAggregatorOption(array $value)
1919
* @method string getPrefix()
@@ -37,7 +37,6 @@ public function prepareConditionSql()
3737
{
3838
$wheres = [];
3939
foreach ($this->getConditions() as $condition) {
40-
/** @var Mage_Rule_Model_Condition_Abstract $condition */
4140
$wheres[] = '(' . $condition->prepareConditionSql() . ')';
4241
}
4342

@@ -115,8 +114,8 @@ public function loadAggregatorOptions()
115114
public function getAggregatorSelectOptions()
116115
{
117116
$opt = [];
118-
foreach ($this->getAggregatorOption() as $k => $v) {
119-
$opt[] = ['value' => $k, 'label' => $v];
117+
foreach ($this->getAggregatorOption() as $key => $value) {
118+
$opt[] = ['value' => $key, 'label' => $value];
120119
}
121120

122121
return $opt;
@@ -136,8 +135,8 @@ public function getAggregatorName()
136135
public function getAggregatorElement()
137136
{
138137
if (is_null($this->getAggregator())) {
139-
foreach ($this->getAggregatorOption() as $k => $v) {
140-
$this->setAggregator($k);
138+
foreach ($this->getAggregatorOption() as $key => $value) {
139+
$this->setAggregator($key);
141140
break;
142141
}
143142
}
@@ -264,8 +263,8 @@ public function loadArray($arr, $key = 'conditions')
264263
$this->addCondition($cond);
265264
$cond->loadArray($condArr, $key);
266265
}
267-
} catch (Exception $e) {
268-
Mage::logException($e);
266+
} catch (Exception $exception) {
267+
Mage::logException($exception);
269268
}
270269
}
271270
}
@@ -403,7 +402,7 @@ public function setJsFormObject($form)
403402
/**
404403
* Get conditions, if current prefix is undefined use 'conditions' key
405404
*
406-
* @return array
405+
* @return Mage_Rule_Model_Condition_Product_Abstract[]
407406
*/
408407
public function getConditions()
409408
{
@@ -414,7 +413,7 @@ public function getConditions()
414413
/**
415414
* Set conditions, if current prefix is undefined use 'conditions' key
416415
*
417-
* @param array $conditions
416+
* @param Mage_Rule_Model_Condition_Product_Abstract[] $conditions
418417
* @return $this
419418
*/
420419
public function setConditions($conditions)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ public function aggregateSalesReportCouponsData($schedule)
192192
* If rules were found they will be set to inactive and notice will be add to admin session
193193
*
194194
* @param string $attributeCode
195+
* @throws Throwable
195196
* @return $this
196197
*/
197198
protected function _checkSalesRulesAvailability($attributeCode)
@@ -201,10 +202,9 @@ protected function _checkSalesRulesAvailability($attributeCode)
201202
->addAttributeInConditionFilter($attributeCode);
202203

203204
$disabledRulesCount = 0;
205+
/** @var Mage_SalesRule_Model_Rule $rule */
204206
foreach ($collection as $rule) {
205-
/** @var Mage_SalesRule_Model_Rule $rule */
206207
$rule->setIsActive(0);
207-
/** @var $rule->getConditions() Mage_SalesRule_Model_Rule_Condition_Combine */
208208
$this->_removeAttributeFromConditions($rule->getConditions(), $attributeCode);
209209
$this->_removeAttributeFromConditions($rule->getActions(), $attributeCode);
210210
// phpcs:ignore Ecg.Performance.Loop.ModelLSD

0 commit comments

Comments
 (0)