RFC [Concept] - Interface Properties
| From: | Nick Humphries | Date: | Sat, 27 May 2023 06:39:53 +0000 |
| Subject: | RFC [Concept] - Interface Properties | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-120403@lists.php.net to get a copy of this message | ||
Hello internals,
Based on a few discussions I've had recently, my team and I couldn't think of any reason
why we shouldn't have properties on interfaces as it is common for these to be specified in doc
blocks currently. Timing-wise, this lines up well with dynamic properties being depreciated.
I've thrown together a very quick POC, there are many tests and examples of how this could
look.
https://github.com/php/php-src/compare/master...Humni:php-src:feature/rfc-interface-properties
Some of the key architectural decisions:
- interfaces can implement the same property (exact type match only)
- interface properties must be public
- interface properties can't be static
- interface properties can be readonly
Open to feedback from everyone on this - keen to get the ball rolling quickly on it!
Kind Regards,
Nick