Skip to content

Conversation

@kamil-zacek
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 24, 2025 14:50
Copilot finished reviewing on behalf of kamil-zacek November 24, 2025 14:54
Copy link

Copilot AI left a 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 pull request introduces a new coding standard rule SlevomatCodingStandard.Classes.ClassKeywordOrder that enforces the correct order of class modifiers in PHP. The rule ensures that when multiple modifiers are used on a class declaration (such as final, abstract, and readonly), they appear in the correct order: abstract or final must come before readonly.

Key changes:

  • Adds ClassKeywordOrderSniff to detect and auto-fix incorrect modifier ordering
  • Includes comprehensive test coverage with error and no-error test cases
  • Updates documentation and project configuration to enable the new rule

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SlevomatCodingStandard/Sniffs/Classes/ClassKeywordOrderSniff.php Implements the sniff to enforce correct class modifier ordering (final/abstract before readonly) with auto-fixer support
tests/Sniffs/Classes/ClassKeywordOrderSniffTest.php Test suite validating the sniff detects errors correctly on lines 30 and 49 of the error file
tests/Sniffs/Classes/data/classKeywordOrderNoErrors.php Test data containing valid class declarations with correct modifier ordering
tests/Sniffs/Classes/data/classKeywordOrderErrors.php Test data with incorrect modifier ordering (readonly before final/abstract)
tests/Sniffs/Classes/data/classKeywordOrderErrors.fixed.php Expected output after auto-fixing the errors
doc/classes.md Adds documentation for the new ClassKeywordOrder sniff
README.md Updates the sniff index to include the new rule
build/phpcs.xml Enables the new rule in the project's own coding standards configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kamil-zacek kamil-zacek force-pushed the kamil-readonly-final branch 4 times, most recently from 845a82f to cf4fe3a Compare November 24, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant