Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPStan fixes #4405

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
72f9395
fatal
sreichel Dec 7, 2024
4c008f6
fatal
sreichel Dec 7, 2024
124376c
fatal
sreichel Dec 7, 2024
8bd542c
unused
sreichel Dec 7, 2024
832a98c
unused
sreichel Dec 7, 2024
5c9e4c3
baseline
sreichel Dec 7, 2024
908d003
phpstan2
sreichel Dec 7, 2024
cddc160
phpmd doc fix
sreichel Dec 7, 2024
617f6d5
baseline
sreichel Dec 7, 2024
abb6706
composer.lock
sreichel Dec 7, 2024
cbaf906
Merge branch 'main' into phpstan-clean
sreichel Dec 7, 2024
5de452c
rector
sreichel Dec 7, 2024
10f56aa
Merge branch 'main' into phpstan-clean
sreichel Dec 25, 2024
1790229
Merge branch 'main' into phpstan-clean
sreichel Jan 6, 2025
0674432
Merge branch 'main' into phpstan-clean
sreichel Jan 9, 2025
044011a
Merge branch 'main' into phpstan-clean
sreichel Jan 11, 2025
d69ff57
Merge branch 'main' into phpstan-clean
sreichel Jan 15, 2025
4e3c2e0
Merge branch 'main' into phpstan-clean
sreichel Jan 15, 2025
0b937af
remove - instead of adding required methods
sreichel Jan 15, 2025
17fb177
phpstan
sreichel Jan 15, 2025
680498f
phpstan baseline
sreichel Jan 15, 2025
2919281
phpstan ignore
sreichel Jan 15, 2025
0b4935e
revert
sreichel Jan 16, 2025
ae2dc39
baseline
sreichel Jan 16, 2025
68722a8
update
sreichel Jan 17, 2025
6ff253b
update + baseline
sreichel Jan 18, 2025
8cfada5
update + baseline
sreichel Jan 18, 2025
b6de49e
update + fix
sreichel Jan 18, 2025
ec7520c
updated config
sreichel Jan 18, 2025
b397128
update + baseline
sreichel Jan 18, 2025
d238a89
Merge branch 'main' into phpstan-clean
sreichel Jan 18, 2025
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
10 changes: 4 additions & 6 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php
/*
* This document has been generated with
* https://mlocati.github.io/php-cs-fixer-configurator/#version:3.4.0|configurator
* you can change this configuration by importing this file.
*/

declare(strict_types=1);

$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
Expand Down Expand Up @@ -35,5 +33,5 @@
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
->ignoreVCS(true),
);
108 changes: 54 additions & 54 deletions .phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics/Grid.php

-
message: '#^Parameter \#2 \$filter of method Mage_Reports_Model_Resource_Quote_Collection\:\:prepareForAbandonedReport\(\) expects string\|null, array\<int\|string, array\<mixed\>\|string\> given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php

-
message: '#^Parameter \#1 \$statusCode of method Mage_Tag_Model_Resource_Popular_Collection\:\:addStatusFilter\(\) expects string, int given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -1254,12 +1248,6 @@ parameters:
count: 1
path: app/code/core/Mage/Api2/Model/Route/ApiType.php

-
message: '#^Method Mage_Api2_Model_Server\:\:_setAuthUser\(\) has Exception in PHPDoc @throws tag but it''s not thrown\.$#'
identifier: throws.unusedType
count: 1
path: app/code/core/Mage/Api2/Model/Server.php

-
message: '#^Call to an undefined method Varien_Object\:\:encrypt\(\)\.$#'
identifier: method.notFound
Expand Down Expand Up @@ -1626,12 +1614,6 @@ parameters:
count: 1
path: app/code/core/Mage/Catalog/Helper/Product/Compare.php

-
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, float given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php

-
message: '#^Call to an undefined method Mage_Core_Model_Resource_Db_Collection_Abstract\:\:setStoreId\(\)\.$#'
identifier: method.notFound
Expand Down Expand Up @@ -2670,6 +2652,18 @@ parameters:
count: 1
path: app/code/core/Mage/Centinel/Helper/Data.php

-
message: '#^Method Mage_Centinel_Model_Api\:\:callLookup\(\) should return \$this\(Mage_Centinel_Model_Api\) but returns Varien_Object\.$#'
identifier: return.type
count: 1
path: app/code/core/Mage/Centinel/Model/Api.php

-
message: '#^Property Mage_Centinel_Model_Api\:\:\$_clientInstance \(Mage_Centinel_Model_Api_Client\) in empty\(\) is not falsy\.$#'
identifier: empty.property
count: 1
path: app/code/core/Mage/Centinel/Model/Api.php

-
message: '#^Cannot call method setItem\(\) on array\.$#'
identifier: method.nonObject
Expand Down Expand Up @@ -3252,6 +3246,18 @@ parameters:
count: 1
path: app/code/core/Mage/Core/Model/Locale.php

-
message: '#^Method Mage_Core_Model_Mysql4_Design_Theme_Collection\:\:setData\(\) invoked with 2 parameters, 1 required\.$#'
identifier: arguments.count
count: 1
path: app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php

-
message: '#^Parameter \#1 \$value of method Mage_Core_Model_Mysql4_Design_Theme_Collection\:\:setData\(\) expects array, string given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php

-
message: '#^Call to an undefined method Mage_Core_Model_Resource_Type_Abstract\:\:getConnection\(\)\.$#'
identifier: method.notFound
Expand Down Expand Up @@ -4422,12 +4428,6 @@ parameters:
count: 1
path: app/code/core/Mage/GiftMessage/controllers/IndexController.php

-
message: '#^Method Mage_GoogleAnalytics_Block_Ga\:\:_getOrdersTrackingCode\(\) has Mage_Core_Model_Store_Exception in PHPDoc @throws tag but it''s not thrown\.$#'
identifier: throws.unusedType
count: 1
path: app/code/core/Mage/GoogleAnalytics/Block/Ga.php

-
message: '#^Return type \(void\) of method Mage_GoogleCheckout_Model_Payment\:\:authorize\(\) should be compatible with return type \(\$this\(Mage_Payment_Model_Method_Abstract\)\) of method Mage_Payment_Model_Method_Abstract\:\:authorize\(\)$#'
identifier: method.childReturnType
Expand Down Expand Up @@ -5004,6 +5004,12 @@ parameters:
count: 1
path: app/code/core/Mage/Paypal/Model/Pro.php

-
message: '#^Variable \$line in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
count: 1
path: app/code/core/Mage/Paypal/Model/Report/Settlement.php

-
message: '#^Method Varien_Data_Collection\:\:toOptionArray\(\) invoked with 1 parameter, 0 required\.$#'
identifier: arguments.count
Expand Down Expand Up @@ -5190,18 +5196,6 @@ parameters:
count: 1
path: app/code/core/Mage/Reports/Model/Resource/Product/Sold/Collection.php

-
message: '#^Parameter \#1 \$filter of method Mage_Reports_Model_Resource_Quote_Collection\:\:addCustomerData\(\) expects array\|null, string\|null given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php

-
message: '#^Parameter \#2 \$filter of method Mage_Reports_Model_Resource_Quote_Collection\:\:addSubtotal\(\) expects array\|null, string\|null given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php

-
message: '#^Parameter \#3 \$cols of method Zend_Db_Select\:\:joinInner\(\) expects array\|string, null given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -5682,12 +5676,6 @@ parameters:
count: 1
path: app/code/core/Mage/Sales/Model/Quote.php

-
message: '#^Parameter \#2 \$array of function implode expects array\<string\>, list\<array\|string\> given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Sales/Model/Quote.php

-
message: '#^Property Mage_Sales_Model_Quote\:\:\$_addresses \(Mage_Sales_Model_Resource_Order_Address_Collection\|null\) does not accept Mage_Sales_Model_Resource_Quote_Address_Collection\.$#'
identifier: assign.propertyType
Expand Down Expand Up @@ -5784,18 +5772,6 @@ parameters:
count: 3
path: app/code/core/Mage/Sales/Model/Recurring/Profile.php

-
message: '#^Parameter \#2 \$attribute of method Mage_Sales_Model_Resource_Order_Abstract\:\:_afterSaveAttribute\(\) expects string, array\<mixed, mixed\> given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php

-
message: '#^Parameter \#2 \$attribute of method Mage_Sales_Model_Resource_Order_Abstract\:\:_beforeSaveAttribute\(\) expects string, array\<mixed, mixed\> given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php

-
message: '#^Cannot call method updateOnRelatedRecordChanged\(\) on Mage_Core_Model_Resource_Db_Collection_Abstract\|false\.$#'
identifier: method.nonObject
Expand Down Expand Up @@ -8364,6 +8340,30 @@ parameters:
count: 1
path: lib/Varien/Db/Statement/Pdo/Mysql.php

-
message: '#^Binary operation "\.\=" between array and non\-falsy\-string results in an error\.$#'
identifier: assignOp.invalid
count: 1
path: lib/Varien/File/Object.php

-
message: '#^Method Varien_Directory_Collection\:\:lastDir\(\) invoked with 1 parameter, 0 required\.$#'
identifier: arguments.count
count: 1
path: lib/Varien/File/Object.php

-
message: '#^Parameter &\$files by\-ref type of method Varien_File_Object\:\:getFilesName\(\) expects array, array\|null given\.$#'
identifier: parameterByRef.type
count: 1
path: lib/Varien/File/Object.php

-
message: '#^Static call to instance method Varien_Directory_Collection\:\:lastDir\(\)\.$#'
identifier: method.staticCall
count: 1
path: lib/Varien/File/Object.php

-
message: '#^Right side of && is always false\.$#'
identifier: booleanAnd.rightAlwaysFalse
Expand Down
59 changes: 16 additions & 43 deletions .phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -17,59 +17,32 @@ parameters:
- index.php
- install.php
- app/Mage.php
- app/code/core/Mage
- app/code/core/
- app/design/
- errors
- lib/Mage
- lib/Magento
- lib/Varien
- shell
- tests/unit
- errors/
- lib/
- shell/
- tests/unit/
excludePaths:
#incompatible interfaces
- app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php
- app/code/core/Mage/Admin/Model/Acl/Assert/Time.php
- app/code/core/Mage/Api/Model/Acl/Assert/Ip.php
- app/code/core/Mage/Api/Model/Acl/Assert/Time.php
- app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php
- lib/Varien/Directory/Collection.php
- lib/Varien/Directory/Factory.php
- lib/Varien/File/Object.php

# deprecated _getHelper()
- app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php
- app/code/core/Mage/Adminhtml/controllers/Rss/OrderController.php
- app/code/core/Mage/Adminhtml/controllers/Rss/CatalogController.php

# contains 1 abstract method and must therefore be declared abstract or implement the remaining methods
- app/code/core/Mage/Dataflow/Model/Session/Adapter/Http.php
- app/code/core/Mage/Dataflow/Model/Convert/Iterator/Http.php
- app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php
- lib/Varien/Convert/Validator/Column.php

# Cannot declare class Varien_Date, because the name is already in use
- app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php
# custom commands
- lib/_n98-magerun/ (?)

# Cannot declare class XMLParser, because the name is already in use
- app/code/core/Mage/Centinel/Model/Api.php
- app/code/core/Mage/Centinel/Model/Api/Client.php

# Class phpseclib\Net\SSH2 not found.
- app/code/core/Mage/Paypal/Model/Report/Settlement.php
- lib/Varien/Io/Sftp.php
# libraries
- lib/3Dsecure/
- lib/Unserialize/

# Dataflow/Model/Convert/Iterator.php
- app/code/core/Mage/Dataflow/Model/Convert/Iterator.php
# others
- lib/Varien/Directory/Collection.php

# Too much noise from "Variable $this might not be defined"
- app/code/core/*/*/data/*
- app/code/core/*/*/sql/*

# requires Mycrypt
- lib/Magento/Crypt.php
- lib/Varien/Crypt/Mcrypt.php
# Class Mage_Centinel_Model_Api_Client extends unknown class CentinelClient.
- app/code/core/Mage/Centinel/Model/Api/Client.php

# Instantiated class not found
# Instantiated class Varien_Image_Adapter_Gd not found.
# Instantiated class Varien_Image_Adapter_Imagemagic not found.
- lib/Varien/Image/Adapter.php
ignoreErrors:
-
Expand Down
47 changes: 0 additions & 47 deletions app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php

This file was deleted.

47 changes: 0 additions & 47 deletions app/code/core/Mage/Admin/Model/Acl/Assert/Time.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,4 @@ protected function checkFeedEnable($code)
return false;
}
}

/**
* Retrieve helper instance
*
* @param string $name
* @return Mage_Core_Helper_Abstract
* @deprecated this method is incompatible with parent class. Use Mage::helper instead
*/
protected function _getHelper($name)
{
return Mage::helper($name);
}
}
Loading
Loading