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

Add self-test for PHPCompatibility to not flag attribute usage #117

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

Luc45
Copy link
Member

@Luc45 Luc45 commented Jan 25, 2024

As discussed in Slack, attributes are usually backwards compatible with PHP 7, for the exception or multi-line attributes.

PHPCompatibility currently cannot differentiate between them and flags all usage of Attributes as invalid if you plan to support PHP 7.

We disabled the Attribute rule in the PHPCompatibility test as it's currently causing more false-positives than bringing benefits, as multi-line attribute usage is very rare in WP plugins, but ReturnTypeWillChange is very common, for instance.

We are keeping an eye upstream for when PHPCompatibility have a way to differentiate both, and will re-enable this rule.

  • We can see that once I added an attribute to the self-test, the attribute was first flagged
  • Then we ignored the Attribute rule in QIT
  • Then the attribute is no longer flagged

@Luc45 Luc45 requested a review from a team January 25, 2024 19:01
@Luc45 Luc45 self-assigned this Jan 25, 2024
Copy link
Contributor

@zhongruige zhongruige left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this in @Luc45!

@Luc45 Luc45 merged commit e5341c0 into trunk Jan 25, 2024
@Luc45 Luc45 deleted the 24-01/attribute-phpcompatibility branch January 25, 2024 19:07
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