What are possibilities to implement helper that will raise error log with level E_DEPRECATED (E_USER_DEPRECATED in fact) when class method with annotation @deprecated is called?
For example for the code
/**
* @deprecated
*/
public function main()
{}
when calling the method $obj->main() the deprecated warning would be raised.
And yes, I know I could add a warning using code line trigger_error().
In short: Put
trigger_error()at the beginning of the method.Long: You need to reflect the class, retrieve the DocComment, parse it and extract the
@deprecated-tag. The problem is, that you must do this on every method call, and even if it there exists an easy way to catch every call, it would be a huge overhead.