phpstan: variable.implicitArray (1)#5551
Open
sreichel wants to merge 2 commits intoOpenMage:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR applies minor PHPStan-driven fixes by eliminating implicit array creation and a few related baseline suppressions across core, lib, and template code.
Changes:
- Initialize variables as arrays before assigning offsets to satisfy
variable.implicitArray. - Harden
Varien_Object::_addFullNames()against non-array_datato avoid invalid array operations. - Remove PHPStan baseline entries/files that are no longer needed after the fixes (including class name case ignore).
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/Varien/Object.php | Adds array-type guards before sync-field mapping to avoid invalid array operations. |
| lib/Varien/Io/File.php | Initializes $owner/$group/$world arrays before offset assignment in permission parsing. |
| app/design/frontend/base/default/template/paypal/payment/redirect.phtml | Updates docblock class references to correct case used in codebase and removes related baseline need. |
| app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php | Initializes $lines before nested offset usage in header rendering. |
| app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php | Initializes $lines before nested offset usage in header rendering. |
| app/code/core/Mage/Sales/Model/Order/Pdf/Creditmemo.php | Initializes $lines before nested offset usage in header rendering. |
| app/code/core/Mage/Paygate/controllers/Authorizenet/PaymentController.php | Initializes $result before setting result keys in cancel action. |
| app/code/core/Mage/Paygate/controllers/Adminhtml/Paygate/Authorizenet/PaymentController.php | Initializes $result before setting result keys in cancel action. |
| app/code/core/Mage/Page/Block/Html/Toplinks.php | Initializes $toplinkInfo before populating it. |
| app/code/core/Mage/Newsletter/Model/Resource/Subscriber.php | Initializes $data before populating update payload. |
| app/code/core/Mage/Downloadable/Model/Resource/Link.php | Initializes $dataToInsert before population. |
| app/code/core/Mage/CurrencySymbol/Model/System/Currencysymbol.php | Initializes $value before writing nested option structure. |
| app/code/core/Mage/Core/Model/File/Validator/AvailablePath.php | Initializes $options before setting file_mask. |
| app/code/core/Mage/Cms/Model/Resource/Page/Collection.php | Initializes $data before setting value/label. |
| app/code/core/Mage/Checkout/controllers/OnepageController.php | Initializes $result early for consistent array usage. |
| app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Minimalprice.php | Initializes $conditions before appending SQL conditions. |
| app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php | Initializes $conditions before appending SQL conditions. |
| app/code/core/Mage/CatalogIndex/Model/Indexer/Minimalprice.php | Initializes $data and $search arrays before offset assignment. |
| app/code/core/Mage/Catalog/Model/Resource/Product.php | Initializes $updateCond before appending conditions. |
| app/code/core/Mage/Catalog/Model/Product/Image.php | Initializes $path prior to usage to satisfy PHPStan (see review nit). |
| app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php | Initializes $params before setting URL generation flags. |
| app/code/core/Mage/Catalog/Block/Layer/State.php | Initializes $params before setting URL generation flags. |
| app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php | Ensures $defaultValues is always defined and reorders a couple initializations. |
| app/code/core/Mage/Adminhtml/controllers/TagController.php | Initializes $data before offset assignment; tightens return docblock. |
| app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php | Initializes $params before use. |
| app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php | Initializes $data before building URL params. |
| app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php | Initializes $data before building URL params; removes stray whitespace line. |
| app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php | Initializes $actions before conditional pushes. |
| app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php | Initializes $config before nested offset assignment. |
| .phpstan.dist.baselines/variable.undefined.php | Removes baseline entry now fixed in bundle JSON config logic. |
| .phpstan.dist.baselines/variable.implicitArray.php | Removes many no-longer-needed ignores after explicit array initialization. |
| .phpstan.dist.baselines/offsetAccess.notFound.php | Removes baseline entry now handled by guards in Varien_Object. |
| .phpstan.dist.baselines/empty.notAllowed.php | Updates ignore count after reducing one empty() usage. |
| .phpstan.dist.baselines/class.nameCase.php | Removes obsolete baseline file (now fixed in template docblock). |
| .phpstan.dist.baselines/argument.type.php | Removes obsolete baseline entry after guarding array usage in Varien_Object. |
| .phpstan.dist.baselines/_loader.php | Stops loading the removed class.nameCase baseline file. |
|
Hanmac
reviewed
Apr 29, 2026
Comment on lines
+56
to
+61
| $params = []; | ||
| $params['_current'] = true; | ||
| $params['_use_rewrite'] = true; | ||
| $params['_query'] = $filterState; | ||
| $params['_escape'] = true; | ||
|
|
Contributor
There was a problem hiding this comment.
Wouldn't it be better to have $params = [ ... ]?
with [ ... ] being a Multiline Array?
Or better return Mage::getUrl('*/*/*', [ ... ]);
Contributor
Author
There was a problem hiding this comment.
I think this will be to much work.
Lets keep it simple.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description (*)
Minor phpstan fixes.