Fix SplHeap::compare arginfo and tests#3686
Conversation
There was a problem hiding this comment.
(Stupid question): what does - do here?
There was a problem hiding this comment.
The - prefix negates the return value, so if the right operand returns 8, then this will return -8
There was a problem hiding this comment.
This is a BC, isn't? 😕
There was a problem hiding this comment.
BC breaks go to PHP 8 or is it something that PHP 7.4 can handle as well?
|
The main thing I'd be concerned about is that a user implements compare with |
7fb8492 to
a4c5ede
Compare
|
This can be merged against |
|
I'm not certain that Nikita's concern has been or is going to be addressed ? What do you think about this now @nikic ? |
|
I'm conflicted here. On the one hand, this change is going to make ergonomics worse, because people will no longer be able to typehint their compare() methods. On the other hand, the way this is currently achieved is through a dirty engine hack that probably shouldn't exist in the first place. Overall I think we should merge this for PHP 8. Not a lot of people override this method and the current behavior is inconsistent with how PHP usually works. We may also make availability of arginfo a hard requirement in future, in which case this would no longer work anyway. |
|
Merged as 780bdcd into master. |
No description provided.