[PR][php-src][#244][master] - Add deprecated userspace functions
| From: | noreply@php.net | Date: | Thu, 19 Feb 2015 17:50:20 +0000 |
| Subject: | [PR][php-src][#244][master] - Add deprecated userspace functions | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-2384@lists.php.net to get a copy of this message | ||
You can view the Pull Request on github:
https://github.com/php/php-src/pull/244
Warning: according to github, the Pull Request cannot be merged without manual conflict resolution!
Pull Request Description:
Since PHP 5.3.0 it is possible to mark functions and methods as deprecated by using the
ZEND_ACC_DEPRECATED flag. Calling a function that has this flag emits an E_DEPRECATED error telling
the user that this function is deprecated and its use should be avoided. However, it is not possible
to give this flag to a userspace function, you can only throw an error yourself. Since it is common
for large frameworks to deprecate old functions and remove them in later versions I believe that it
would be useful if there was a cleaner way of marking a function as deprecated by preceding the
function declaration with a "deprecated" modifier.
This patch adds such functionality. A new T_DEPRECATED ("deprecated") token is added and
the ZEND_ACC_DEPRECATED flag is given to every function entry declared using the T_DEPRECATED token.
It works both with normal functions and class methods. Giving the deprecated modifier to an object
property or declaring multiple deprecated modifiers for a single function will lead to a
E_COMPILE_ERROR. Tests are included.
It would be great if this patch would be accepted for PHP 5.5. In case I need to create a RFC or
something please tell me.