Permalink
Browse files

PhpFile: added addUse() [Closes #38]

  • Loading branch information...
dg committed Nov 27, 2018
1 parent 7c5e08e commit 9de4e093a130f7a1bd175198799ebc0efbac6924
@@ -77,6 +77,16 @@ public function getNamespaces(): array
}
/**
* @return static
*/
public function addUse(string $name, string $alias = null): self
{
$this->addNamespace('')->addUse($name, $alias);
return $this;
}
/**
* Adds declare(strict_types=1) to output.
* @return static
@@ -78,6 +78,8 @@ sameFile(__DIR__ . '/expected/PhpFile.bracketed.expect', (string) $file);
$file = new PhpFile;
$file->addClass('A');
$file->addUse('A')
->addUse('B', 'C');
sameFile(__DIR__ . '/expected/PhpFile.globalNamespace.expect', (string) $file);
@@ -1,5 +1,7 @@
<?php
use B as C;
class A
{
}

0 comments on commit 9de4e09

Please sign in to comment.