Skip to content

Conversation

@sreichel
Copy link
Contributor

@sreichel sreichel commented Nov 7, 2025

No description provided.

@sreichel sreichel added the chore label Nov 7, 2025
Copilot AI review requested due to automatic review settings November 7, 2025 00:06
@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: Reports Relates to Mage_Reports 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: CatalogIndex Relates to Mage_CatalogIndex Component: lib/* Relates to lib/* phpstan README labels Nov 7, 2025
@github-actions github-actions bot removed the README label Nov 7, 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 PR improves PHPStan static analysis compliance by correcting type hints in docblocks, removing unused variables, simplifying conditions, and adding type annotations. These changes address numerous PHPStan baseline warnings and improve code quality without altering functionality.

  • Corrected parameter type hints in docblocks to match actual usage patterns (e.g., int|string instead of just string, array instead of string)
  • Removed unused variables from method chains and simplified redundant conditional checks
  • Added inline type annotations to improve IDE support and static analysis accuracy

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/Varien/Db/Adapter/Interface.php Updated $value parameter type hint to int|string for getIfNullSql()
lib/Varien/Data/Form/Element/Multiline.php Renamed parameter from $suffix to $idSuffix and changed type from int to string for consistency with parent class
app/code/core/Mage/Sales/controllers/Billing/AgreementController.php Added inline type annotation for $billingAgreement variable
app/code/core/Mage/Sales/Model/Quote/Address/Item.php Fixed method name from getOptionBycode() to getOptionByCode() for consistency
app/code/core/Mage/Sales/Model/Quote.php Corrected property type from Order_Address_Collection to Quote_Address_Collection, removed redundant null check, and repositioned type annotation
app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php Removed unused $transactionSave variable
app/code/core/Mage/Sales/Model/Order/Shipment/Api.php Removed unused $transactionSave variable
app/code/core/Mage/Sales/Model/Order/Invoice/Api.php Removed unused $transactionSave variables and corrected $invoiceIncrementId parameter type to string
app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php Updated $filter parameter type from string to array
app/code/core/Mage/Reports/Model/Resource/Product/Sold/Collection.php Updated $from and $to parameter types from int to string
app/code/core/Mage/Reports/Model/Resource/Product/Ordered/Collection.php Updated $from and $to parameter types from int to string
app/code/core/Mage/Reports/Model/Resource/Order/Collection.php Changed integer literals to string literals in getDateRange() call
app/code/core/Mage/Paypal/Model/Method/Agreement.php Simplified condition by removing redundant null check and added type annotation
app/code/core/Mage/Core/Helper/String.php Added null to parameter type hint for $string in cleanString()
app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php Added explicit type casting for CUST_GROUP_ALL constant
app/code/core/Mage/CatalogIndex/Model/Retreiver.php Added type annotation, refactored return statement, and changed string interpolation syntax
app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php Updated $attributeId parameter type from array to string
app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php Removed unused $transactionSave variable
app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php Removed unused $transactionSave variable
app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php Added type annotation and split method chain to separate lines
app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php Added type annotation and split method chain to separate lines
app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php Added type annotation and split method chain to separate lines
app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php Generalized return type from Order_Invoice to Abstract for getSource()
README.md Corrected contributor GitHub username from "vernad" to "vernard"
.phpstan.dist.baseline.neon Removed 48 baseline entries that are now resolved by the type hint corrections
Comments suppressed due to low confidence (3)

app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php:45

  • The method chain is split across lines 37-45 and ends with a standalone semicolon on line 45. While this is valid PHP syntax, it's unconventional and inconsistent with typical code style. Consider either:
  1. Moving the semicolon to the end of line 44 after ->setOrderFilter($this->getOrder()), or
  2. Removing the semicolon from line 45 and adding it directly after the last method call
        $collection
            ->addFieldToSelect('entity_id')
            ->addFieldToSelect('created_at')
            ->addFieldToSelect('increment_id')
            ->addFieldToSelect('total_qty')
            ->addFieldToSelect('shipping_name')
            ->setOrderFilter($this->getOrder())
        ;

app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php:45

  • The method chain is split across lines 37-45 and ends with a standalone semicolon on line 45. While this is valid PHP syntax, it's unconventional and inconsistent with typical code style. Consider either:
  1. Moving the semicolon to the end of line 44 after ->setOrderFilter($this->getOrder()), or
  2. Removing the semicolon from line 45 and adding it directly after the last method call
        $collection
            ->addFieldToSelect('entity_id')
            ->addFieldToSelect('created_at')
            ->addFieldToSelect('order_id')
            ->addFieldToSelect('increment_id')
            ->addFieldToSelect('state')
            ->addFieldToSelect('grand_total')
            ->addFieldToSelect('base_grand_total')

app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php:45

  • The method chain is split across lines 37-45 and ends with a standalone semicolon on line 45. While this is valid PHP syntax, it's unconventional and inconsistent with typical code style. Consider either:
  1. Moving the semicolon to the end of line 44 after ->setOrderFilter($this->getOrder()), or
  2. Removing the semicolon from line 45 and adding it directly after the last method call
        $collection
            ->addFieldToSelect('entity_id')
            ->addFieldToSelect('created_at')
            ->addFieldToSelect('increment_id')
            ->addFieldToSelect('order_currency_code')
            ->addFieldToSelect('store_currency_code')
            ->addFieldToSelect('base_currency_code')
            ->addFieldToSelect('state')

@sreichel
Copy link
Contributor Author

sreichel commented Nov 7, 2025

Merged as it is 99% docblock updates.

@sreichel sreichel merged commit a39f7b9 into OpenMage:main Nov 7, 2025
20 checks passed
@sreichel sreichel deleted the phpstan/mixed branch November 7, 2025 00:24
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
25.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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: Catalog Relates to Mage_Catalog Component: CatalogIndex Relates to Mage_CatalogIndex 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: PayPal Relates to Mage_Paypal Component: Reports Relates to Mage_Reports Component: Sales Relates to Mage_Sales phpstan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant