Skip to content

Commit 0491c4b

Browse files
committed
fix namespace
1 parent df2d1f6 commit 0491c4b

File tree

7 files changed

+18
-32
lines changed

7 files changed

+18
-32
lines changed

src/HtmlClass.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
namespace AhjDev\PhpTagMaker;
44

5-
use Countable;
6-
use Stringable;
7-
use IteratorAggregate;
8-
9-
final class HtmlClass implements Stringable, IteratorAggregate, Countable
5+
final class HtmlClass implements \Stringable, \IteratorAggregate, \Countable
106
{
117
private array $classList = [];
128

src/Node/EscapedText.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@
22

33
namespace AhjDev\PhpTagMaker\Node;
44

5-
use DOMCdataSection;
65
use AhjDev\PhpTagMaker\Node;
76

87
final class EscapedText extends Node
98
{
10-
private DOMCdataSection $text;
9+
private \DOMCdataSection $text;
1110

1211
public function __construct(string $text)
1312
{
14-
$this->text = new DOMCdataSection($text);
13+
$this->text = new \DOMCdataSection($text);
1514
}
1615

1716
public static function make($text): self
1817
{
1918
return new self($text);
2019
}
2120

22-
public function toDomNode(): DOMCdataSection
21+
public function toDomNode(): \DOMCdataSection
2322
{
2423
return $this->text;
2524
}

src/Node/HtmlTag.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace AhjDev\PhpTagMaker\Node;
44

5-
use DOMElement;
65
use AhjDev\PhpTagMaker\Node;
76
use AhjDev\PhpTagMaker\HtmlClass;
87

@@ -16,11 +15,11 @@ final class HtmlTag extends Node
1615

1716
private HtmlClass $class;
1817

19-
private DOMElement $domElement;
18+
private \DOMElement $domElement;
2019

2120
public function __construct(private string $tag, Node|string ...$value)
2221
{
23-
$this->domElement = new DOMElement($tag);
22+
$this->domElement = new \DOMElement($tag);
2423
$this->values = array_map(static fn ($v) => is_string($v) ? new HtmlText($v) : $v, $value);
2524
$this->class = new HtmlClass;
2625
// $this->domElement->getElementsByTagName();
@@ -42,7 +41,7 @@ public function getName()
4241

4342
public function setName(string $tag): self
4443
{
45-
$element = new DOMElement($tag);
44+
$element = new \DOMElement($tag);
4645
// Copy attributes and child nodes from old element to new element
4746
foreach ($this->domElement->attributes as $attribute) {
4847
$element->setAttribute(
@@ -57,7 +56,7 @@ public function setName(string $tag): self
5756
return $this;
5857
}
5958

60-
public function toDomNode(): DOMElement
59+
public function toDomNode(): \DOMElement
6160
{
6261
$element = $this->domElement->cloneNode(true);
6362
if ($this->class->count()) {

src/Node/HtmlTagMulti.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace AhjDev\PhpTagMaker\Node;
44

5-
use IteratorAggregate;
65
use AhjDev\PhpTagMaker\Node;
76

87
/**
9-
* @implements IteratorAggregate<HtmlTag>
8+
* @implements \IteratorAggregate<HtmlTag>
109
*/
11-
final class HtmlTagMulti extends Node implements IteratorAggregate
10+
final class HtmlTagMulti extends Node implements \IteratorAggregate
1211
{
1312
/** @var list<Node> */
1413
private array $values = [];

src/Node/HtmlText.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@
22

33
namespace AhjDev\PhpTagMaker\Node;
44

5-
use DOMText;
65
use AhjDev\PhpTagMaker\Node;
76

87
final class HtmlText extends Node
98
{
10-
private DOMText $domText;
9+
private \DOMText $domText;
1110

1211
public function __construct(string $text)
1312
{
14-
$this->domText = new DOMText($text);
13+
$this->domText = new \DOMText($text);
1514
}
1615

1716
public static function make($text): self
1817
{
1918
return new self($text);
2019
}
2120

22-
public function toDomNode(): DOMText
21+
public function toDomNode(): \DOMText
2322
{
2423
return $this->domText;
2524
}

src/Node/Internal/Attributes.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22

33
namespace AhjDev\PhpTagMaker\Node\Internal;
44

5-
use DOMAttr;
6-
use DOMElement;
7-
use Iterator;
8-
use ArrayIterator;
95
use AhjDev\PhpTagMaker\HtmlClass;
106

117
/**
128
* @internal
13-
* @property DOMElement $domElement
9+
* @property \DOMElement $domElement
1410
*/
1511
trait Attributes
1612
{
@@ -61,11 +57,11 @@ public function getAttribute(string $qualifiedName): ?string
6157
}
6258

6359
/**
64-
* @return ArrayIterator<DOMAttr>
60+
* @return \ArrayIterator<\DOMAttr>
6561
*/
66-
public function iterAttributes(): Iterator
62+
public function iterAttributes(): \Iterator
6763
{
68-
return new ArrayIterator(
64+
return new \ArrayIterator(
6965
array_map(
7066
fn (string $name) => $this->domElement->getAttributeNode($name),
7167
$this->domElement->getAttributeNames()

src/TagMaker.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace AhjDev\PhpTagMaker;
44

5-
use DOMDocument;
6-
75
final class TagMaker
86
{
97
private bool $formatOutput = false;
@@ -24,7 +22,7 @@ public function formatOutput(bool $option = true): self
2422

2523
public function run(Node $node): string
2624
{
27-
$dom = new DOMDocument();
25+
$dom = new \DOMDocument();
2826
$dom->formatOutput = $this->formatOutput;
2927
$dom->appendChild(
3028
$dom->importNode(

0 commit comments

Comments
 (0)