Skip to content

Commit

Permalink
Remove confusing aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Sep 19, 2024
1 parent cd83c01 commit f0ab996
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions src/Xml/Dom/Configurator/canonicalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
namespace VeeWee\Xml\Dom\Configurator;

use Closure;
use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Dom\Document;
use function Psl\Type\non_empty_string;
use function VeeWee\Xml\Dom\Loader\xml_string_loader;

/**
* @return Closure(DOMDocument): DOMDocument
* @return Closure(XMLDocument): XMLDocument
*/
function canonicalize(): Closure
{
return static fn (DOMDocument $document): DOMDocument
return static fn (XMLDocument $document): XMLDocument
=> Document::fromLoader(
xml_string_loader(
non_empty_string()->assert($document->C14N()),
Expand Down
6 changes: 3 additions & 3 deletions src/Xml/Dom/Configurator/traverse.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
namespace VeeWee\Xml\Dom\Configurator;

use Closure;
use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Dom\Traverser\Visitor;

/**
* @no-named-arguments
* @param list<Visitor> $visitors
*
* @return Closure(DOMDocument): DOMDocument
* @return Closure(XMLDocument): XMLDocument
*/
function traverse(Visitor ... $visitors): Closure
{
return static function (DOMDocument $document) use ($visitors): DOMDocument {
return static function (XMLDocument $document) use ($visitors): XMLDocument {
Document::fromUnsafeDocument($document)->traverse(...$visitors);

return $document;
Expand Down
4 changes: 2 additions & 2 deletions src/Xml/Encoding/document_encode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace VeeWee\Xml\Encoding;

use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Encoding\Exception\EncodingException;
use function VeeWee\Xml\Encoding\Internal\Encoder\Builder\normalize_data;
use function VeeWee\Xml\Encoding\Internal\Encoder\Builder\root;
use function VeeWee\Xml\Encoding\Internal\wrap_exception;

/**
* @param list<callable(DOMDocument): DOMDocument> $configurators
* @param list<callable(XMLDocument): XMLDocument> $configurators
*
* @throws EncodingException
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Xml/Encoding/element_decode.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
namespace VeeWee\Xml\Encoding;

use Dom\Element;
use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Encoding\Exception\EncodingException;
use function VeeWee\Xml\Dom\Locator\document_element;
use function VeeWee\Xml\Encoding\Internal\Decoder\Builder\element;
use function VeeWee\Xml\Encoding\Internal\wrap_exception;

/**
* @param list<callable(DOMDocument): DOMDocument> $configurators
* @param list<callable(XMLDocument): XMLDocument> $configurators
*
* @throws EncodingException
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Xml/Encoding/element_encode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace VeeWee\Xml\Encoding;

use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Encoding\Exception\EncodingException;
use function VeeWee\Xml\Dom\Locator\document_element;
use function VeeWee\Xml\Dom\Mapper\xml_string;
use function VeeWee\Xml\Encoding\Internal\wrap_exception;

/**
* @param list<callable(DOMDocument): DOMDocument> $configurators
* @param list<callable(XMLDocument): XMLDocument> $configurators
*
* @throws EncodingException
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Xml/Encoding/xml_decode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace VeeWee\Xml\Encoding;

use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Encoding\Exception\EncodingException;
use function VeeWee\Xml\Dom\Locator\document_element;
Expand All @@ -13,7 +13,7 @@

/**
* @param non-empty-string $xml
* @param list<callable(DOMDocument): DOMDocument> $configurators
* @param list<callable(XMLDocument): XMLDocument> $configurators
*
* @throws EncodingException
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Xml/Encoding/xml_encode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace VeeWee\Xml\Encoding;

use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Encoding\Exception\EncodingException;
use function VeeWee\Xml\Encoding\Internal\wrap_exception;

/**
* @param list<callable(DOMDocument): DOMDocument> $configurators
* @param list<callable(XMLDocument): XMLDocument> $configurators
*
* @throws EncodingException
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Xml/Reader/MatchingNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace VeeWee\Xml\Reader;

use Dom\XMLDocument as DOMDocument;
use Dom\XMLDocument;
use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Encoding\Exception\EncodingException;
use VeeWee\Xml\Exception\RuntimeException;
Expand Down Expand Up @@ -35,7 +35,7 @@ public function nodeSequence(): NodeSequence
}

/**
* @param list<callable(DOMDocument): DOMDocument> $configurators
* @param list<callable(XMLDocument): XMLDocument> $configurators
*
* @throws RuntimeException
*/
Expand All @@ -45,7 +45,7 @@ public function intoDocument(callable ... $configurators): Document
}

/**
* @param list<callable(DOMDocument): DOMDocument> $configurators
* @param list<callable(XMLDocument): XMLDocument> $configurators
*
* @throws RuntimeException
* @throws EncodingException
Expand Down
6 changes: 3 additions & 3 deletions tests/Xml/Dom/Manipulator/Node/RemoveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace VeeWee\Tests\Xml\Dom\Manipulator\Node;

use DOM\XMLDocument as DOMDocument;
use DOM\XMLDocument;
use PHPUnit\Framework\TestCase;
use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Exception\RuntimeException;
Expand All @@ -29,7 +29,7 @@ public function test_it_can_remove_a_comment(): void
{
$doc = Document::fromXmlString('<hello><!-- hello --></hello>');
$node = $doc->map(
static fn (DOMDocument $document) => $document->documentElement->firstChild
static fn (XMLDocument $document) => $document->documentElement->firstChild
);

$result = remove($node);
Expand All @@ -42,7 +42,7 @@ public function test_it_can_remove_a_text_node(): void
{
$doc = Document::fromXmlString('<hello>World</hello>');
$node = $doc->map(
static fn (DOMDocument $document) => $document->documentElement->firstChild
static fn (XMLDocument $document) => $document->documentElement->firstChild
);

$result = remove($node);
Expand Down
4 changes: 2 additions & 2 deletions tests/Xml/Dom/Manipulator/Node/RenameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace VeeWee\Tests\Xml\Dom\Manipulator\Node;

use DOM\XMLDocument as DOMDocument;
use DOM\XMLDocument;
use PHPUnit\Framework\TestCase;
use VeeWee\Xml\Dom\Document;
use VeeWee\Xml\Exception\RuntimeException;
Expand Down Expand Up @@ -199,7 +199,7 @@ public function test_it_cannot_rename_a_comment(): void
{
$doc = Document::fromXmlString('<hello><!-- hello --></hello>');
$node = $doc->map(
static fn (DOMDocument $document) => $document->documentElement->firstChild
static fn (XMLDocument $document) => $document->documentElement->firstChild
);

$this->expectException(RuntimeException::class);
Expand Down
20 changes: 10 additions & 10 deletions tests/Xml/Dom/Validator/ValidatorChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace VeeWee\Tests\Xml\Dom\Validator;

use DOM\XMLDocument as DOMDocument;
use DOM\XMLDocument;
use PHPUnit\Framework\TestCase;
use VeeWee\Tests\Xml\ErrorHandling\Issue\UseIssueTrait;
use VeeWee\Xml\Dom\Document;
Expand Down Expand Up @@ -36,29 +36,29 @@ public static function provideErrorCases()
];
yield 'noFails' => [
'validator' => validator_chain(
static fn (DOMDocument $document) => new IssueCollection(),
static fn (DOMDocument $document) => new IssueCollection(),
static fn (DOMDocument $document) => new IssueCollection()
static fn (XMLDocument $document) => new IssueCollection(),
static fn (XMLDocument $document) => new IssueCollection(),
static fn (XMLDocument $document) => new IssueCollection()
),
'errors' => 0,
];
yield 'oneFails' => [
'validator' => validator_chain(
static fn (DOMDocument $document) => new IssueCollection(),
static fn (DOMDocument $document) => new IssueCollection(
static fn (XMLDocument $document) => new IssueCollection(),
static fn (XMLDocument $document) => new IssueCollection(
self::createIssue(Level::fatal())
),
static fn (DOMDocument $document) => new IssueCollection(),
static fn (DOMDocument $document) => new IssueCollection()
static fn (XMLDocument $document) => new IssueCollection(),
static fn (XMLDocument $document) => new IssueCollection()
),
'errors' => 1,
];
yield 'allFails' => [
'validator' => validator_chain(
static fn (DOMDocument $document) => new IssueCollection(
static fn (XMLDocument $document) => new IssueCollection(
self::createIssue(Level::fatal())
),
static fn (DOMDocument $document) => new IssueCollection(
static fn (XMLDocument $document) => new IssueCollection(
self::createIssue(Level::fatal()),
self::createIssue(Level::fatal())
),
Expand Down

0 comments on commit f0ab996

Please sign in to comment.