changes for PHP 8.4
Deprecated: Functional\some(): Implicitly marking parameter $callback as nullable is deprecated, the explicit nullable type must be used instead in /Users/egorgorskov/php-project-48/vendor/lstrojny/functional-php/src/Functional/Some.php on line 25
The deprecation warning we are encountering, “Implicitly marking parameter $callback as nullable is deprecated,” is a result of changes introduced in PHP 8.4, which explicitly requires developers to declare nullable types instead of relying on implicit nullability. This change affects any function or method that previously allowed a parameter to default to null without explicitly defining it as nullable.
Solution:
function example(?callable $callback = null) {
// function
}
or for PHP 8.@
function example(callable|null $callback = null) {
// function
}
Would it be worth taking this opportunity to use the Closure class instead of callable?