From f03493c8ff3ac60fe5a12a6afed111c27a383595 Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Sun, 10 Sep 2023 21:08:27 +0000 Subject: [PATCH] another PHPStan fix --- src/Traits/ContainerTrait.php | 8 ++++---- src/Traits/NodeTrait.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Traits/ContainerTrait.php b/src/Traits/ContainerTrait.php index f21315b..2f25ca0 100644 --- a/src/Traits/ContainerTrait.php +++ b/src/Traits/ContainerTrait.php @@ -33,7 +33,7 @@ trait ContainerTrait NodeInterface|Stringable|string $child, bool $prepend = false, bool $skip_sanitize = false - ): self { + ): static { $child = $this->prepareChildToAdd($child, $skip_sanitize); if ($prepend) { array_unshift($this->children, $child); @@ -45,7 +45,7 @@ trait ContainerTrait public function removeChild( NodeInterface|Stringable|string $child - ): self { + ): static { $this->children = array_filter( $this->children, function (NodeInterface $e) use ($child) { @@ -67,7 +67,7 @@ trait ContainerTrait NodeInterface|Stringable|string $new_child, NodeInterface|Stringable|string $before_child, bool $skip_sanitize = false - ): self { + ): static { $i = $this->indexOfChild($before_child); if ($i === null) { throw new Exception('Reference child not found in this container'); @@ -81,7 +81,7 @@ trait ContainerTrait NodeInterface|Stringable|string $new_child, NodeInterface|Stringable|string $after_child, bool $skip_sanitize = false - ): self { + ): static { $i = $this->indexOfChild($after_child); if ($i === null) { throw new Exception('Reference child not found in this container'); diff --git a/src/Traits/NodeTrait.php b/src/Traits/NodeTrait.php index 09e73be..11fc961 100644 --- a/src/Traits/NodeTrait.php +++ b/src/Traits/NodeTrait.php @@ -20,7 +20,7 @@ trait NodeTrait return $this->parent; } - public function setParent(null|ContainerInterface $parent): self + public function setParent(null|ContainerInterface $parent): static { $this->parent = $parent; return $this; @@ -47,7 +47,7 @@ trait NodeTrait } } - public function detachCopy(): self + public function detachCopy(): static { static $copier; $copier = $copier ?? new DeepCopy();