Skip to content

fix: constructors must not return value#803

Merged
masteradhoc merged 1 commit intoWordPress:masterfrom
sjinks:fix/ctor
Feb 24, 2026
Merged

fix: constructors must not return value#803
masteradhoc merged 1 commit intoWordPress:masterfrom
sjinks:fix/ctor

Conversation

@sjinks
Copy link
Contributor

@sjinks sjinks commented Feb 21, 2026

What?

This pull request removes a redundant return $this; statement from the constructor. This aligns with PHP class construction practices.

Why?

In PHP, constructors are void and, therefore, must not return a value.

How?

Remove return $this;.

Testing Instructions

N/A - there are no functional changes.

Screenshots or screencast

N/A

Changelog Entry

Fixed - removed return statement from Two_Factor_Provider's constructor.

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sjinks <volodymyrkolesnykov@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Collaborator

@georgestephanis georgestephanis left a comment

Choose a reason for hiding this comment

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

Looks good. This was due to legacy behavior and how we were storing the instances in the static previously I believe, but didn't update with the newer version?

Either way, LGTM

@masteradhoc masteradhoc merged commit 1a37785 into WordPress:master Feb 24, 2026
30 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Two Factor project board Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants