Skip to content

changes for PHP 8.4#255

Closed
Egorskov wants to merge 1 commit intolstrojny:mainfrom
Egorskov:request
Closed

changes for PHP 8.4#255
Egorskov wants to merge 1 commit intolstrojny:mainfrom
Egorskov:request

Conversation

@Egorskov
Copy link
Copy Markdown

@Egorskov Egorskov commented Dec 8, 2024

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
} 

@rrigby
Copy link
Copy Markdown

rrigby commented Feb 9, 2025

Would it be worth taking this opportunity to use the Closure class instead of callable?

@phanan
Copy link
Copy Markdown
Collaborator

phanan commented Mar 21, 2026

1.8 has been released with support for PHP 8.4.

@phanan phanan closed this Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants