Skip to content

Commit

Permalink
[REFACTOR] PHP 8 Syntax, Add Types
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWeinert committed Oct 17, 2023
1 parent e2d6c90 commit c4136e0
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 423 deletions.
5 changes: 2 additions & 3 deletions src/FluentDOM/DOM/CdataSection.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
/*
* FluentDOM
*
* @link https://thomas.weinert.info/FluentDOM/
* @copyright Copyright 2009-2019 FluentDOM Contributors
* @copyright Copyright 2009-2023 FluentDOM Contributors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*
*/
Expand All @@ -24,7 +24,6 @@ class CdataSection
implements Node\NonDocumentTypeChildNode {

use Node\ChildNode\Implementation;
use Node\NonDocumentTypeChildNode\Properties;
use Node\StringCast;
use Node\WholeText;
use Node\Xpath;
Expand Down
5 changes: 2 additions & 3 deletions src/FluentDOM/DOM/Comment.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
/*
* FluentDOM
*
* @link https://thomas.weinert.info/FluentDOM/
* @copyright Copyright 2009-2019 FluentDOM Contributors
* @copyright Copyright 2009-2023 FluentDOM Contributors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*
*/
Expand All @@ -24,7 +24,6 @@ class Comment
implements Node\NonDocumentTypeChildNode {

use Node\ChildNode\Implementation;
use Node\NonDocumentTypeChildNode\Properties;
use Node\StringCast;
use Node\Xpath;
}
Expand Down
2 changes: 1 addition & 1 deletion src/FluentDOM/DOM/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class Document extends \DOMDocument implements Node\ParentNode {

use
Node\ParentNode\Properties,
Node\ParentNode\Implementation,
Node\QuerySelector\Implementation,
Node\Xpath;

Expand Down
2 changes: 1 addition & 1 deletion src/FluentDOM/DOM/DocumentFragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class DocumentFragment
Node\ParentNode {

use
Node\ParentNode\Implementation,
/** @noinspection TraitsPropertiesConflictsInspection */
Node\ParentNode\Properties,
Node\QuerySelector\Implementation,
/** @noinspection TraitsPropertiesConflictsInspection */
Node\Xpath;
Expand Down
1 change: 0 additions & 1 deletion src/FluentDOM/DOM/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class Element

use
Node\ChildNode\Implementation,
Node\NonDocumentTypeChildNode\Implementation,
Node\QuerySelector\Implementation,
Node\StringCast,
Node\Xpath,
Expand Down
51 changes: 0 additions & 51 deletions src/FluentDOM/DOM/Node/NonDocumentTypeChildNode/Implementation.php

This file was deleted.

78 changes: 0 additions & 78 deletions src/FluentDOM/DOM/Node/NonDocumentTypeChildNode/Properties.php

This file was deleted.

37 changes: 0 additions & 37 deletions src/FluentDOM/DOM/Node/ParentNode/Implementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,6 @@ abstract public function insertBefore(\DOMNode $newChild, \DOMNode $refChild = N

abstract public function appendChild(\DOMNode $newChild);

/**
* Returns the first element child node
* @return Element|NULL
*/
public function getFirstElementChild(): ?Element {
if ($this instanceof Document) {
return $this->documentElement;
}
$node = $this->firstChild;
while ($node instanceof \DOMNode) {
if ($node instanceof Element) {
return $node;
}
$node = $node->nextSibling;
}
return NULL;
}

/**
* Returns the last element child node
* @return Element|NULL
*/
public function getLastElementChild(): ?Element {
if ($this instanceof Document) {
return $this->documentElement;
}
/** @var \DOMNode $this */
$node = $this->lastChild;
while ($node instanceof \DOMNode) {
if ($node instanceof Element) {
return $node;
}
$node = $node->previousSibling;
}
return NULL;
}

/**
* Insert nodes before the first child node
*
Expand Down
70 changes: 0 additions & 70 deletions src/FluentDOM/DOM/Node/ParentNode/Properties.php

This file was deleted.

5 changes: 2 additions & 3 deletions src/FluentDOM/DOM/ProcessingInstruction.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
/*
* FluentDOM
*
* @link https://thomas.weinert.info/FluentDOM/
* @copyright Copyright 2009-2019 FluentDOM Contributors
* @copyright Copyright 2009-2023 FluentDOM Contributors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*
*/
Expand All @@ -24,7 +24,6 @@ class ProcessingInstruction
implements Node\NonDocumentTypeChildNode {

use Node\ChildNode\Implementation;
use Node\NonDocumentTypeChildNode\Properties;
use Node\StringCast;
use Node\Xpath;
}
Expand Down
5 changes: 2 additions & 3 deletions src/FluentDOM/DOM/Text.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
/*
* FluentDOM
*
* @link https://thomas.weinert.info/FluentDOM/
* @copyright Copyright 2009-2019 FluentDOM Contributors
* @copyright Copyright 2009-2023 FluentDOM Contributors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*
*/
Expand All @@ -24,7 +24,6 @@ class Text
implements Node\NonDocumentTypeChildNode {

use Node\ChildNode\Implementation;
use Node\NonDocumentTypeChildNode\Properties;
use Node\StringCast;
use Node\WholeText;
use Node\Xpath;
Expand Down
Loading

0 comments on commit c4136e0

Please sign in to comment.