Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95357 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25863 invoked from network); 21 Aug 2016 20:57:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2016 20:57:36 -0000 Authentication-Results: pb1.pair.com header.from=dev@mabe.berlin; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dev@mabe.berlin; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: dev@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:45642] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/B8-50790-DB51AB75 for ; Sun, 21 Aug 2016 16:57:35 -0400 Received: from dslb-188-102-038-093.188.102.pools.vodafone-ip.de ([188.102.38.93] helo=[192.168.178.53]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1bbZoA-000554-No; Sun, 21 Aug 2016 22:57:30 +0200 To: internals Message-ID: <5be47f08-bbb5-f1ab-aeb0-e7d92a93b97c@mabe.berlin> Date: Sun, 21 Aug 2016 22:57:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;dev@mabe.berlin;1471813055;57a3408e; Subject: Class Constant Visibility BC Break From: dev@mabe.berlin (Marc Bennewitz) Hi, I encountered a problem of my library with the new class constant visibility functionality. The problem is that I'm using ReflectionClass::getConstants() to detect class constants but I'm only interested in public constants. Before class constants were public by definition but now it can be private and protected, too. I know the new methods ReflectionClass::getReflectionConstant[s]() are available to detect exactly what I need and that's fine! But of course using ReflectionClass::getConstants() no longer returns public class constants by default. So for me this is a BC break but it wasn't listed in the RFC. I don't know if it was discussed before but it could be avoided by adding an argument to ReflectionClass::getConstants() to filter by visibility which defaults to public. Thoughts? PS: I'm talking my library to emulate enumerations https://github.com/marc-mabe/php-enum/blob/master/src/Enum.php#L295-L327 but this BC break happens to all using ReflectionClass::getConstants() for public constants only e.g. accessing values later with constant(). Cheers Marc