rector: FirstClassCallableRector#5038
Conversation
sreichel
commented
Oct 27, 2025
- https://getrector.com/rule-detail/first-class-callable-rector
There was a problem hiding this comment.
Pull Request Overview
This PR applies Rector's FirstClassCallableRector rule, which modernizes callable syntax by converting array-based callable references to first-class callable syntax (PHP 8.1+). This improves code readability and type safety by using the ... spread operator syntax.
Key changes:
- Converts array-based callables like
[$this, 'method']to$this->method(...) - Converts string callables like
'trim'totrim(...) - Updates static method references from
[static::class, 'method']tostatic::method(...)
Reviewed Changes
Copilot reviewed 71 out of 71 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| shell/indexer.php | Updated array_map to use first-class callable syntax for trim |
| lib/Varien/Db/Adapter/Pdo/Mysql.php | Converted multiple method references to first-class callable syntax |
| lib/Varien/Data/Collection/Filesystem.php | Updated filter callback references throughout the file |
| lib/Mage/HTTP/Client/Socket.php | Converted trim callable to first-class syntax |
| lib/Mage/HTTP/Client/Curl.php | Converted trim callable to first-class syntax |
| errors/processor.php | Updated strip_tags to first-class callable |
| cron.php | Converted trim callable to first-class syntax |
| app/code/core/Mage/Uploader/Helper/File.php | Updated method references to first-class callable syntax |
| app/code/core/Mage/Uploader/Block/Abstract.php | Converted method reference to first-class callable |
| app/code/core/Mage/Sales/Model/Service/Quote.php | Updated commit callbacks to first-class callable syntax |
| app/code/core/Mage/Sales/Model/Resource/Setup.php | Converted strtoupper to first-class callable |
| app/code/core/Mage/Sales/Block/Order/Totals.php | Refactored conditional logic to use in_array |
| app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php | Updated trim and is_numeric to first-class callables |
| app/code/core/Mage/Rss/Block/Order/New.php | Converted nested array callback to first-class syntax |
| app/code/core/Mage/Rss/Block/Catalog/* | Updated multiple RSS block callbacks to first-class syntax |
| app/code/core/Mage/Rating/Model/Resource/Rating.php | Converted trim to first-class callable |
| app/code/core/Mage/Paypal/* | Updated multiple callback references across Paypal modules |
| app/code/core/Mage/Paygate/Helper/Data.php | Converted method reference to first-class callable |
| app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php | Updated frame callbacks to first-class syntax |
| app/code/core/Mage/Newsletter/Model/Template.php | Converted processor method references to first-class syntax |
| app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php | Updated frame callbacks to first-class syntax |
| app/code/core/Mage/ImportExport/* | Updated multiple callbacks and refactored conditions |
| app/code/core/Mage/Eav/Model/Entity/Abstract.php | Converted sort callback to first-class syntax |
| app/code/core/Mage/Eav/Model/Attribute/Data/File.php | Updated trim to first-class callable |
| app/code/core/Mage/Downloadable/Model/Product/Type.php | Converted \intval to first-class callable |
| app/code/core/Mage/Dataflow/Model/Convert/Iterator.php | Updated callback to first-class syntax |
| app/code/core/Mage/Core/Model/* | Updated multiple callbacks across Core models |
| app/code/core/Mage/ConfigurableSwatches/Helper/* | Converted static method references to first-class syntax |
| app/code/core/Mage/CatalogSearch/Helper/Data.php | Updated method reference to first-class callable |
| app/code/core/Mage/CatalogRule/Model/Rule.php | Converted callback to first-class syntax |
| app/code/core/Mage/CatalogInventory/Model/Observer.php | Updated \intval to first-class callable |
| app/code/core/Mage/Catalog/Model/* | Updated multiple callbacks and filters across Catalog models |
| app/code/core/Mage/Bundle/Model/Product/Type.php | Converted multiple \intval references to first-class syntax |
| app/code/core/Mage/Api2/* | Updated multiple method references to first-class syntax |
| app/code/core/Mage/Api/Model/* | Updated callbacks and refactored conditions |
| app/code/core/Mage/Adminhtml/* | Updated multiple frame callbacks and method references |
| .rector.php | Removed FirstClassCallableRector from skip list |
# Conflicts: # app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php # app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php # app/code/core/Mage/Paypal/Model/Payflowlink.php
|
When touching the callable, maybe lessen this restriction for magento-lts/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php Lines 572 to 574 in 8e22f8b It stops me to add a column with |
|
@Hanmac do you mean |
Yeah, that extra |
|
It was part of a secuity fix and requested to change back in past. Please not. |
It isn't really a security feature I just want to add a Column via Layout Update and this Helper: But I can't, because inside the helper, I can't get the right callback because it wants an array like this |
|


