PHP 8.4 deprecates typed parameters that default to null without declaring that null is allowed. Make the type explicitly nullable; do not hide the warning as the primary fix.
Last updated: October 17, 2026.
<?php
// Deprecated in PHP 8.4:
// function formatLabel(string $label = null): string
function formatLabel(?string $label = null): string
{
return $label ?? 'Untitled';
}The union form string|null is equivalent. Keep the default only when callers are supposed to omit the argument.
Find whether the warning belongs to your code
The PHP 8.4 release notes list implicitly nullable parameter types among the deprecations. The implemented PHP language RFC explains the compatibility rule. The change affects declarations such as Type $value = null; replace them with ?Type $value = null or Type|null $value = null. Review inheritance and interface signatures together so implementations remain compatible.
If the path points into vendor/, update the package and its lock file with Composer instead of editing installed dependency files. Check the package’s supported PHP versions and release notes. A warning from an old phpMyAdmin or library build usually means that build predates PHP 8.4 support.
Keep diagnostics useful without exposing them
Run the application’s tests and static analysis under PHP 8.4 before changing production. Search the maintained source tree for typed parameters with a null default, but review matches manually because multiline declarations and generated code complicate simple regular expressions.
Check optional and required parameter order while editing a signature. Making nullability explicit preserves the old runtime behavior, but removing the default makes an argument required and can break callers. For public library APIs, update interface declarations, implementations, mocks, and documentation in the same release.
Production pages should not print deprecation warnings, filesystem paths, or stack traces to visitors. Keep display_errors off and send errors to protected logs while the code is being corrected. Do not remove E_DEPRECATED from development and CI merely to make the output quiet. After dependencies are updated, clear opcode and application caches so old files are not still executing.
Continue with PHP null array-offset warnings, PHP parameter and return types, and maintainable PHP development.