From b26b24f356862415a8e30bd39811247e6bc265f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=BDoljom?= Date: Sun, 5 Oct 2025 20:51:05 +0200 Subject: [PATCH] Fix type assignment errors in element construction --- src/Elements/AbstractElement.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Elements/AbstractElement.php b/src/Elements/AbstractElement.php index 033a8b5..adbfbbc 100644 --- a/src/Elements/AbstractElement.php +++ b/src/Elements/AbstractElement.php @@ -90,12 +90,16 @@ abstract class AbstractElement implements Element 'dir' => 'auto', ]; + /** + * @param array|null $attributes + * @param array|null $childNodes + */ public function __construct(?array $attributes = [], string $content = '', ?array $childNodes = []) { $this->attributes = $this->formatAttributes( $this->defaultAttributes, $this->allowedAttributes, - $attributes, + $attributes ?? [], ); $this->content = $content; @@ -351,10 +355,16 @@ protected function widthParser($width, $options = []): array ]; } + /** + * @param array $defaultAttributes + * @param array> $allowedAttributes + * @param array $passedAttributes + * @return array + */ private function formatAttributes( array $defaultAttributes, array $allowedAttributes, - ?array $passedAttributes = [] + array $passedAttributes = [] ): array { /* * Check if the attributes are of the proper format based on the allowed attributes.