Hi Sean,

Sean DuBois wrote:

I am starting this discussion to get peoples opinion on the overall feature, 
and find someone
who would be interested in watching over my progress and making sure I
do the right things to hopefully get this merged.

The PHP bug tracker contains a few simple entries for a adding visibility 
modifiers to class constants.
https://bugs.php.net/bug.php?id=27022

I would be the one implementing this, and have a basic working version already 
(that
takes shortcuts like reusing property_info) but it works!
https://github.com/Sean-Der/php-src/compare/master...bug-69980-class-constants#diff-6231c13c8582758f41a5e2a015e3b5c5R1
There are cases where runtime/compile time checks pass/fail incorrectly,
but working on that now.

This change would involve breaking the API, but wouldn't involved any
language breaking changes. All current const declarations would just
default to public and keep the same behavior.

Funny you should propose this now, I was wanting this feature just the other day. This would be a useful addition, and clean up a strange inconsistency: why can methods and properties have visibility modifiers, but not constants?

I'd love to see this in PHP. Are you going to write an RFC?

Thanks!
--
Andrea Faulds
http://ajf.me/

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

Reply via email to