Skip to content

Fix PHP 8.4 implicit nullable parameter deprecations#891

Merged
JeroenDeDauw merged 1 commit into
masterfrom
fix/php-8.4-implicit-nullable-deprecations
May 1, 2026
Merged

Fix PHP 8.4 implicit nullable parameter deprecations#891
JeroenDeDauw merged 1 commit into
masterfrom
fix/php-8.4-implicit-nullable-deprecations

Conversation

@JeroenDeDauw
Copy link
Copy Markdown
Member

Fixes #890

PHP 8.4 deprecates implicitly marking a parameter as nullable by giving it a default value of null without an explicit nullable type. Add the explicit ? prefix to the affected parameters:

  • MapsDistanceParser::parseAndFormat
  • MapsDistanceParser::formatDistance
  • MapsDistanceParser::getUnitRatio
  • MapsDistanceParser::getValidUnit (same pattern, not in the issue's stack trace but would warn under different code paths)
  • CoordinateValue::getFormattedCoord
  • DisplayMapRenderer::__construct
  • AreaDescription::__construct

The deprecation warnings emitted by mediawiki/parser-hooks (ParserHooks\FunctionRunner, ParserHooks\Internal\Runner, ParserHooks\HookRunner) originate from that library and need to be fixed in https://github.com/JeroenDeDauw/ParserHooks.

Test plan

  • PHPUnit suite (247 tests) passes locally on PHP 8.3
  • CI green

🤖 Generated with Claude Code

Fixes #890

PHP 8.4 deprecates implicitly marking a parameter as nullable by giving it
a default value of null without an explicit nullable type. Add the explicit
`?` prefix to the affected parameters.

Note: The deprecation warnings emitted by `mediawiki/parser-hooks` (e.g.
ParserHooks\FunctionRunner, ParserHooks\Internal\Runner, ParserHooks\HookRunner)
originate from that library and need to be fixed there.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@JeroenDeDauw JeroenDeDauw marked this pull request as ready for review May 1, 2026 00:00
@JeroenDeDauw JeroenDeDauw merged commit c98e74e into master May 1, 2026
6 checks passed
@JeroenDeDauw JeroenDeDauw deleted the fix/php-8.4-implicit-nullable-deprecations branch May 1, 2026 00:00
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.

PHP 8.4 deprecation warnings

1 participant