Skip to content

Convert two switch statements to match expressions. - #1986

Open
shadyvb wants to merge 1 commit into
ticket/XWPENG-47-constructor-promotionfrom
ticket/XWPENG-47-match
Open

Convert two switch statements to match expressions.#1986
shadyvb wants to merge 1 commit into
ticket/XWPENG-47-constructor-promotionfrom
ticket/XWPENG-47-match

Conversation

@shadyvb

@shadyvb shadyvb commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes XWPENG-47.

Part of the XWPENG-47 Rector modernization stack. This PR targets ticket/XWPENG-47-constructor-promotion and converts the two remaining eligible switch statements in the Rector scan paths to PHP 8.0 match expressions. Behavior is unchanged; the refactor uses expression-style branching that is easier to read and aligns with the PHP 8.2 baseline.

Summary

  • Ability_Get_Alerts::execute() β€” maps the status input (enabled, disabled, or default/any) to the alert status filter array via match.
  • List_Table::get_column_excluded_setting_key() β€” maps list-table column slugs to their exclusion-setting keys via match.
  • rector.php β€” registers ChangeSwitchToMatchRector so composer lint-rector reflects the transformations present in this branch.

No new PHPUnit coverage is required: both methods preserve identical return values for every branch.

Checklist

  • Project documentation has been updated to reflect the changes in this pull request, if applicable.
  • I have tested the changes in the local development environment (see contributing.md).
  • I have added phpunit tests.

Release Changelog

  • Fix: N/A β€” no user-facing bug fix in this stacked refactor.
  • New: N/A β€” no new feature in this stacked refactor.

Release Checklist

  • This pull request is to the master branch.
  • Release version follows semantic versioning. Does it include breaking changes?
  • Update changelog in readme.txt.
  • Bump version in stream.php.
  • Bump Stable tag in readme.txt.
  • Bump version in classes/class-plugin.php.
  • Draft a release on GitHub.

@shadyvb
shadyvb marked this pull request as ready for review September 2, 2026 10:11
@shadyvb
shadyvb force-pushed the ticket/XWPENG-47-match branch from 0ef4091 to 04b2313 Compare September 2, 2026 10:12
Rector plus hand review in class-alerts.php and class-connectors.php.
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.

1 participant