It's different. The first declaration use implicit nullable :
public function testSomething(int $id = null) {} // Only default value set to null
Note that this type of declaration is deprecated since PHP 8.4
You should instead use explicitly nullable which can be written in two ways:
public function testSomething(?int $id = null) {} // With the '?' marker
or
public function testSomething(int|null $id = null) {} // With the '|null' union type
About those these two in PHP 8.4: Implicitly nullable parameter declarations deprecated:
Both type declarations are effectively equivalent, even at the Reflection API. The second example is more verbose, and only works on PHP 8.0 and later.
testSomething(?int $id) {}
without arguments - will probably throw a fatal error, whereas you can invoke the first casetestSomething(int $id = null) {}
without arguments. – Wrasse