Example #1
0
 /**
  * @param string|Node $method_name
  * @return $this
  */
 public function setMethodName($method_name)
 {
     if (is_string($method_name)) {
         $method_name = Token::identifier($method_name);
     }
     $this->methodName->replaceWith($method_name);
     $this->methodName = $method_name;
     return $this;
 }
Example #2
0
 /**
  * Wrap single line body statements in braces.
  *
  * @param Node|NULL $node
  */
 protected function encloseBlock($node)
 {
     if ($node && !$node instanceof StatementBlockNode) {
         $blockNode = new StatementBlockNode();
         $blockNode->append([Token::openBrace(), clone $node, Token::closeBrace()]);
         $node->replaceWith($blockNode);
     }
 }