rfc:propertygetsetsyntax-v1.2
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
rfc:propertygetsetsyntax-v1.2 [2013/01/13 14:26] cpriest Added notes on recursion guarding from illegal context |
rfc:propertygetsetsyntax-v1.2 [2017/09/22 13:28] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 1.2 | * Version: 1.2 | ||
* Created: 2012-12-29 | * Created: 2012-12-29 | ||
- | * Author: Clint Priest <phpdev | + | |
+ | | ||
* Contributors: | * Contributors: | ||
- | * Status: | + | * Status: |
==== Fork ==== | ==== Fork ==== | ||
Line 136: | Line 137: | ||
// This accessor is now public instead of protected | // This accessor is now public instead of protected | ||
public set { | public set { | ||
- | // You can access a base class accessor explicitly, just like accessing | + | // Due to technical limitations |
- | | + | |
} | } | ||
} | } | ||
Line 340: | Line 341: | ||
* unset called from illegal context: Recursion warning is emitted, unset is ignored. | * unset called from illegal context: Recursion warning is emitted, unset is ignored. | ||
+ | ==== Abstract Accessors ==== | ||
+ | Individual accessors may be defined abstract which will cause the class to be abstract and require any extending classes to define a body for the abstract accessors. | ||
+ | |||
+ | <code php> | ||
+ | class Foo { | ||
+ | public $bar { | ||
+ | abstract get; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | class SubFoo extends Foo { | ||
+ | } | ||
+ | |||
+ | /* Fatal error: Class Foo contains 2 abstract accessors and must be declared | ||
+ | abstract or implement the remaining accessors (Foo:: | ||
+ | </ | ||
+ | |||
+ | Just like abstract functions, it is illegal to declare an accessor abstract and to provide a body: | ||
+ | <code php> | ||
+ | class Foo { | ||
+ | public $bar { | ||
+ | abstract get { return ' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /* Fatal error: Abstract function Foo:: | ||
+ | </ | ||
+ | |||
+ | You may also declare an entire property as abstract such as: | ||
+ | |||
+ | <code php> | ||
+ | class Foo { | ||
+ | abstract public $bar { | ||
+ | get; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /* This marks all declared accessors as abstract, as well as the class. | ||
+ | would need to provide a body for any declared accessors */ | ||
+ | </ | ||
==== Final Properties ==== | ==== Final Properties ==== | ||
Line 405: | Line 446: | ||
| | ||
public $dataArray { | public $dataArray { | ||
- | &get { return $this-> | + | &get() { return $this-> |
+ | set(& | ||
} | } | ||
} | } | ||
Line 421: | Line 463: | ||
* $foobar-> | * $foobar-> | ||
* $foo-> | * $foo-> | ||
- | * $foo-> | ||
Line 508: | Line 549: | ||
===== Reflection ===== | ===== Reflection ===== | ||
- | ==== Changes ==== | ||
- | * ReflectionClass:: | + | ==== ReflectionProperty |
- | * ReflectionClass:: | + | |
- | ==== Additions ==== | + | The class has the following functions added: |
- | === ReflectionMethodAccessor extends | + | * getGet(): Returns a ReflectionMethod |
+ | * getSet(): Returns a ReflectionMethod object for the setter or false if no setter is defined. | ||
+ | * getIsset(): Returns a ReflectionMethod object for the isset accessor. | ||
+ | * getUnset(): Returns a ReflectionMethod object for the unset accessor. | ||
+ | * hasAccessors(): | ||
- | * isAutoImplemented(): | + | A fairly extensive test-suite has been created to test the functionality as well. |
- | === ReflectionPropertyAccessor extends ReflectionProperty | + | ===== Backward Compatibility |
+ | There are no known backward compatibility issues. | ||
- | The new class has all of the same functions as the ReflectionProperty as well as: | + | ===== Internal Implementation ===== |
- | * getGet(): Returns a ReflectionMethodAccessor object for the getter or false if no getter is defined. | + | Implementation Details Document: https://wiki.php.net/ |
- | * getSet(): Returns a ReflectionMethodAccessor object for the setter or false if no setter is defined. | + | |
- | * getIsset(): Returns a ReflectionMethodAccessor object for the isset accessor. | + | |
- | * getUnset(): Returns a ReflectionMethodAccessor object for the unset accessor. | + | |
- | All other functions have been updated to return appropriate values | + | ===== Impact on APC and other Zend extensions ===== |
- | === Updates === | + | In addition to the " |
- | * ReflectionClass:: | + | Most Zend extensions should not be affected by this change. Accessors are normal '' |
- | * ReflectionClass:: | + | |
- | A fairly extensive test-suite | + | One extension that will require minor changes is APC. APC has to copy all '' |
- | ===== Backward Compatibility ===== | + | Thus the impact of the change on Zend exts is rather small. |
- | There are no known backward compatibility issues. | + | |
- | ===== Internal Implementation | + | ===== Tests ===== |
+ | * 2012-12-30: 67 tests at this time | ||
+ | * 2013-01-17: 83 tests at this time | ||
- | Implementation Details Document: https:// | + | ===== Voting ===== |
- | ===== Tests ===== | + | Voting ends not before Wednesday, January 23rd 2013. The PHP language is expanded, so a 2/3 majority is required. |
- | * 2012-12-30 : 67 tests at this time | + | |
+ | <doodle title=" | ||
+ | | ||
+ | * No | ||
+ | </ | ||
===== Change Log ===== | ===== Change Log ===== |
rfc/propertygetsetsyntax-v1.2.1358087198.txt.gz · Last modified: 2017/09/22 13:28 (external edit)