Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35569 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13474 invoked by uid 1010); 18 Feb 2008 23:22:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13459 invoked from network); 18 Feb 2008 23:22:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2008 23:22:23 -0000 Authentication-Results: pb1.pair.com header.from=clynx@succont.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=clynx@succont.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain succont.de designates 85.214.57.33 as permitted sender) X-PHP-List-Original-Sender: clynx@succont.de X-Host-Fingerprint: 85.214.57.33 ptah.occuris.de Received: from [85.214.57.33] ([85.214.57.33:59186] helo=ptah.occuris.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/F3-23568-C231AB74 for ; Mon, 18 Feb 2008 18:22:21 -0500 Received: from [10.0.1.100] (xdsl-87-78-250-72.netcologne.de [87.78.250.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ptah.occuris.de (Postfix) with ESMTP id 13D262818D1 for ; Tue, 19 Feb 2008 00:22:17 +0100 (CET) Message-ID: To: internals@lists.php.net Content-Type: multipart/signed; boundary=Apple-Mail-1--416046924; micalg=sha1; protocol="application/pkcs7-signature" Mime-Version: 1.0 (Apple Message framework v919.2) Date: Tue, 19 Feb 2008 00:22:13 +0100 X-Mailer: Apple Mail (2.919.2) Subject: [RFC] Annotations From: clynx@succont.de (clynx) --Apple-Mail-1--416046924 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Hey everyone, I have thought about a new feature for some days now. The initial plan was to create a new keyword "deprecated" which should simply trigger a warning when the right error level was set. This could have been combined with the E_DEPRECATED level from 5.3 (maybe, otherwise E_STRICT). The goal was to have a possibility for PHP projects to mark some functions, classes or methods as no longer recommend to use. The first step would be to set this new keyword, and after some releases the developers could remove this item. Just as it is handled in PHP itself. I know that there is a phpDoc property for this, but when you execute your code you'll never realize that. I've talked to some colleagues about this feature and I was told that e.g. Java has annotations for that. I've tried to get familiar with this concept, and came to the following idea: PHP would need a new syntax feature to specify them: @deprecated public static function test( $params ) {} With a new function, set_annotation_handler( name, callback ) developers could register there own handler for every type of needed annotation. I would recommended to register a default handler for "deprecated", which should trigger just a simple warning. The first parameter of the callback should contain an array which looks similar to the one from debug_backtrace. As an addition it should report which function/method/class contained this annotation. Parameters should be also possible, like they are in Java. It would allow e.g. @deprecated('2.34') public static function test( $params ) {} and the callback would receive the specified parameters as additional parameters: function my_ deprecated_handler( $annotation, $version ) { trigger_error( 'Will be removed in version ' . $version ); } I'm sorry, but I think this patch is a far above my possibilities for developing a patch on my own. Maybe someone else likes the idea, and has some time to implement it. PHP 5.3 would be really nice ;o) Thanks for reading, feel free to give me any type of comments Best Regards Tobias --Apple-Mail-1--416046924 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIErjCCBKow ggKSoAMCAQICAwRjkTANBgkqhkiG9w0BAQUFADB5MRAwDgYDVQQKEwdSb290IENBMR4wHAYDVQQL ExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNBIENlcnQgU2lnbmluZyBBdXRob3Jp dHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRAY2FjZXJ0Lm9yZzAeFw0wNzEyMDgyMDAyMTFaFw0w ODA2MDUyMDAyMTFaMDsxGDAWBgNVBAMTD0NBY2VydCBXb1QgVXNlcjEfMB0GCSqGSIb3DQEJARYQ Y2x5bnhAc3VjY29udC5kZTCBnzANBgkqhkiG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