another PHPStan fix

This commit is contained in:
Joby 2023-09-10 21:08:27 +00:00
parent 632ca047b8
commit f03493c8ff
2 changed files with 6 additions and 6 deletions

View file

@ -33,7 +33,7 @@ trait ContainerTrait
NodeInterface|Stringable|string $child, NodeInterface|Stringable|string $child,
bool $prepend = false, bool $prepend = false,
bool $skip_sanitize = false bool $skip_sanitize = false
): self { ): static {
$child = $this->prepareChildToAdd($child, $skip_sanitize); $child = $this->prepareChildToAdd($child, $skip_sanitize);
if ($prepend) { if ($prepend) {
array_unshift($this->children, $child); array_unshift($this->children, $child);
@ -45,7 +45,7 @@ trait ContainerTrait
public function removeChild( public function removeChild(
NodeInterface|Stringable|string $child NodeInterface|Stringable|string $child
): self { ): static {
$this->children = array_filter( $this->children = array_filter(
$this->children, $this->children,
function (NodeInterface $e) use ($child) { function (NodeInterface $e) use ($child) {
@ -67,7 +67,7 @@ trait ContainerTrait
NodeInterface|Stringable|string $new_child, NodeInterface|Stringable|string $new_child,
NodeInterface|Stringable|string $before_child, NodeInterface|Stringable|string $before_child,
bool $skip_sanitize = false bool $skip_sanitize = false
): self { ): static {
$i = $this->indexOfChild($before_child); $i = $this->indexOfChild($before_child);
if ($i === null) { if ($i === null) {
throw new Exception('Reference child not found in this container'); throw new Exception('Reference child not found in this container');
@ -81,7 +81,7 @@ trait ContainerTrait
NodeInterface|Stringable|string $new_child, NodeInterface|Stringable|string $new_child,
NodeInterface|Stringable|string $after_child, NodeInterface|Stringable|string $after_child,
bool $skip_sanitize = false bool $skip_sanitize = false
): self { ): static {
$i = $this->indexOfChild($after_child); $i = $this->indexOfChild($after_child);
if ($i === null) { if ($i === null) {
throw new Exception('Reference child not found in this container'); throw new Exception('Reference child not found in this container');

View file

@ -20,7 +20,7 @@ trait NodeTrait
return $this->parent; return $this->parent;
} }
public function setParent(null|ContainerInterface $parent): self public function setParent(null|ContainerInterface $parent): static
{ {
$this->parent = $parent; $this->parent = $parent;
return $this; return $this;
@ -47,7 +47,7 @@ trait NodeTrait
} }
} }
public function detachCopy(): self public function detachCopy(): static
{ {
static $copier; static $copier;
$copier = $copier ?? new DeepCopy(); $copier = $copier ?? new DeepCopy();