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 17:56
@Kocal Kocal force-pushed the live-component branch 2 times, most recently from c25c1a6 to c1dc2e8 Compare November 23, 2025 17:59
Copilot finished reviewing on behalf of Kocal November 23, 2025 18:00
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 extends PHPStan rule support to cover LiveComponents (classes annotated with #[AsLiveComponent]) in addition to TwigComponents. Since LiveComponents are enhanced TwigComponents, all existing validation rules now apply to both component types.

Key Changes

  • Added AttributeFinder::findAnyAttribute() method to check for multiple attribute types
  • Updated all 6 TwigComponent rules to support both #[AsTwigComponent] and #[AsLiveComponent] attributes
  • Added comprehensive test coverage with LiveComponent fixtures for all rules
  • Updated documentation (README.md, AGENTS.md) to clarify that rules apply to both component types
  • Added symfony/ux-live-component as a dev dependency

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/NodeAnalyzer/AttributeFinder.php Added findAnyAttribute() method to support checking multiple attribute types in a single call
src/Rules/TwigComponent/PublicPropertiesShouldBeCamelCaseRule.php Updated to check for both AsTwigComponent and AsLiveComponent attributes
src/Rules/TwigComponent/ForbiddenInheritanceRule.php Updated to check for both AsTwigComponent and AsLiveComponent attributes
src/Rules/TwigComponent/ForbiddenClassPropertyRule.php Updated to check for both AsTwigComponent and AsLiveComponent attributes
src/Rules/TwigComponent/ForbiddenAttributesPropertyRule.php Updated to check for both attributes and dynamically reference attribute name in error messages
src/Rules/TwigComponent/ExposePublicPropsShouldBeFalseRule.php Updated to check for both AsTwigComponent and AsLiveComponent attributes
src/Rules/TwigComponent/ClassNameShouldNotEndWithComponentRule.php Updated to check for both AsTwigComponent and AsLiveComponent attributes
tests/Rules/TwigComponent/PublicPropertiesShouldBeCamelCaseRule/PublicPropertiesShouldBeCamelCaseRuleTest.php Added tests for LiveComponent with snake_case and camelCase properties
tests/Rules/TwigComponent/PublicPropertiesShouldBeCamelCaseRule/Fixture/LiveComponentWithSnakeCaseProperty.php Added test fixture demonstrating violations with LiveComponent
tests/Rules/TwigComponent/PublicPropertiesShouldBeCamelCaseRule/Fixture/LiveComponentWithCamelCaseProperties.php Added test fixture demonstrating compliant LiveComponent usage
tests/Rules/TwigComponent/ForbiddenInheritanceRule/ForbiddenInheritanceRuleTest.php Added tests for LiveComponent with and without inheritance
tests/Rules/TwigComponent/ForbiddenInheritanceRule/Fixture/LiveComponentWithoutInheritance.php Added test fixture for compliant LiveComponent without inheritance
tests/Rules/TwigComponent/ForbiddenInheritanceRule/Fixture/LiveComponentWithInheritance.php Added test fixture demonstrating violation with LiveComponent inheritance
tests/Rules/TwigComponent/ForbiddenClassPropertyRule/ForbiddenClassPropertyRuleTest.php Added tests for LiveComponent with and without class property
tests/Rules/TwigComponent/ForbiddenClassPropertyRule/Fixture/LiveComponentWithNoClassProperty.php Added test fixture for compliant LiveComponent
tests/Rules/TwigComponent/ForbiddenClassPropertyRule/Fixture/LiveComponentWithClassProperty.php Added test fixture demonstrating class property violation
tests/Rules/TwigComponent/ForbiddenAttributesPropertyRule/ForbiddenAttributesPropertyRuleTest.php Added tests for LiveComponent with and without attributes property
tests/Rules/TwigComponent/ForbiddenAttributesPropertyRule/Fixture/LiveComponentWithNoAttributesProperty.php Added test fixture for compliant LiveComponent
tests/Rules/TwigComponent/ForbiddenAttributesPropertyRule/Fixture/LiveComponentWithAttributesProperty.php Added test fixture demonstrating attributes property violation
tests/Rules/TwigComponent/ExposePublicPropsShouldBeFalseRule/Fixture/LiveComponentWithExposePublicPropsTrue.php Added test fixture demonstrating exposePublicProps violation with LiveComponent
tests/Rules/TwigComponent/ExposePublicPropsShouldBeFalseRule/Fixture/LiveComponentWithExposePublicPropsFalse.php Added test fixture for compliant LiveComponent with exposePublicProps set to false
tests/Rules/TwigComponent/ExposePublicPropsShouldBeFalseRule/ExposePublicPropsShouldBeFalseRuleTest.php Added test for LiveComponent with exposePublicProps configurations
tests/Rules/TwigComponent/ClassNameShouldNotEndWithComponentRule/Fixture/ValidLiveComponentName.php Added test fixture for LiveComponent with valid naming
tests/Rules/TwigComponent/ClassNameShouldNotEndWithComponentRule/Fixture/InvalidLiveComponentName.php Added test fixture demonstrating naming violation with LiveComponent
tests/Rules/TwigComponent/ClassNameShouldNotEndWithComponentRule/ClassNameShouldNotEndWithComponentRuleTest.php Added tests for LiveComponent naming validation
composer.json Added symfony/ux-live-component as dev dependency for testing
README.md Added note clarifying that all rules apply to LiveComponents; improved installation section formatting
AGENTS.md Updated project overview and rule creation examples to include LiveComponent support

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

@Kocal Kocal requested a review from Copilot November 23, 2025 18:07
Copilot finished reviewing on behalf of Kocal November 23, 2025 18:09
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

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


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

@Kocal Kocal merged commit 45580c1 into main Nov 23, 2025
14 checks passed
@Kocal Kocal deleted the live-component branch November 23, 2025 18:11
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