rfc:class_properties_initialization
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:class_properties_initialization [2010/07/30 10:39] – k.antczak | rfc:class_properties_initialization [2010/07/30 10:44] – k.antczak | ||
---|---|---|---|
Line 5: | Line 5: | ||
* Status: In Draft | * Status: In Draft | ||
* First Published at: http:// | * First Published at: http:// | ||
- | * Related RFC: [[rfc: | + | * Related RFC: [[rfc: |
===== Introduction ===== | ===== Introduction ===== | ||
Line 13: | Line 13: | ||
==== Why do we need it? ==== | ==== Why do we need it? ==== | ||
- | * **objects structures** - structured objects initialization - like IoC/DI containers, where structure is not a result of code execution, but it's a result of strictly controlled design. | ||
* **code readability** | * **code readability** | ||
===== Proposal ===== | ===== Proposal ===== | ||
+ | |||
+ | **Main idea** | ||
<code php> | <code php> | ||
Line 30: | Line 31: | ||
**Other / Related** | **Other / Related** | ||
+ | |||
+ | * objects structures - structured objects initialization - like IoC/DI containers, where structure is not a result of code execution, but it's a result of strictly controlled design. | ||
<code php> | <code php> | ||
Line 36: | Line 39: | ||
private $var1 = new Bar(); | private $var1 = new Bar(); | ||
private $var2 = Bar :: getInstance (); | private $var2 = Bar :: getInstance (); | ||
+ | } | ||
+ | </ | ||
- | | + | * initialization with functions |
+ | |||
+ | <code php> | ||
+ | class Foo | ||
+ | { | ||
+ | | ||
| | ||
- | private httpRequest $var4 = getRequest (); | + | private httpRequest $var2 = getRequest (); |
} | } | ||
</ | </ |
rfc/class_properties_initialization.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1