PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I ran into a situation, where adding some const definitions to an interface would come in handy. I also tested it, and PHP doesn't complain. But doing so is rather unusual, and actually wrong.
However, I couldn't find a statement about this issue in the PHP manual.
So my question is: should I add consts to an interface, or could my interface break in a future release of PHP?
It's always possible that the people behind the core could remove currently available language features, but any one feature being removed is rather unlikely. If you can't find any bug reports suggesting its removal, you should be fine for a fair bit of time.
feyd wrote:It's always possible that the people behind the core could remove currently available language features, but any one feature being removed is rather unlikely. If you can't find any bug reports suggesting its removal, you should be fine for a fair bit of time.
Thanks for the pointer, I didn't think of the bugs database, yet. A search for "interface const" yielded following related bug ticket: http://bugs.php.net/bug.php?id=33732
The contained discussion suggests, that consts in an interface are an intentional feature