Skip to content
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

PHP-CS-Fixer: ordered class elements #4483

Closed
wants to merge 3 commits into from

Conversation

sreichel
Copy link
Contributor

Description (*)

I'd relly like to make progress on #4411, but @justinbeaty made a change that makes reviews bit complicated.

Methods got re-ordered by its names .

I really like that!

When adding methods/properties i often ask myself where to put it ...

Easy solution ... automate it.

This PR adds https://cs.symfony.com/doc/rules/class_notation/ordered_class_elements.html.

Note

It moves underscore-prefixed methods like "_construct" (single underscore) to the bottom ... deal with it :)

@sreichel sreichel added the chore label Jan 15, 2025
@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: Cms Relates to Mage_Cms Component: Reports Relates to Mage_Reports Component: CatalogInventory Relates to Mage_CatalogInventory Component: Checkout Relates to Mage_Checkout Component: AdminNotification Relates to Mage_AdminNotification Component: lib/Varien Relates to lib/Varien Component: Sales Relates to Mage_Sales Component: Usa Relates to Mage_Usa Component: Customer Relates to Mage_Customer Component: Eav Relates to Mage_Eav Component: lib/Mage Relates to lib/Mage Component: Adminhtml Relates to Mage_Adminhtml Component: ProductAlert Relates to Mage_ProductAlert Mage.php Relates to app/Mage.php Component: Sitemap Relates to Mage_Sitemap Component: Page Relates to Mage_Page Component: Api PageRelates to Mage_Api Component: Cron Relates to Mage_Cron Component: Captcha Relates to Mage_Captcha Component: Tag Relates to Mage_Tag Component: CurrencySymbol Relates to Mage_CurrencySymbol Component: CatalogRule Relates to Mage_CatalogRule Component: Admin Relates to Mage_Admin Component: SalesRule Relates to Mage_SalesRule Component: Wishlist Relates to Mage_Wishlist labels Jan 15, 2025
@github-actions github-actions bot added Component: Index Relates to Mage_Index Component: Downloadable Relates to Mage_Downloadable Component: Bundle Relates to Mage_Bundle Component: CatalogIndex Relates to Mage_CatalogIndex Component: Api2 Relates to Mage_Api2 Component: Media Relates to Mage_Media Component: Log Relates to Mage_Log Component: ImportExport Relates to Mage_ImportExport Component: Directory Relates to Mage_Directory Component: ConfigurableSwatches Relates to Mage_ConfigurableSwatches Component: CatalogSearch Relates to Mage_CatalogSearch shell Relates to shell scripts Component: Authorizenet Relates to Mage_Authorizenet Component: Centinel Relates to Mage_Centinel Component: Dataflow Relates to Mage_Dataflow Component: Install Relates to Mage_Install Component: Uploader Relates to Mage_Uploader Component: Rss Relates to Mage_Rss Component: Paygate Relates to Mage_Paygate Component: lib/* Relates to lib/* errors Relates to error pages php-cs-fixer Component: lib/Magento Relates to lib/Magento labels Jan 15, 2025
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@sreichel sreichel marked this pull request as draft January 15, 2025 05:09
@justinbeaty
Copy link
Contributor

justinbeaty commented Jan 15, 2025

Even if I was the inspiration for this PR, I'm not sure how I feel about it. Often times method are grouped together by their role, and this would make it harder to read the code just so we can have another rule to be applied.

Also to be clear, the other PR I made I didn't reorder the methods to be in alphabetical order, but instead regrouped them so they logically made sense. This PR would undo that effort.

@sreichel sreichel closed this Jan 15, 2025
@sreichel sreichel deleted the php-cs-order branch January 15, 2025 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Component: Admin Relates to Mage_Admin Component: Adminhtml Relates to Mage_Adminhtml Component: AdminNotification Relates to Mage_AdminNotification Component: Api PageRelates to Mage_Api Component: Api2 Relates to Mage_Api2 Component: Authorizenet Relates to Mage_Authorizenet Component: Bundle Relates to Mage_Bundle Component: Captcha Relates to Mage_Captcha Component: Catalog Relates to Mage_Catalog Component: CatalogIndex Relates to Mage_CatalogIndex Component: CatalogInventory Relates to Mage_CatalogInventory Component: CatalogRule Relates to Mage_CatalogRule Component: CatalogSearch Relates to Mage_CatalogSearch Component: Centinel Relates to Mage_Centinel Component: Checkout Relates to Mage_Checkout Component: Cms Relates to Mage_Cms Component: ConfigurableSwatches Relates to Mage_ConfigurableSwatches Component: Core Relates to Mage_Core Component: Cron Relates to Mage_Cron Component: CurrencySymbol Relates to Mage_CurrencySymbol Component: Customer Relates to Mage_Customer Component: Dataflow Relates to Mage_Dataflow Component: Directory Relates to Mage_Directory Component: Downloadable Relates to Mage_Downloadable Component: Eav Relates to Mage_Eav Component: ImportExport Relates to Mage_ImportExport Component: Index Relates to Mage_Index Component: Install Relates to Mage_Install Component: lib/Mage Relates to lib/Mage Component: lib/Magento Relates to lib/Magento Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* Component: Log Relates to Mage_Log Component: Media Relates to Mage_Media Component: Newsletter Relates to Mage_Newsletter Component: Oauth Relates to Mage_Oauth Component: Page Relates to Mage_Page Component: Paygate Relates to Mage_Paygate Component: Payment Relates to Mage_Payment Component: PayPal Relates to Mage_Paypal Component: ProductAlert Relates to Mage_ProductAlert Component: Rating Relates to Mage_Rating Component: Reports Relates to Mage_Reports Component: Review Relates to Mage_Review Component: Rss Relates to Mage_Rss Component: Rule Relates to Mage_Rule Component: Sales Relates to Mage_Sales Component: SalesRule Relates to Mage_SalesRule Component: Shipping Relates to Mage_Shipping Component: Sitemap Relates to Mage_Sitemap Component: Tag Relates to Mage_Tag Component: Tax Relates to Mage_Tax Component: Uploader Relates to Mage_Uploader Component: Usa Relates to Mage_Usa Component: Weee Relates to Mage_Weee Component: Widget Relates to Mage_Widget Component: Wishlist Relates to Mage_Wishlist errors Relates to error pages Mage.php Relates to app/Mage.php php-cs-fixer shell Relates to shell scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants