Skip to content

Apply constructor property promotion via Rector. - #1985

Open
shadyvb wants to merge 1 commit into
ticket/XWPENG-47-typed-props-alertsfrom
ticket/XWPENG-47-constructor-promotion
Open

Apply constructor property promotion via Rector.#1985
shadyvb wants to merge 1 commit into
ticket/XWPENG-47-typed-props-alertsfrom
ticket/XWPENG-47-constructor-promotion

Conversation

@shadyvb

@shadyvb shadyvb commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

XWPENG-47 (sub-PR 4 of the typed-properties stack; base: ticket/XWPENG-47-typed-props-alerts).

Applies PHP 8 constructor property promotion to seventeen core service classes via Rector's ClassPropertyAssignToConstructorPromotionRector. Each class that previously declared a property and assigned it in __construct() now promotes the parameter directly — for example public function __construct( public Plugin $plugin ) — removing redundant property declarations and $this->prop = $prop boilerplate.

Classes updated: Abilities, Ability (protected), Admin, Alert, Alerts, Alerts_List, Alert_Trigger, Alert_Type, Connectors, DB, Export, Install, List_Table, Live_Update, Log, Network, Settings.

rector.php registers the promotion rule with RENAME_PROPERTY => false so existing property names are preserved.

No runtime behavior changes — this is a readability and modernization refactor only.

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 — internal refactor, no user-facing change.
  • New: N/A.

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.

Change [ ] to [x] to mark the items as done.

@shadyvb
shadyvb marked this pull request as ready for review September 2, 2026 10:11
@shadyvb
shadyvb force-pushed the ticket/XWPENG-47-constructor-promotion branch from 8a6a41e to 0c0bb6a Compare September 2, 2026 10:12
Seventeen constructors across connectors, alerts, and exporters; hand-correct
Connectors_Unit_Test Admin mock fidelity.
@shadyvb
shadyvb force-pushed the ticket/XWPENG-47-constructor-promotion branch from 0c0bb6a to 77ce1e0 Compare September 2, 2026 14:30
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