-
-
Notifications
You must be signed in to change notification settings - Fork 452
Phpstan: multiple fixes #5082
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: multiple fixes #5082
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request enhances type hints and documentation in PHPDoc comments across the OpenMage codebase while making related code quality improvements and resolving numerous PHPStan baseline issues.
- Improved PHPDoc type hints for parameters, return types, and exception annotations across 40+ files
- Refactored variable names for better code clarity (e.g.,
$i→$index,$k→$str,$category→$node) - Added explicit type casting where appropriate (e.g.,
(float),(int)) - Enhanced array handling with
array_map(intval(...), ...)for safer integer conversions - Removed 100+ PHPStan baseline suppressions that are now resolved
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.phpstan.dist.baseline.neon |
Removed 100+ resolved PHPStan errors after type hint improvements |
lib/Varien/Data/Collection.php |
Added int to $value parameter type hint |
app/code/core/Mage/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php |
Enhanced parameter types and added @throws annotations |
app/code/core/Mage/Weee/Helper/Data.php |
Improved parameter type unions and formatting |
app/code/core/Mage/Tag/Model/Resource/Tag/Collection.php |
Extended $condition parameter type to include null|int|string |
app/code/core/Mage/Tag/Model/Resource/Tag.php |
Added exception documentation and improved variable naming ($k → $str) |
app/code/core/Mage/SalesRule/Model/Rule/Customer.php |
Added @throws annotation |
app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php |
Enhanced parameter type to accept condition objects |
app/code/core/Mage/SalesRule/Model/Observer.php |
Used array_map(intval(...), ...) for safer ID conversion and added exception annotations |
app/code/core/Mage/Sales/Model/Resource/Quote/Item/Option/Collection.php |
Expanded parameter types and added exception documentation |
app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php |
Corrected parameter type from array to Mage_Core_Model_Config_Element |
app/code/core/Mage/Sales/Model/Order/Total/Config/Base.php |
Fixed parameter type documentation |
app/code/core/Mage/Sales/Model/Order/Total/Abstract.php |
Corrected property annotation type |
app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php |
Enhanced parameter type to accept collections |
app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php |
Added exception annotations and improved parameter types |
app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php |
Enhanced parameter type to accept collections |
app/code/core/Mage/Sales/Model/Order/Pdf/Creditmemo.php |
Enhanced parameter type to accept collections |
app/code/core/Mage/Sales/Model/Config/Ordered.php |
Added type hint comment and corrected parameter types |
app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Admin/V1.php |
Renamed parameter for clarity and updated exception handling |
app/code/core/Mage/Sales/Block/Order/Details.php |
Fixed resource model identifier and added exception annotations |
app/code/core/Mage/Rule/Model/Condition/Combine.php |
Enhanced parameter and return type documentation |
app/code/core/Mage/Rule/Model/Condition/Abstract.php |
Improved variable naming and fixed return type documentation |
app/code/core/Mage/Paypal/Model/Api/Abstract.php |
Improved variable naming ($i → $index) and added nullability hints |
app/code/core/Mage/Payment/Model/Config.php |
Enhanced variable naming and added type hint comment |
app/code/core/Mage/GiftMessage/Model/Message.php |
Corrected return type and added exception annotation |
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php |
Added extensive exception documentation and improved variable naming |
app/code/core/Mage/Core/Model/Resource/Db/Abstract.php |
Enhanced parameter type to accept Varien_Object |
app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item/Collection.php |
Corrected parameter type to accept collections |
app/code/core/Mage/Catalog/Model/Resource/Product.php |
Renamed parameter for consistency and added exception annotations |
app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php |
Renamed parameter for clarity and added exception annotations |
app/code/core/Mage/Catalog/Model/Product/Type.php |
Enhanced return type documentation |
app/code/core/Mage/Catalog/Model/Product.php |
Added exception annotations, fixed comparison logic, and modernized ternary operator |
app/code/core/Mage/Catalog/Helper/Product.php |
Enhanced parameter types and added exception annotations |
app/code/core/Mage/Catalog/Helper/Data.php |
Improved parameter types and added exception annotations |
app/code/core/Mage/Catalog/Block/Widget/Link.php |
Added explicit integer casting and exception annotations |
app/code/core/Mage/Catalog/Block/Product/View/Attributes.php |
Added float casting for price conversion |
app/code/core/Mage/Bundle/Model/Product/Price.php |
Enhanced parameter type to accept integers |
app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php |
Added type hint comments for better clarity |
app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Admin/V1.php
Outdated
Show resolved
Hide resolved
app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Admin/V1.php
Outdated
Show resolved
Hide resolved
…1.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…1.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Safe. |
|



Mage::getResourceModel('sales/invoice_collection')Arround 100 issues fixed.