-
-
Notifications
You must be signed in to change notification settings - Fork 452
phpcs-fixer: ordered_types
#5065
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
Conversation
sreichel
commented
Nov 2, 2025
- see https://cs.symfony.com/doc/rules/class_notation/ordered_types.html
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 introduces standardized ordering of union type declarations across the codebase to improve code consistency and readability. The changes are enforced by adding new PHP-CS-Fixer rules.
- Adds
ordered_typesandtypes_spacesrules to PHP-CS-Fixer configuration - Reorders union types in function signatures to follow a consistent pattern (null first, then primitive types alphabetically, then class types alphabetically)
- Updates both test files and production code with the new ordering convention
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| .php-cs-fixer.dist.php | Adds ordered_types, single_class_element_per_statement, and types_spaces rules to enforce consistent type declaration formatting |
| tests/unit/Mage/Rule/Model/AbstractTest.php | Reorders bool|array to array|bool in union type declarations |
| tests/unit/Mage/GiftMessage/Helper/MessageTest.php | Reorders union types to place null first in parameter type declaration |
| tests/unit/Mage/Core/Model/AppTest.php | Reorders union types to place null first, followed by primitive types, then class types |
| tests/unit/Mage/Core/Helper/DataTest.php | Reorders string|int|null to null|int|string |
| tests/unit/Mage/Cms/Block/Widget/Page/LinkTest.php | Reorders bool|string|null to null|bool|string |
| tests/unit/Mage/Catalog/Model/Resource/Eav/AttributeTest.php | Reorders int|string|null to null|int|string |
| tests/unit/Mage/AdminNotification/Model/InboxTest.php | Reorders array|string|null to null|array|string |
| tests/unit/Mage/Admin/Model/VariableTest.php | Reorders bool|array to array|bool |
| tests/unit/Mage/Admin/Model/BlockTest.php | Reorders bool|array to array|bool |
| tests/unit/Base/DefaultConfigTest.php | Reorders union types to place null first |
| app/code/core/Mage/Catalog/Model/Category/Api.php | Reorders Mage_Core_Exception|Exception to Exception|Mage_Core_Exception in catch block |
| app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php | Reorders Zend_Soap_Server_Exception|Exception to Exception|Zend_Soap_Server_Exception in catch block |
| app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php | Reorders Zend_Soap_Server_Exception|Exception to Exception|Zend_Soap_Server_Exception in catch block |
| app/code/core/Mage/Api/Model/Server/Adapter/Soap.php | Reorders Zend_Soap_Server_Exception|Exception to Exception|Zend_Soap_Server_Exception in catch block |
| app/code/core/Mage/Admin/Model/Resource/User.php | Reorders Mage_Core_Exception|Exception to Exception|Mage_Core_Exception in catch block |
|
Merged w/o review. Tests only and splitted catch blocks. |
|


