After the prior discussion about the same topic:
https://externals.io/message/117342, I have created an RFC to expand the
scope of the deprecation notices being thrown for the deprecated
partially supported callables to include is_callable()
and the callable
type in PHP 8.2.
With this email I'm opening the two week discussion period for this RFC.
All points raised in the prior discussion are already included in the RFC.
https://wiki.php.net/rfc/partially-supported-callables-expand-deprecation-notices
I look forward to your feedback.
Smile,
Juliette
After the prior discussion about the same topic:
https://externals.io/message/117342, I have created an RFC to expand the
scope of the deprecation notices being thrown for the deprecated
partially supported callables to includeis_callable()
and the callable
type in PHP 8.2.With this email I'm opening the two week discussion period for this RFC.
All points raised in the prior discussion are already included in the RFC.https://wiki.php.net/rfc/partially-supported-callables-expand-deprecation-notices
I look forward to your feedback.
Smile,
Juliette
I didn't follow the earlier discussion in much detail, but the is_callable()
deprecation seems fine to me.
For the callable
type declaration, I'm not opposed but is it redundant with the existing deprecation? When would you pass a callable to something and not end up calling it anyway, which would trigger the existing deprecation? (Meaning in practice you'd always get 2 deprecations, which are not necessarily better than one.)
--Larry Garfield
Le 12 mai 2022 à 23:11, Larry Garfield larry@garfieldtech.com a écrit :
For the
callable
type declaration, I'm not opposed but is it redundant with the existing deprecation? When would you pass a callable to something and not end up calling it anyway, which would trigger the existing deprecation? (Meaning in practice you'd always get 2 deprecations, which are not necessarily better than one.)
Although such a callable is probably intended to be called at some point, it is not necessarily called immediately, and it may be easier to track the source of it when you trigger the deprecation earlier. Example:
public function registerErrorHandler(callable $onerror) {
$this->onError[] = $onerror;
}
(Of course, this argument also holds for is_callable()
.)
—Claude
Le 12 mai 2022 à 23:11, Larry Garfield larry@garfieldtech.com a écrit :
For the
callable
type declaration, I'm not opposed but is it redundant with the existing deprecation? When would you pass a callable to something and not end up calling it anyway, which would trigger the existing deprecation? (Meaning in practice you'd always get 2 deprecations, which are not necessarily better than one.)
Although such a callable is probably intended to be called at some point, it is not necessarily called immediately, and it may be easier to track the source of it when you trigger the deprecation earlier. Example:public function registerErrorHandler(callable $onerror) { $this->onError[] = $onerror; }
(Of course, this argument also holds for
is_callable()
.)—Claude
Exactly as Claude says and to quote the RFC:
While it will be common to use the partially supported callable in a
callback function call within the function with the type declaration,
this may not always be the case, especially in frameworks where
callbacks can be registered to be executed later in a limited set of
circumstances and those circumstances may not be met by default.
Without a deprecation notice, those “/limited circumstances
callbacks/” may not be discovered as needing updating in time for PHP 9.0.
Smile,
Juliette