rfc:nonbreakabletraits

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:nonbreakabletraits [2008/03/13 18:45] gronrfc:nonbreakabletraits [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 21: Line 21:
   - Making an //alias// of the property or method and use either scope.   - Making an //alias// of the property or method and use either scope.
   - //Merging// multiple properties or methods in the class scope.   - //Merging// multiple properties or methods in the class scope.
 +
  
 ===== Keywords Used In Sample Code ===== ===== Keywords Used In Sample Code =====
Line 26: Line 27:
 For all of the code examples, the following keywords were used: For all of the code examples, the following keywords were used:
  
-''trait'' +''trait''This keyword is used to mark a trait definition exactly as the ''class'' keyword works for classes. 
-  This keyword is used to mark a trait definition exactly as the ''class'' + 
-  keyword works for classes. +''class''Same as current PHP keyword. 
-''class'' + 
-  Same as current PHP keyword. +''include''Used to include a trait into a class definition 
-''include'' + 
-  Used to include a trait into a class definition +''private''This keyword is used in its current PHP sense as well as to mean that a property or method is to retain its //local// trait scope. 
-''private'' + 
-  This keyword is used in its current PHP sense as well as to mean that +''public''This keyword is used in its current PHP sense as well as to mean that a property or method is to be used within the scope of the including class. 
-  a property or method is to retain its //local// trait scope. + 
-''public'' +''as''Used to //alias// or //merge// a trait into a class. 
-  This keyword is used in its current PHP sense as well as to mean that +
-  a property or method is to be used within the scope of the including +
-  class. +
-''as'' +
-  Used to //alias// or //merge// a trait into a class.+
  
 ===== Keeping Methods and Properties Local ===== ===== Keeping Methods and Properties Local =====
Line 51: Line 48:
 included trait, or is overridden in the including class. included trait, or is overridden in the including class.
  
-The problem with including an entire trait locally is there is not way+The problem with including an entire trait locally is that there is no way
 to use the methods or properties. The trait is only useful if you to use the methods or properties. The trait is only useful if you
 include at least one of the methods or properties into the class scope. include at least one of the methods or properties into the class scope.
rfc/nonbreakabletraits.1205433914.txt.gz · Last modified: 2017/09/22 13:28 (external edit)