Skip to content

MIR1013

ImplicitlyNullableParameter

int $a = null accepts null although its type does not say so. PHP 8.4 deprecates this; the type must spell out null (?int, int|null). A promoted constructor parameter written this way is a compile error on every version (Cannot use null as default value for parameter $a of type int).

<?php
function find(string $id = null): void {}

Write the type as nullable: ?string $id = null.