Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77131 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1750 invoked from network); 10 Sep 2014 07:14:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2014 07:14:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.50 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.220.50 mail-pa0-f50.google.com Received: from [209.85.220.50] ([209.85.220.50:34487] helo=mail-pa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/81-24203-14AFF045 for ; Wed, 10 Sep 2014 03:14:10 -0400 Received: by mail-pa0-f50.google.com with SMTP id bj1so5228004pad.37 for ; Wed, 10 Sep 2014 00:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=C5F9QTxl4NySc8ol/SXQJSJ1CeKRoqj/3mxssDnlgrU=; b=G2Ne1fX/4ab8smekcmHGTb0pB83WFJm8WGnhyxsT4O2JWXThUHBStuhEHQYUXxIPmF tFeq7RmNCzqQ9Eb3Ncv11HF2qMJcK/GfnaISYMaaXZ/+YG6dLVXbLVp+qHX39mrHFiHd B29xT1HSDey7zWDSwrN6jnOwNF7zbtnCdxsip1FEIvKAkDlBjMtByESy7z3P6M1AHtKs K6QHeePw3Z2UvZMGOCQAabn+tYIRwx5Ji2WTR8K/jDFWy9NXKKPfd20qhRJYAexFNG3m 8m+fcuWQrh8YMfzxwQvXy8Y43ZZbw+lpJu+amorAqCq+0T8GSeZRKiI0pBL8ovkP3aRq 9IlA== X-Received: by 10.66.102.7 with SMTP id fk7mr62496503pab.127.1410333246286; Wed, 10 Sep 2014 00:14:06 -0700 (PDT) Received: from [192.168.1.102] (bb121-7-198-24.singnet.com.sg. [121.7.198.24]) by mx.google.com with ESMTPSA id o2sm13669723pde.30.2014.09.10.00.14.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Sep 2014 00:14:05 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Wed, 10 Sep 2014 15:14:01 +0800 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <7CFC622E-E0FF-40F6-8EA4-CCC4C20608A7@gmail.com> References: To: Alexander Lisachenko X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] Deprecated functions From: tjerk.meesters@gmail.com (Tjerk Meesters) Hi Alex, On 10 Sep 2014, at 13:59, Alexander Lisachenko = wrote: > Hi! >=20 > Maybe it will be better to do this in another way: introduce an RFC to > add 'deprecated' keyword into the syntax like 'final' or 'protected'. > There are many frameworks that want to deprecate some methods or > classes. Currently it's only possible via "@deprecated" tag in the > phpDoc-block, but this tag doesn't influence on method invocation, so > no warnings are generated. Any decent IDE should tell you that a function is deprecated by = observing DocBlock; I believe PhpStorm uses strike-through to indicate = deprecated functionality. >=20 > Symfony uses trigger_error($message, E_USER_DEPRECATED) explicitly in > deprecated methods to trigger this warning (see > https://github.com/symfony/symfony/pull/6180), but this is not a > transparent solution. I agree that having a =91deprecated=92 keyword would simplify matters, = but I don=92t think that alone is worth making it a language feature. This could be a good case for annotations, though, if we ever get such a = thing :) >=20 > This can be look like this: >=20 > class Test { > deprecated protected $someProperty; >=20 > deprecated public function foo() {} > public function bar() {} > } >=20 >=20 > deprecated class OldStuff {} >=20 > deprecated function someOldFunction() {} >=20 > This RFC will give more control over 'deprecated' functionality and > can be easily tested. >=20 > Thoughts? >=20 > 2014-09-10 9:42 GMT+04:00 Tjerk Meesters : >> Hi, >>=20 >> When I was fixing test cases on my `kill-ereg` branch I noticed a = Reflection test case for `ReflectionFunction::isDeprecated()`. >>=20 >> The problem with such a test case is that you=92d be chasing = deprecated functions to tests against as we move along; this is the = current list of deprecated functions as taken from a typical 5.4 = installation: >>=20 >> Since 4.1.0: call_user_method, call_user_method_array >> Since 4.3.7: mysql_list_tables, mysql_listtables >> Since 5.3 : ereg, ereg_replace, eregi, eregi_replace, split, spliti, = sql_regcase, mysql_db_query, magic_quotes_runtime, = set_magic_quotes_runtime, set_socket_blocking >> Since 5.4 : mysql_list_dbs >>=20 >> The above are, as far as I=92m concerned, all potential candidates = for removal in PHP 7, so in order to reliably test a deprecated function = I would suggest introducing a hidden function with this signature: >>=20 >> void __deprecated__() { } >>=20 >> And mark that function as eternally deprecated using the = ZEND_ACC_DEPRECATED flag. >>=20 >> Thoughts?