Skip to content

Explicitly mark parameter as nullable to address PHP deprecation warning#262

Merged
wvega-godaddy merged 1 commit into
trunkfrom
fix-php-deprecated-notices-nullable
Dec 2, 2025
Merged

Explicitly mark parameter as nullable to address PHP deprecation warning#262
wvega-godaddy merged 1 commit into
trunkfrom
fix-php-deprecated-notices-nullable

Conversation

@agibson-godaddy

@agibson-godaddy agibson-godaddy commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

Summary

This marks a parameter explicitly as being nullable, to address this deprecation warning:

PHP Deprecated:  WP_Mock\Tools\TestCase::run(): Implicitly marking parameter $result as nullable is deprecated, the explicit nullable type must be used instead in /vendor/10up/wp_mock/php/WP_Mock/Tools/TestCase.php on line 113

Closes: #261

Details

Contributor checklist

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly (n/a)
  • I have added tests to cover changes introduced by this pull request (n/a)
  • All new and existing tests pass

Testing

Reviewer checklist

  • Code changes review
  • Documentation changes review
  • Unit tests pass
  • Static analysis passes

@agibson-godaddy
agibson-godaddy marked this pull request as ready for review December 2, 2025 15:57

Copilot AI left a comment

Copy link
Copy Markdown

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 addresses a PHP deprecation warning by explicitly marking a parameter as nullable using the ? syntax instead of relying on implicit nullability through the default value.

  • Updated the run() method signature in TestCase.php to use explicit nullable type syntax (?TestResult)
  • Added changelog entry documenting the deprecation fix

Reviewed changes

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

File Description
php/WP_Mock/Tools/TestCase.php Changed parameter type from TestResult $result = null to ?TestResult $result = null to explicitly mark as nullable
CHANGELOG.md Added version 1.1.1 entry documenting the fix for PHP deprecation warnings

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

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 66.01% (-0.1%) from 66.142%
when pulling 38d3e19 on fix-php-deprecated-notices-nullable
into 8d6c23d on trunk.

@wvega-godaddy wvega-godaddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@wvega-godaddy
wvega-godaddy merged commit 79dea7f into trunk Dec 2, 2025
9 of 10 checks passed
@wvega-godaddy
wvega-godaddy deleted the fix-php-deprecated-notices-nullable branch December 2, 2025 19:33
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.

Update WP_Mock TestCase to Fix PHP Deprecated Notice

4 participants