ChildNodeForwardCompatibility   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 6
eloc 7
c 1
b 1
f 0
dl 0
loc 26
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A replaceWith() 0 5 2
A after() 0 5 2
A before() 0 5 2
1
<?php declare(strict_types=1);
2
3
/**
4
* @package   s9e\SweetDOM
5
* @copyright Copyright (c) The s9e authors
6
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
7
*/
8
namespace s9e\SweetDOM\NodeTraits;
9
10
trait ChildNodeForwardCompatibility
11
{
12
	// https://github.com/php/php-src/pull/11905 - behaviour changed in 8.3.0
13
	public function after(...$nodes): void
14
	{
15
		if (isset($this->parentNode))
16
		{
17
			parent::after(...$nodes);
18
		}
19
	}
20
21
	// https://github.com/php/php-src/pull/11905
22
	public function before(...$nodes): void
23
	{
24
		if (isset($this->parentNode))
25
		{
26
			parent::before(...$nodes);
27
		}
28
	}
29
30
	// https://github.com/php/php-src/pull/11905
31
	public function replaceWith(...$nodes): void
32
	{
33
		if (isset($this->parentNode))
34
		{
35
			parent::replaceWith(...$nodes);
36
		}
37
	}
38
}