Skip to content

Conversation

@sreichel
Copy link
Contributor

@sreichel sreichel commented Nov 8, 2025

  • updated docblock
  • renamed some short vars
  • fixed not existing Mage::getResourceModel('sales/invoice_collection')

[OK] Baseline generated with 1197 errors.

Arround 100 issues fixed.

# Conflicts:
#	app/code/core/Mage/Sales/Model/Order/Total/Config/Base.php
#	app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php
Copilot AI review requested due to automatic review settings November 8, 2025 06:46
@sreichel sreichel added the chore label Nov 8, 2025
@github-actions github-actions bot added Component: PayPal Relates to Mage_Paypal Component: Core Relates to Mage_Core Component: Catalog Relates to Mage_Catalog Component: CatalogInventory Relates to Mage_CatalogInventory Component: lib/Varien Relates to lib/Varien Component: Sales Relates to Mage_Sales Component: Adminhtml Relates to Mage_Adminhtml Component: Tag Relates to Mage_Tag Component: SalesRule Relates to Mage_SalesRule Component: Weee Relates to Mage_Weee Component: Rule Relates to Mage_Rule Component: Payment Relates to Mage_Payment Component: Bundle Relates to Mage_Bundle Component: lib/* Relates to lib/* phpstan labels Nov 8, 2025
Copy link
Contributor

Copilot AI left a 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

sreichel and others added 3 commits November 8, 2025 07:53
…1.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…1.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sreichel
Copy link
Contributor Author

sreichel commented Nov 8, 2025

Safe.

@sreichel sreichel merged commit a0e0683 into OpenMage:main Nov 8, 2025
20 checks passed
@sreichel sreichel deleted the phpstan/mixed branch November 8, 2025 07:18
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 8, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Component: Adminhtml Relates to Mage_Adminhtml Component: Bundle Relates to Mage_Bundle Component: Catalog Relates to Mage_Catalog Component: CatalogInventory Relates to Mage_CatalogInventory Component: Core Relates to Mage_Core Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* Component: Payment Relates to Mage_Payment Component: PayPal Relates to Mage_Paypal Component: Rule Relates to Mage_Rule Component: Sales Relates to Mage_Sales Component: SalesRule Relates to Mage_SalesRule Component: Tag Relates to Mage_Tag Component: Weee Relates to Mage_Weee phpstan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant