Skip to content

Commit abd1281

Browse files
sreichelCopilot
andauthored
rector: RemoveNonExistingVarAnnotationRector (OpenMage#4999)
* rector: `RemoveNonExistingVarAnnotationRector` * Update app/code/core/Mage/ProductAlert/controllers/AddController.php Co-authored-by: Copilot <[email protected]> * phpStan * docblock --------- Co-authored-by: Copilot <[email protected]>
1 parent b47b440 commit abd1281

File tree

8 files changed

+10
-25
lines changed

8 files changed

+10
-25
lines changed

.phpstan.dist.baseline.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,12 +1788,6 @@ parameters:
17881788
count: 1
17891789
path: app/code/core/Mage/Catalog/Model/Resource/Abstract.php
17901790

1791-
-
1792-
rawMessage: 'PHPDoc tag @var with type Mage_Catalog_Model_Entity_Attribute is not subtype of native type non-empty-array<mixed, mixed>.'
1793-
identifier: varTag.nativeType
1794-
count: 1
1795-
path: app/code/core/Mage/Catalog/Model/Resource/Abstract.php
1796-
17971791
-
17981792
rawMessage: 'Parameter #1 $object of method Mage_Catalog_Model_Resource_Abstract::load() expects Mage_Core_Model_Abstract, Varien_Object given.'
17991793
identifier: argument.type
@@ -4020,12 +4014,6 @@ parameters:
40204014
count: 1
40214015
path: app/code/core/Mage/ProductAlert/controllers/AddController.php
40224016

4023-
-
4024-
rawMessage: 'PHPDoc tag @var with type Mage_Catalog_Model_Product is not subtype of native type 0|0.0|''''|''0''|array{}|false|null.'
4025-
identifier: varTag.nativeType
4026-
count: 1
4027-
path: app/code/core/Mage/ProductAlert/controllers/AddController.php
4028-
40294017
-
40304018
rawMessage: 'Method Mage_Rating_Model_Resource_Rating_Collection::getItemById() invoked with 1 parameter, 0 required.'
40314019
identifier: arguments.count

.rector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,8 @@
9494
DeadCode\FunctionLike\RemoveDeadReturnRector::class, # todo: TMP
9595
DeadCode\If_\ReduceAlwaysFalseIfOrRector::class, # todo: TMP
9696
DeadCode\If_\RemoveAlwaysTrueIfConditionRector::class, # todo: TMP
97-
DeadCode\If_\RemoveDeadInstanceOfRector::class, # todo: TMP
9897
DeadCode\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector::class, # todo: TMP
9998
DeadCode\If_\SimplifyIfElseWithSameContentRector::class, # todo: TMP
100-
DeadCode\Node\RemoveNonExistingVarAnnotationRector::class, # todo: TMP (!?!)
10199
DeadCode\Plus\RemoveDeadZeroAndOneOperationRector::class, # todo: TMP (!?!)
102100
DeadCode\Property\RemoveUnusedPrivatePropertyRector::class, # todo: TMP
103101
DeadCode\PropertyProperty\RemoveNullPropertyInitializationRector::class, # todo: TMP

app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Category.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class Mage_Catalog_Block_Seo_Sitemap_Tree_Category extends Mage_Catalog_Block_Se
3737
*/
3838
protected function _prepareLayout()
3939
{
40-
$helper = Mage::helper('catalog/category');
41-
/** @var Mage_Catalog_Helper_Category $helper */
4240
$parent = Mage::getModel('catalog/category')
4341
->setStoreId(Mage::app()->getStore()->getId())
4442
->load(Mage::app()->getStore()->getRootCategoryId());

app/code/core/Mage/Catalog/Model/Resource/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ public function getAttributeRawValue($entityId, $attribute, $store)
588588
$adapter = $this->_getReadAdapter();
589589
$getPerStore = false;
590590

591+
/** @var Mage_Catalog_Model_Entity_Attribute $_attribute */
591592
foreach ($attribute as $_attribute) {
592-
/** @var Mage_Catalog_Model_Entity_Attribute $attribute */
593593
$_attribute = $this->getAttribute($_attribute);
594594
if (!$_attribute) {
595595
continue;

app/code/core/Mage/Eav/Model/Entity/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public function unsetAttributes($attributes = null)
336336
*
337337
* If attribute is not found false is returned
338338
*
339-
* @param string|int|Mage_Core_Model_Config_Element $attribute
339+
* @param string|int|Mage_Core_Model_Config_Element|Mage_Eav_Model_Entity_Attribute_Abstract $attribute
340340
* @return Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Catalog_Model_Resource_Eav_Attribute|false
341341
*/
342342
public function getAttribute($attribute)

app/code/core/Mage/ProductAlert/controllers/AddController.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public function priceAction()
4848
return ;
4949
}
5050

51+
/** @var Mage_Catalog_Model_Product $product */
5152
$product = Mage::getModel('catalog/product')->load($productId);
5253
if (!$product->getId()) {
53-
/** @var Mage_Catalog_Model_Product $product */
5454
$session->addError($this->__('Not enough parameters.'));
5555
if ($this->_isUrlInternal($backUrl)) {
5656
$this->_redirectUrl($backUrl);
@@ -78,17 +78,19 @@ public function priceAction()
7878

7979
public function stockAction()
8080
{
81-
$session = Mage::getSingleton('catalog/session');
8281
/** @var Mage_Catalog_Model_Session $session */
82+
$session = Mage::getSingleton('catalog/session');
8383
$backUrl = $this->getRequest()->getParam(Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED);
8484
$productId = (int) $this->getRequest()->getParam('product_id');
8585
if (!$backUrl || !$productId) {
8686
$this->_redirect('/');
8787
return ;
8888
}
8989

90-
if (!$product = Mage::getModel('catalog/product')->load($productId)) {
91-
/** @var Mage_Catalog_Model_Product $product */
90+
/** @var Mage_Catalog_Model_Product $product */
91+
$product = Mage::getModel('catalog/product')->load($productId);
92+
93+
if (!$product->getId()) {
9294
$session->addError($this->__('Not enough parameters.'));
9395
$this->_redirectUrl($backUrl);
9496
return ;

app/code/core/Mage/ProductAlert/controllers/UnsubscribeController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public function priceAction()
3737
return;
3838
}
3939

40+
/** @var Mage_Catalog_Model_Session $session */
4041
$session = Mage::getSingleton('catalog/session');
4142

42-
/** @var Mage_Catalog_Model_Session $session */
43+
/** @var Mage_Catalog_Model_Product $product */
4344
$product = Mage::getModel('catalog/product')->load($productId);
4445
if (!$product->getId() || !$product->isVisibleInCatalog()) {
45-
/** @var Mage_Catalog_Model_Product $product */
4646
Mage::getSingleton('customer/session')->addError($this->__('The product is not found.'));
4747
$this->_redirect('customer/account/');
4848
return ;

app/design/adminhtml/default/default/template/cms/browser/content/newfolder.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
* New directory template for Wysiwyg Images
1212
*
1313
* @see Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content_Newfolder
14-
* @var Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content_Newfolder $this
1514
*/
1615
?>

0 commit comments

Comments
 (0)