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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to