<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 24 May 2012 16:55:41 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Zend Developer Zone: Trait-like Functionality for PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/14311</guid>
      <link>http://www.phpdeveloper.org/news/14311</link>
      <description><![CDATA[<p>
In a new tutorial posted on the Zend Developer Zone today <i>Steve Hollis</i> looks at something several PHP developers have said they want to seen in the language - traits - and how, until then, you can <a href="http://devzone.zend.com/article/12014-Trait-like-Functionality-for-PHP">use traits now</a> (well, sort of).
</p>
<blockquote>
So why do we need traits, anyway? PHP is a single inheritance language, meaning that each class can only extend one other. This allows us to build logical class hierarchies which extend functionality in a "vertical" way. [...] What we need is a means of re-using code other than simple inheritance. That's where traits come in. Traits are classes containing a collection of methods, usually relating to a particular behaviour. 
</blockquote>
<p>
He shares a way that you can mimic some of the functionality that traits would give you (full code is <a href="http://www.stevehollis.com/wp-content/uploads/2010/04/traits.zip">available here</a>) with an abstract trait class, reflection and a "superclass" that's extended to pass off the requests to the correct child object.
</p>]]></description>
      <pubDate>Wed, 07 Apr 2010 10:05:52 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stubbles Blog: Traits for PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/9669</guid>
      <link>http://www.phpdeveloper.org/news/9669</link>
      <description><![CDATA[<p>
On the Stubbles blog, <i>Frank Kleine</i> has <a href="http://www.stubbles.org/archives/42-Traits-for-PHP.html">pointed out</a> a <a href="http://news.php.net/php.internals/35562">proposal</a> from <i>Stefan Marr</i> to include functionality for traits in PHP.
</p>
<blockquote>
As a language construct within PHP it would be very easy to do the same, but easier to learn and to use. Beside some keyword issues (the RFC uses "use" as keyword, but this will of course conflict with <a href="http://php.net/manual/en/language.namespaces.using.php">namespaces</a>) I'm wondering what this will have an impact on reflection - the RFC stays unclear about this. 
</blockquote>
<p>
A trait is a free-floating chink of functionality that, instead of being confined to a class (or file) that has to be called on to use it, exists where the developer can use it from anywhere at any time. This helps solve some of the issues with single inheritance in PHP.
</p>]]></description>
      <pubDate>Wed, 20 Feb 2008 11:17:00 -0600</pubDate>
    </item>
  </channel>
</rss>

