As of PHP 8.1, passing null to not explicitly nullable scalar parameters for PHP native functions is deprecated.
In this case, $class within applyWildcard() may be null, which leads to the following deprecation notice as can be seen when running the tests on PHP 8.1:
Deprecated: class_exists(): Passing null to parameter #1 ($class) of type string is deprecated in path/to/patchwork/src/CallRerouting.php on line 141
By handling null separately in the condition, the previous behaviour is maintained.
As of PHP 8.1, passing
null
to not explicitly nullable scalar parameters for PHP native functions is deprecated.In this case,
$class
withinapplyWildcard()
may be null, which leads to the following deprecation notice as can be seen when running the tests on PHP 8.1:By handling
null
separately in the condition, the previous behaviour is maintained.Refs: