Skip to content

Commit

Permalink
Add spec compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Feb 21, 2024
1 parent 47504ae commit 5fbf4d4
Show file tree
Hide file tree
Showing 177 changed files with 749 additions and 760 deletions.
8 changes: 4 additions & 4 deletions src/Xml/Dom/Assert/assert_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace VeeWee\Xml\Dom\Assert;

use DOMAttr;
use \DOM\Attr;
use Psl\Type\Exception\AssertException;
use function Psl\Type\instance_of;

/**
* @psalm-assert DOMElement $node
* @psalm-assert \DOM\Element $node
* @throws AssertException
*/
function assert_attribute(mixed $node): DOMAttr
function assert_attribute(mixed $node): \DOM\Attr

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:15:41: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_attribute.php:15:41: MoreSpecificReturnType: The declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:15:41: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_attribute.php:15:41: MoreSpecificReturnType: The declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:15:41: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_attribute.php:15:41: MoreSpecificReturnType: The declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:15:41: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_attribute.php:15:41: MoreSpecificReturnType: The declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:15:41: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_attribute.php:15:41: MoreSpecificReturnType: The declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:15:41: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_attribute.php:15:41: MoreSpecificReturnType: The declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute is more specific than the inferred return type 'object' (see https://psalm.dev/070)
{
return instance_of(DOMAttr::class)->assert($node);
return instance_of(\DOM\Attr::class)->assert($node);

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_attribute.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:17:24: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_attribute.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_attribute.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:17:24: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_attribute.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_attribute.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:17:24: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_attribute.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_attribute.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:17:24: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_attribute.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_attribute.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:17:24: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_attribute.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_attribute.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\Attr' for VeeWee\Xml\Dom\Assert\assert_attribute (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_attribute.php:17:24: UndefinedClass: Class, interface or enum named DOM\Attr does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_attribute.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_attribute.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)
}
8 changes: 4 additions & 4 deletions src/Xml/Dom/Assert/assert_cdata.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace VeeWee\Xml\Dom\Assert;

use DOMCdataSection;
use \DOM\CdataSection;
use Psl\Type\Exception\AssertException;
use function Psl\Type\instance_of;

/**
* @psalm-assert DOMCdataSection $node
* @psalm-assert \DOM\CdataSection $node
* @throws AssertException
*/
function assert_cdata(mixed $node): DOMCdataSection
function assert_cdata(mixed $node): \DOM\CdataSection

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:15:37: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_cdata.php:15:37: MoreSpecificReturnType: The declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:15:37: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_cdata.php:15:37: MoreSpecificReturnType: The declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:15:37: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_cdata.php:15:37: MoreSpecificReturnType: The declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:15:37: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_cdata.php:15:37: MoreSpecificReturnType: The declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:15:37: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_cdata.php:15:37: MoreSpecificReturnType: The declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata is more specific than the inferred return type 'object' (see https://psalm.dev/070)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:15:37: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 15 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MoreSpecificReturnType

src/Xml/Dom/Assert/assert_cdata.php:15:37: MoreSpecificReturnType: The declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata is more specific than the inferred return type 'object' (see https://psalm.dev/070)
{
return instance_of(DOMCdataSection::class)->assert($node);
return instance_of(\DOM\CdataSection::class)->assert($node);

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_cdata.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:17:24: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_cdata.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_cdata.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:17:24: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_cdata.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_cdata.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:17:24: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_cdata.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_cdata.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:17:24: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_cdata.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_cdata.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:17:24: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_cdata.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

LessSpecificReturnStatement

src/Xml/Dom/Assert/assert_cdata.php:17:12: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'DOM\CdataSection' for VeeWee\Xml\Dom\Assert\assert_cdata (see https://psalm.dev/129)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Xml/Dom/Assert/assert_cdata.php:17:24: UndefinedClass: Class, interface or enum named DOM\CdataSection does not exist (see https://psalm.dev/019)

Check failure on line 17 in src/Xml/Dom/Assert/assert_cdata.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MixedArgument

src/Xml/Dom/Assert/assert_cdata.php:17:24: MixedArgument: Argument 1 of Psl\Type\instance_of cannot be mixed, expecting class-string (see https://psalm.dev/030)
}
8 changes: 4 additions & 4 deletions src/Xml/Dom/Assert/assert_document.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace VeeWee\Xml\Dom\Assert;

use DOMDocument;
use \DOM\XMLDocument;
use Psl\Type\Exception\AssertException;
use function Psl\Type\instance_of;

/**
* @psalm-assert DOMDocument $node
* @psalm-assert \DOM\XMLDocument $node
* @throws AssertException
*/
function assert_document(mixed $node): DOMDocument
function assert_document(mixed $node): \DOM\XMLDocument
{
return instance_of(DOMDocument::class)->assert($node);
return instance_of(\DOM\XMLDocument::class)->assert($node);
}
8 changes: 4 additions & 4 deletions src/Xml/Dom/Assert/assert_dom_node_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace VeeWee\Xml\Dom\Assert;

use DOMNodeList;
use \DOM\NodeList;
use Psl\Type\Exception\AssertException;
use function Psl\Type\instance_of;

/**
* @psalm-assert DOMNodeList $node
* @psalm-assert \DOM\NodeList $node
* @throws AssertException
*/
function assert_dom_node_list(mixed $node): DOMNodeList
function assert_dom_node_list(mixed $node): \DOM\NodeList
{
return instance_of(DOMNodeList::class)->assert($node);
return instance_of(\DOM\NodeList::class)->assert($node);
}
8 changes: 4 additions & 4 deletions src/Xml/Dom/Assert/assert_element.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace VeeWee\Xml\Dom\Assert;

use DOMElement;
use \DOM\Element;
use Psl\Type\Exception\AssertException;
use function Psl\Type\instance_of;

/**
* @psalm-assert DOMElement $node
* @psalm-assert \DOM\Element $node
* @throws AssertException
*/
function assert_element(mixed $node): DOMElement
function assert_element(mixed $node): \DOM\Element
{
return instance_of(DOMElement::class)->assert($node);
return instance_of(\DOM\Element::class)->assert($node);
}
4 changes: 2 additions & 2 deletions src/Xml/Dom/Builder/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace VeeWee\Xml\Dom\Builder;

use DOMNode;
use \DOM\Node;

interface Builder
{
public function __invoke(DOMNode $node): DOMNode;
public function __invoke(\DOM\Node $node): \DOM\Node;
}
6 changes: 3 additions & 3 deletions src/Xml/Dom/Builder/attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use \DOM\Element;

/**
* @return Closure(DOMElement): DOMElement
* @return Closure(\DOM\Element): \DOM\Element
*/
function attribute(string $name, string $value): Closure
{
return static function (DOMElement $node) use ($name, $value): DOMElement {
return static function (\DOM\Element $node) use ($name, $value): \DOM\Element {
$node->setAttribute($name, $value);

return $node;
Expand Down
8 changes: 4 additions & 4 deletions src/Xml/Dom/Builder/attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use \DOM\Element;
use function Psl\Iter\reduce_with_keys;

/**
* @param array<string, string> $attributes
* @return Closure(DOMElement): DOMElement
* @return Closure(\DOM\Element): \DOM\Element
*/
function attributes(array $attributes): Closure
{
return static function (DOMElement $node) use ($attributes): DOMElement {
return static function (\DOM\Element $node) use ($attributes): \DOM\Element {
return reduce_with_keys(
$attributes,
static fn (DOMElement $node, string $name, string $value)
static fn (\DOM\Element $node, string $name, string $value)
=> attribute($name, $value)($node),
$node
);
Expand Down
10 changes: 5 additions & 5 deletions src/Xml/Dom/Builder/cdata.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMCdataSection;
use DOMNode;
use \DOM\CdataSection;
use \DOM\Node;
use function VeeWee\Xml\Dom\Assert\assert_cdata;
use function VeeWee\Xml\Dom\Locator\Node\detect_document;
use function VeeWee\Xml\Internal\configure;

/**
* @param list<callable(DOMCdataSection): DOMCdataSection> $configurators
* @param list<callable(\DOM\CdataSection): \DOM\CdataSection> $configurators
*
* @return Closure(DOMNode): DOMCdataSection
* @return Closure(\DOM\Node): \DOM\CdataSection
*/
function cdata(string $data, ...$configurators): Closure
{
return static function (DOMNode $node) use ($data, $configurators): DOMCdataSection {
return static function (\DOM\Node $node) use ($data, $configurators): \DOM\CdataSection {
$document = detect_document($node);

return assert_cdata(
Expand Down
8 changes: 4 additions & 4 deletions src/Xml/Dom/Builder/children.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMNode;
use \DOM\Node;

/**
* @template T of DOMNode
* @template T of \DOM\Node
*
* @param list<callable(T): DOMNode> $builders
* @param list<callable(T): \DOM\Node> $builders
*
* @return Closure(T): T
*/
function children(callable ...$builders): Closure
{
return static function (DOMNode $node) use ($builders): DOMNode {
return static function (\DOM\Node $node) use ($builders): \DOM\Node {
foreach ($builders as $builder) {
$node->appendChild($builder($node));
}
Expand Down
10 changes: 5 additions & 5 deletions src/Xml/Dom/Builder/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use DOMNode;
use \DOM\Element;
use \DOM\Node;
use function VeeWee\Xml\Dom\Assert\assert_element;
use function VeeWee\Xml\Dom\Locator\Node\detect_document;
use function VeeWee\Xml\Internal\configure;

/**
* @param list<callable(DOMElement): DOMElement> $configurators
* @param list<callable(\DOM\Element): \DOM\Element> $configurators
*
* @return Closure(DOMNode): DOMElement
* @return Closure(\DOM\Node): \DOM\Element
*/
function element(string $name, callable ...$configurators): Closure
{
return static function (DOMNode $node) use ($name, $configurators): DOMElement {
return static function (\DOM\Node $node) use ($name, $configurators): \DOM\Element {
$document = detect_document($node);

return assert_element(
Expand Down
6 changes: 3 additions & 3 deletions src/Xml/Dom/Builder/escaped_value.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use \DOM\Element;

/**
* @return Closure(DOMElement): DOMElement
* @return Closure(\DOM\Element): \DOM\Element
*/
function escaped_value(string $value): Closure
{
return static function (DOMElement $node) use ($value): DOMElement {
return static function (\DOM\Element $node) use ($value): \DOM\Element {
$node->nodeValue = htmlspecialchars($value, ENT_XML1|ENT_QUOTES);

return $node;
Expand Down
6 changes: 3 additions & 3 deletions src/Xml/Dom/Builder/namespaced_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use \DOM\Element;
use function VeeWee\Xml\Assertion\assert_strict_prefixed_name;

/**
* @return Closure(DOMElement): DOMElement
* @return Closure(\DOM\Element): \DOM\Element
*/
function namespaced_attribute(string $namespace, string $qualifiedName, string $value): Closure
{
return static function (DOMElement $node) use ($namespace, $qualifiedName, $value): DOMElement {
return static function (\DOM\Element $node) use ($namespace, $qualifiedName, $value): \DOM\Element {
assert_strict_prefixed_name($qualifiedName);

$node->setAttributeNS($namespace, $qualifiedName, $value);
Expand Down
8 changes: 4 additions & 4 deletions src/Xml/Dom/Builder/namespaced_attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use \DOM\Element;
use function Psl\Iter\reduce_with_keys;

/**
* @param array<string, string> $attributes
* @return Closure(DOMElement): DOMElement
* @return Closure(\DOM\Element): \DOM\Element
*/
function namespaced_attributes(string $namespace, array $attributes): Closure
{
return static function (DOMElement $node) use ($namespace, $attributes): DOMElement {
return static function (\DOM\Element $node) use ($namespace, $attributes): \DOM\Element {
return reduce_with_keys(
$attributes,
static fn (DOMElement $node, string $name, string $value)
static fn (\DOM\Element $node, string $name, string $value)
=> namespaced_attribute($namespace, $name, $value)($node),
$node
);
Expand Down
10 changes: 5 additions & 5 deletions src/Xml/Dom/Builder/namespaced_element.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use DOMNode;
use \DOM\Element;
use \DOM\Node;
use function VeeWee\Xml\Dom\Assert\assert_element;
use function VeeWee\Xml\Dom\Locator\Node\detect_document;
use function VeeWee\Xml\Internal\configure;

/**
* @param list<callable(DOMElement): DOMElement> $configurators
* @param list<callable(\DOM\Element): \DOM\Element> $configurators
*
* @return Closure(DOMNode): DOMElement
* @return Closure(\DOM\Node): \DOM\Element
*/
function namespaced_element(string $namespace, string $qualifiedName, callable ...$configurators): Closure
{
return static function (DOMNode $node) use ($namespace, $qualifiedName, $configurators): DOMElement {
return static function (\DOM\Node $node) use ($namespace, $qualifiedName, $configurators): \DOM\Element {
$document = detect_document($node);

return assert_element(
Expand Down
18 changes: 9 additions & 9 deletions src/Xml/Dom/Builder/nodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMDocument;
use DOMNode;
use \DOM\XMLDocument;
use \DOM\Node;
use function is_array;
use function Psl\Iter\reduce;
use function VeeWee\Xml\Dom\Locator\Node\detect_document;

/**
* @param list<callable(DOMDocument): (list<DOMNode>|DOMNode)> $builders
* @param list<callable(\DOM\XMLDocument): (list<\DOM\Node>|\DOM\Node)> $builders
*
* @return Closure(DOMDocument): list<DOMNode>
* @return Closure(\DOM\XMLDocument): list<\DOM\Node>
*/
function nodes(callable ... $builders): Closure
{
return
/**
* @return list<DOMNode>
* @return list<\DOM\Node>
*/
static fn (DOMNode $node): array
static fn (\DOM\Node $node): array
=> reduce(
$builders,
/**
* @param list<DOMNode> $builds
* @param callable(DOMDocument): (DOMNode|list<DOMNode>) $builder
* @return list<DOMNode>
* @param list<\DOM\Node> $builds
* @param callable(\DOM\XMLDocument): (\DOM\Node|list<\DOM\Node>) $builder
* @return list<\DOM\Node>
*/
static function (array $builds, callable $builder) use ($node): array {
$result = $builder(detect_document($node));
Expand Down
6 changes: 3 additions & 3 deletions src/Xml/Dom/Builder/value.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use \DOM\Element;

/**
* @return Closure(DOMElement): DOMElement
* @return Closure(\DOM\Element): \DOM\Element
*/
function value(string $value): Closure
{
return static function (DOMElement $node) use ($value): DOMElement {
return static function (\DOM\Element $node) use ($value): \DOM\Element {
$node->nodeValue = $value;

return $node;
Expand Down
6 changes: 3 additions & 3 deletions src/Xml/Dom/Builder/xmlns_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
namespace VeeWee\Xml\Dom\Builder;

use Closure;
use DOMElement;
use \DOM\Element;
use VeeWee\Xml\Xmlns\Xmlns;
use function VeeWee\Xml\Assertion\assert_strict_prefixed_name;

/**
* @return Closure(DOMElement): DOMElement
* @return Closure(\DOM\Element): \DOM\Element
*/
function xmlns_attribute(string $prefix, string $namespaceURI): Closure
{
return static function (DOMElement $node) use ($prefix, $namespaceURI): DOMElement {
return static function (\DOM\Element $node) use ($prefix, $namespaceURI): \DOM\Element {
$prefixed = 'xmlns:'.$prefix;
assert_strict_prefixed_name($prefixed);

Expand Down
Loading

0 comments on commit 5fbf4d4

Please sign in to comment.