Apply typed properties in classes/ via Rector. - #1982
Open
shadyvb wants to merge 2 commits into
Open
Conversation
shadyvb
marked this pull request as ready for review
September 2, 2026 09:56
Register TypedPropertyFromAssignsRector with extension-point base skips; hand-correct Plugin service holders and Connectors_Unit_Test Admin mock fidelity.
shadyvb
force-pushed
the
ticket/XWPENG-47-typed-props-classes
branch
from
September 2, 2026 10:12
e3fc25d to
47ed6f8
Compare
… contract (XWPENG-47). Guard the three wp_stream_settings_* filter boundaries in Settings so a misbehaving callback can never feed null or a non-array into properties that the typed-property Rector runs assign to directly: - get_option_key(): fall back to the computed key when the wp_stream_settings_option_key filter returns a non-string. - get_options(): fall back to the unfiltered options array when the wp_stream_settings_options filter returns a non-array. - get_fields(): keep the unfiltered fields when the wp_stream_settings_option_fields filter returns a non-array. These props are untyped today only because Rector skipped them due to the mixed filter assignments; any consumer with typed properties (or a future TypedPropertyFromAssigns run) would otherwise throw a TypeError on every request, since Settings is constructed on init. Also declare the DB_Driver::setup_storage() return type (Install) on the interface and the WPDB implementation. Plugin::$install is nullable-typed in this stack, so a custom wp_stream_db_driver driver returning anything else previously failed with a cryptic runtime TypeError; it now fails at class-load time inside the offending driver. Note: the setup_storage signature is technically breaking for third-party drivers that omit the return type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #000.
Describe your approach and how it fixes the issue.
Checklist
contributing.md).Release Changelog
Release Checklist
masterbranch.readme.txt.stream.php.Stable taginreadme.txt.classes/class-plugin.php.Change
[ ]to[x]to mark the items as done.