Skip to content

Conversation

@pfefferle
Copy link
Member

@pfefferle pfefferle commented Nov 10, 2025

Removes all inline phpcs ignore comments for the Universal.Operators.DisallowShortTernary rule and updates phpcs.xml to exclude this rule, permitting use of the short ternary (Elvis) operator throughout the codebase.

Proposed changes:

  • Updated PHPCS configuration to allow short ternary operators
  • Removed 11 phpcs:ignore comments across 8 files where the Elvis operator is used

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Removes all inline phpcs ignore comments for the Universal.Operators.DisallowShortTernary rule and updates phpcs.xml to exclude this rule, permitting use of the short ternary (Elvis) operator throughout the codebase.
Copilot AI review requested due to automatic review settings November 10, 2025 15:48
@pfefferle pfefferle added [Type] Janitorial Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. labels Nov 10, 2025
@pfefferle pfefferle self-assigned this Nov 10, 2025
@github-actions github-actions bot added [Feature] Collections [Focus] Compatibility Ensuring the plugin plays well with other plugins labels Nov 10, 2025
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 enables the use of short ternary operators (Elvis operator ?:) in the codebase by excluding the Universal.Operators.DisallowShortTernary PHPCS rule and removing all the phpcs:ignore comments that were previously needed to suppress warnings for this pattern.

Key Changes:

  • Updated PHPCS configuration to allow short ternary operators
  • Removed 11 phpcs:ignore comments across 8 files where the Elvis operator is used

Reviewed Changes

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

Show a summary per file
File Description
phpcs.xml Added rule exclusion for Universal.Operators.DisallowShortTernary to allow Elvis operator usage
integration/class-wp-rest-cache.php Removed phpcs:ignore comment for Elvis operator in comment type validation
integration/class-classic-editor.php Removed phpcs:ignore comment for Elvis operator when setting default quote interaction policy
includes/transformer/class-post.php Removed phpcs:ignore comment for Elvis operator when retrieving post content template
includes/model/class-user.php Removed phpcs:ignore comment for Elvis operator when getting also known as values
includes/collection/class-inbox.php Removed two phpcs:ignore comments for Elvis operators used in title retrieval
includes/class-move.php Removed phpcs:ignore comment for Elvis operator when updating also known as values
includes/class-moderation.php Removed four phpcs:ignore comments for Elvis operators in user block management
includes/class-avatars.php Removed phpcs:ignore comment for Elvis operator in comment type validation

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

obenland
obenland previously approved these changes Nov 10, 2025
Deleted redundant 'phpcs:ignore Universal.Operators.DisallowShortTernary.Found' comments from multiple files after excluding the rule in phpcs.xml. This cleans up the code and maintains consistency with the project's coding standards configuration.
@github-actions github-actions bot added [Block] Followers [Feature] WP Admin [Focus] Editor Changes to the ActivityPub experience in the block editor labels Nov 11, 2025
@pfefferle
Copy link
Member Author

@obenland btw. is the short-ternary operator allowed on WP.com?

@pfefferle
Copy link
Member Author

It is not allowed on WP.com, so we have to keep it as is.

@pfefferle pfefferle closed this Nov 11, 2025
@obenland
Copy link
Member

It is not allowed on WP.com, so we have to keep it as is.

We could add an exception for the activitypub plugin folder in the global phpcs.xml on Dotcom. There's precedent.

@pfefferle pfefferle reopened this Nov 13, 2025
- Consolidate duplicate WordPress ruleset references into single block with exclusion
- Remove standalone PHPCompatibility rule (included in PHPCompatibilityWP)
- Reorganize config values for better readability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Followers [Feature] Collections [Feature] WP Admin [Focus] Compatibility Ensuring the plugin plays well with other plugins [Focus] Editor Changes to the ActivityPub experience in the block editor Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. [Type] Janitorial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants