The problem
In PHP 8.4, implicit nullable types will be deprecated. This is an example of what would be considered deprecated in PHP 8.4:
public function edit(object $item = null) {}
Instead, that would now need an explicit nullable type:
public function edit(?object $item = null) {}
Fixing this with RegEx
This requires a lot of code to update. Luckily, God gave us the magical gift of RegEx. Here is an expression that modifies your functions automagically:
/function\s+(\w+)\s*\(([^)]*?)\b(\w+)\s+\$(\w+)\s+=\s+null([^)]*)\)/gm
And here’s the substitution:
function $1($2?$3 $$4 = null$5)