Skip to content

Conversation

@justlevine
Copy link
Contributor

@justlevine justlevine commented Nov 7, 2025

What?

This PR

  1. Adds declare( strict_types=1 ); to plugin files
  2. Inlines property types
  3. Marks Feature_Loader and Feature_Registry final
  4. Updates the Example_Feature to use {@inheritDoc}

Why?

Stricter/native types improve DX by erroring early, saving unnecessary code review and reducing the likelihood of shipping bugs into a release.

How?

See copilot summary.

Testing Instructions

  1. See the lints and tests passing.

Testing Instructions for Keyboard

N/a

Screenshots or screencast

Before After

Test using WordPress Playground

The changes in this pull request can be previewed and tested using this WordPress Playground instance:

Click here to test this pull request.

@justlevine justlevine requested a review from Copilot November 7, 2025 23:42
@github-actions
Copy link

github-actions bot commented Nov 7, 2025

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: justlevine <justlevine@git.wordpress.org>
Co-authored-by: dkotter <dkotter@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

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 modernizes the codebase by adding PHP strict type declarations and type hints across all core files, improving type safety and code quality.

Key Changes:

  • Added declare(strict_types=1) to all PHP files for strict type checking
  • Added type declarations to all class properties (string, bool, array, and fully-qualified class types)
  • Marked Feature_Registry and Feature_Loader classes as final to prevent inheritance
  • Replaced verbose docblock descriptions with {@inheritDoc} tags in Example_Feature for inherited methods

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
includes/bootstrap.php Added strict types declaration
includes/Features/Example_Feature/Example_Feature.php Added strict types declaration and updated docblocks to use {@inheritdoc} for inherited methods
includes/Feature_Registry.php Added strict types declaration, marked class as final, and added array type to $features property
includes/Feature_Loader.php Added strict types declaration, marked class as final, and added type declarations to $registry and $initialized properties
includes/Exception/Invalid_Feature_Metadata_Exception.php Added strict types declaration
includes/Exception/Invalid_Feature_Exception.php Added strict types declaration
includes/Contracts/Feature.php Added strict types declaration
includes/Abstracts/Abstract_Feature.php Added strict types declaration and type declarations to all properties ($id, $label, $description, $enabled)

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

@dkotter dkotter merged commit b55e634 into trunk Nov 10, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from Needs review to Done in WordPress AI Planning & Roadmap Nov 10, 2025
@dkotter dkotter deleted the dev/strict-types branch November 10, 2025 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants