Skip to content

Conversation

@Kocal
Copy link
Owner

@Kocal Kocal commented Dec 16, 2025

Q A
Bug fix? no
New feature? yes
Fixed tickets Close #...

Renamed the following rules, replacing "should" with "must" to clarify requirements, and use "visibility" instead of "should be public" for broader applicability:

  • LiveActionMethodsShouldBePublicRule → Use LiveActionMethodsVisibilityRule instead
  • LiveListenerMethodsShouldBePublicRule → Use LiveListenerMethodsVisibilityRule instead
  • MethodsShouldBePublicOrPrivateRule → Use MethodsVisibilityRule instead
  • PublicPropertiesShouldBeCamelCaseRule → Use PublicPropertiesMustBeCamelCaseRule instead
  • ClassNameShouldNotEndWithComponentRule → Use ClassNameMustNotEndWithComponentRule instead
  • ExposePublicPropsShouldBeFalseRule → Use ExposePublicPropsMustBeFalseRule instead

To migrate to the new rules, update your phpstan.neon configuration:

# Before
rules:
    - Kocal\PHPStanSymfonyUX\Rules\LiveComponent\LiveActionMethodsShouldBePublicRule
    - Kocal\PHPStanSymfonyUX\Rules\LiveComponent\LiveListenerMethodsShouldBePublicRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\MethodsShouldBePublicOrPrivateRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PublicPropertiesShouldBeCamelCaseRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ClassNameShouldNotEndWithComponentRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ExposePublicPropsShouldBeFalseRule

# After
rules:
    - Kocal\PHPStanSymfonyUX\Rules\LiveComponent\LiveActionMethodsVisibilityRule
    - Kocal\PHPStanSymfonyUX\Rules\LiveComponent\LiveListenerMethodsVisibilityRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\MethodsVisibilityRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PublicPropertiesMustBeCamelCaseRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ClassNameMustNotEndWithComponentRule
    - Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ExposePublicPropsMustBeFalseRule

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 PR renames 6 PHPStan rules to improve clarity by replacing "Should" with "Must" for mandatory requirements and using "Visibility" instead of "ShouldBePublic/ShouldBePublicOrPrivate" for broader applicability. The changes maintain backward compatibility through class aliases that will be removed in version 2.0.

  • Renamed 6 PHPStan rules with more explicit naming (Must instead of Should, Visibility for access modifiers)
  • Added backward compatibility via class_alias() in a new deprecated-aliases.php file loaded through composer.json
  • Updated all test files, fixtures, and documentation to reflect the new naming

Reviewed changes

Copilot reviewed 64 out of 64 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/deprecated-aliases.php New file providing backward compatibility aliases for all 6 renamed rules
composer.json Updated autoloader to load deprecated-aliases.php file for backward compatibility
src/Rules/LiveComponent/LiveActionMethodsVisibilityRule.php Renamed from LiveActionMethodsShouldBePublicRule; changed from final to regular class; updated error identifier
src/Rules/LiveComponent/LiveListenerMethodsVisibilityRule.php Renamed from LiveListenerMethodsShouldBePublicRule; changed from final to regular class; updated error identifier
src/Rules/TwigComponent/MethodsVisibilityRule.php Renamed from MethodsShouldBePublicOrPrivateRule; changed from final to regular class; updated error identifier
src/Rules/TwigComponent/PublicPropertiesMustBeCamelCaseRule.php Renamed from PublicPropertiesShouldBeCamelCaseRule; changed from final to regular class; updated error identifier
src/Rules/TwigComponent/ClassNameMustNotEndWithComponentRule.php Renamed from ClassNameShouldNotEndWithComponentRule; changed from final to regular class; updated error identifier
src/Rules/TwigComponent/ExposePublicPropsMustBeFalseRule.php Renamed from ExposePublicPropsShouldBeFalseRule; changed from final to regular class; updated error identifier
tests/Rules/LiveComponent/LiveActionMethodsVisibilityRule/* All test files and fixtures updated with new namespaces and class names
tests/Rules/LiveComponent/LiveListenerMethodsVisibilityRule/* All test files and fixtures updated with new namespaces and class names
tests/Rules/TwigComponent/MethodsVisibilityRule/* All test files and fixtures updated with new namespaces and class names
tests/Rules/TwigComponent/PublicPropertiesMustBeCamelCaseRule/* All test files and fixtures updated with new namespaces and class names
tests/Rules/TwigComponent/ClassNameMustNotEndWithComponentRule/* All test files and fixtures updated with new namespaces and class names
tests/Rules/TwigComponent/ExposePublicPropsMustBeFalseRule/* All test files and fixtures updated with new namespaces and class names
README.md Updated all rule documentation with new names and added deprecation notices for old names

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

@Kocal Kocal merged commit 0746480 into main Dec 16, 2025
14 checks passed
@Kocal Kocal deleted the rename-rules branch December 16, 2025 00:28
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.

2 participants