PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net


 

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.txt · Last modified: 2008/07/21 09:46 by lstrojny
 
Atom | show source | credits | stats | sitemap | contact | advertising | mirror sites