-
-
Notifications
You must be signed in to change notification settings - Fork 452
PhpStan: docblock fixes #5077
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: docblock fixes #5077
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 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|stringinstead of juststring,arrayinstead ofstring) - 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:
- Moving the semicolon to the end of line 44 after
->setOrderFilter($this->getOrder()), or - 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:
- Moving the semicolon to the end of line 44 after
->setOrderFilter($this->getOrder()), or - 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:
- Moving the semicolon to the end of line 44 after
->setOrderFilter($this->getOrder()), or - 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')
|
Merged as it is 99% docblock updates. |
|


No description provided.