rfc:e-user-deprecated-warning

This is an old revision of the document!


Request for Comments: E_USER_DEPRECATED

Introduction

In 5.3 we introduced E_DEPRECATED to mark internal functions/classes/syntax elements as deprecated with a separate error level. The same deprecation process applies for user level code. That's why we should introduce E_USER_DEPRECATED similar to the already present user space levels E_USER_WARNING, E_USER_NOTICE and E_USER_ERROR.

Proposal and Patch

Use cases

UC 1: Deprecation warning in a constructor

<?php
class Foo
{
    public function __construct()
    {
        trigger_error('Use Bar instead', E_USER_DEPRECATED);
    }
}

UC 2: Deprecation warning at function call

<?php
function do_something()
{
    trigger_error('Use do_something_else() instead', E_USER_DEPRECATED);
}

UC 3: Deprecation warning when a file is included

<?php
// MY_FUNKY_LIBRARY
trigger_error('Use non-funky library', E_USER_DEPRECATED);
 
...
rfc/e-user-deprecated-warning.1302087566.txt.gz · Last modified: 2013/10/29 18:30 (external edit)