Пример #1
0
 /**
  * Removes a trait. 
  * 
  * If the trait is passed as PhpTrait object, 
  * the trait is also removed from use statements.
  *
  * @param PhpTrait|string $trait trait or qualified name
  * @return $this
  */
 public function removeTrait($trait)
 {
     if ($trait instanceof PhpTrait) {
         $name = $trait->getName();
     } else {
         $name = $trait;
     }
     $index = array_search($name, $this->traits);
     if ($index) {
         unset($this->traits[$name]);
         if ($trait instanceof PhpTrait) {
             $qname = $trait->getQualifiedName();
             $this->removeUseStatement($qname);
         }
     }
     return $this;
 }