php/php-src — pull request #244 by pp3345 (2012-12-23 13:58:39+00:00)
Title: Add deprecated userspace functions

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.