Skip to content

Use explicit nullable types in ArgvParser::consume() - #362

Merged
kamil-tekiela merged 1 commit into
php:masterfrom
RaphaelFakhri:fix-argvparser-implicit-nullable
Nov 3, 2026
Merged

kamil-tekiela merged 1 commit into
php:masterfrom
RaphaelFakhri:fix-argvparser-implicit-nullable

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

On PHP 8.4 and later, every script that loads scripts/translation/libqa/ (the qaxml-*.php checks, check-structure.php, check-en-revision.php) prints two deprecation notices before its own output:

Deprecated: ArgvParser::consume(): Implicitly marking parameter $equals as nullable is deprecated, the explicit nullable type must be used instead in .../scripts/translation/libqa/ArgvParser.php on line 42

Deprecated: ArgvParser::consume(): Implicitly marking parameter $prefix as nullable is deprecated, the explicit nullable type must be used instead in .../scripts/translation/libqa/ArgvParser.php on line 42

The notices go to standard output, so they also mix into --github annotation output.

This change declares $equals and $prefix as ?string. Behavior is unchanged, and ?string works on every PHP version these scripts already require.

Testing

On PHP 8.5.12:

  • php -d error_reporting=-1 -l scripts/translation/libqa/ArgvParser.php: 2 deprecations before, 0 after.
  • php scripts/translation/check-structure.php --help: 2 Deprecated: lines on stdout before, 0 after. Exit code stays 0.
  • php -l on all files under scripts/translation/ reports no other notices.

@RaphaelFakhri
RaphaelFakhri requested a review from alfsb as a code owner November 3, 2026 17:36
@kamil-tekiela
kamil-tekiela merged commit 66cb673 into php:master Nov 3, 2026
12 checks passed
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.

2 participants