Beispiel #1
0
 /**
  * Creates a new, blank PHP source file.
  *
  * @param string|NULL $ns
  *  If provided, the new document will have this namespace added to it.
  *
  * @return static
  */
 public static function create($ns = NULL)
 {
     $node = new RootNode();
     $node->addChild(Token::openTag());
     if (is_string($ns) && $ns) {
         NamespaceNode::create($ns)->appendTo($node)->after(Token::newline());
     }
     return $node;
 }
 public function testNamespaceNode()
 {
     $ns = NamespaceNode::create('\\Drupal\\pantaloons');
     $this->assertInstanceOf('\\Pharborist\\Namespaces\\NamespaceNode', $ns);
 }
 public function testCreate()
 {
     $namespace_node = NamespaceNode::create('\\Top\\Sub');
     $this->assertEquals('\\Top\\Sub', $namespace_node->getName()->getAbsolutePath());
     $this->assertNotNull($namespace_node->getBody());
 }