(PHP 7, PHP 8)
ReflectionType::allowsNull — Vérifie si null est permit
   Vérifie si le paramètre accepte null.
  
Cette fonction ne contient aucun paramètre.
   true si null est permit, sinon false
  
Exemple #1 Exemple avec ReflectionType::allowsNull()
<?php
function someFunction(string $param, stdClass $param2 = null) {}
$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParams = $reflectionFunc->getParameters();
var_dump($reflectionParams[0]->getType()->allowsNull());
var_dump($reflectionParams[1]->getType()->allowsNull());
L'exemple ci-dessus va afficher :
bool(false) bool(true)