Per RFC: https://wiki.php.net/rfc/propertygetsetsyntax



Alright, getters/setters has been built.  This is my first patch to the php 
core.  Here is what has been implemented:

http://www.clintpriest.com/patches/accessors_v1.patch (patch against trunk)



Asymmetrical getters/setters syntax:



public $Hours {

                public get { return $this->_Hours; }

                protected set { $this->_Hours = $value; } }



Default getter/setter implementations:



                private $Hours {                /* Implements private $__Hours; 
*/

                                public get;           /* { return 
$this->__Hours; }

                                public set;           /* { $this->__Hours = 
$value; }

                }



Interfaces (Forces implementation by implementing classes):



                private $Hours {

                                get;

                                set;

                }



Traits:    No changes necessary, implementation worked without further changes



Errors:   Updated errors to refer to getter/setter implementation when related



Note:

This does not interfere with typical __get()/__set() functionality which will 
take effect whenever there is not a specific getter/setter written.

I have also included 8 .phpt test files which tests the new functionality



What are the next steps to get this added to some future release?

Reply via email to