Skip to content

Instantly share code, notes, and snippets.

@whizark
Created July 10, 2014 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whizark/2661a9a9fdec0eb66fea to your computer and use it in GitHub Desktop.
Save whizark/2661a9a9fdec0eb66fea to your computer and use it in GitHub Desktop.
Extending Traits #test #php
<?php
trait FirstTrait
{
public function firstMethod() {
echo 'This is the firstMethod()' . PHP_EOL;
}
}
trait SecondTrait
{
use FirstTrait;
public function secondMethod() {
echo 'This is the secondMethod()' . PHP_EOL;
}
}
class ConcreteClass
{
use SecondTrait;
}
$aConcreteClass = new ConcreteClass();
$aConcreteClass->firstMethod();
// This is the firstMethod()
$aConcreteClass->secondMethod();
// This is the secondMethod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment