-
Notifications
You must be signed in to change notification settings - Fork 813
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I have commit rights to the repo so I just need guidance where should I document two closures made from the same callable are equal but not identical:
$x = new class {
function test() {}
};
$a = [$x, 'test'];
$b = Closure::fromCallable($a);
$c = Closure::fromCallable($a);
var_dump($b == $c); // TRUE
var_dump($b === $c); // FALSE
This is used in Symfony eventdispatcher: if ($v === $listener || ($listener instanceof \Closure && $v == $listener)) {
I guess because this makes removeListener($foo(..))
work
I really have no idea where is it best to document this. https://www.php.net/manual/en/language.oop5.object-comparison.php ? Closure::fromCallable ? first class functions?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request