Skip to content

Conversation

@Kocal
Copy link
Owner

@Kocal Kocal commented Nov 23, 2025

No description provided.

@Kocal Kocal self-assigned this Nov 23, 2025
@Kocal Kocal requested a review from Copilot November 23, 2025 20:34
Copilot finished reviewing on behalf of Kocal November 23, 2025 20:37
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 adds a new PHPStan rule PreMountMethodSignatureRule that enforces the correct signature for methods annotated with the #[PreMount] attribute in Symfony UX TwigComponent and LiveComponent classes. The rule ensures these lifecycle hook methods are public, accept exactly one array parameter, and return an array.

Key Changes

  • New PHPStan rule validates #[PreMount] method signatures with comprehensive error reporting for visibility, return type, and parameter validation
  • Migrated from PHPStan baseline file to a cleaner ignoreErrors configuration for test fixtures
  • Added comprehensive documentation with clear examples of both violations and correct usage

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Rules/TwigComponent/PreMountMethodSignatureRule.php Implements the core validation rule with five distinct error identifiers for different signature violations
tests/Rules/TwigComponent/PreMountMethodSignatureRule/PreMountMethodSignatureRuleTest.php Test class with comprehensive test methods covering violations and valid cases for both TwigComponent and LiveComponent
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/ValidTwigComponent.php Valid test fixture for #[AsTwigComponent] attribute
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/ValidLiveComponent.php Valid test fixture for #[AsLiveComponent] attribute
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/NotAComponent.php Test fixture ensuring rule only applies to component classes
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/InvalidNotPublic.php Test fixture for non-public visibility violation
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/InvalidNoReturnType.php Test fixture for missing return type violation
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/InvalidWrongReturnType.php Test fixture for incorrect return type (void) violation
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/InvalidNoParameter.php Test fixture for missing parameter violation
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/InvalidTooManyParameters.php Test fixture for too many parameters violation
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/InvalidWithNullableReturnType.php Test fixture for nullable return type (?array) violation
tests/Rules/TwigComponent/PreMountMethodSignatureRule/Fixture/InvalidWrongParameterType.php Test fixture for incorrect parameter type (string) violation
tests/Rules/TwigComponent/PreMountMethodSignatureRule/config/configured_rule.neon PHPStan configuration for the rule in tests
phpstan.dist.neon Replaced baseline approach with path-based ignoreErrors for test fixtures
phpstan-baseline.neon Removed baseline file in favor of cleaner ignoreErrors configuration
README.md Added comprehensive documentation with examples of violations and correct usage

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

@Kocal Kocal force-pushed the PreMountMethodSignatureRule branch from 03175df to b624643 Compare November 23, 2025 20:42
@Kocal Kocal merged commit 62a9145 into main Nov 23, 2025
8 checks passed
@Kocal Kocal deleted the PreMountMethodSignatureRule branch November 23, 2025 20:50
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