From 91d7f88a56ab1d256667c6b79f488b55ee32f952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=BDoljom?= Date: Sun, 5 Oct 2025 20:22:57 +0200 Subject: [PATCH] Add explicit return type declarations --- src/Elements/AbstractElement.php | 5 ++++- src/ParserFactory.php | 1 + src/Validation/TypeValidator.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Elements/AbstractElement.php b/src/Elements/AbstractElement.php index d6de6a8..033a8b5 100644 --- a/src/Elements/AbstractElement.php +++ b/src/Elements/AbstractElement.php @@ -147,6 +147,9 @@ public function getAllowedAttributeData(string $attributeName, string $attribute return $this->allowedAttributes[$attributeName][$attributeProperty]; } + /** + * @return array + */ public function getChildContext(): array { return $this->context; @@ -171,7 +174,7 @@ public function getGlobalAttributes(): array return $this->globalAttributes; } - public function setGlobalAttributes($attribute, $value): void + public function setGlobalAttributes(string $attribute, mixed $value): void { $this->globalAttributes[$attribute] = $value; } diff --git a/src/ParserFactory.php b/src/ParserFactory.php index 667083a..8b7cf78 100644 --- a/src/ParserFactory.php +++ b/src/ParserFactory.php @@ -31,6 +31,7 @@ final class ParserFactory */ public static function create(): Parser { + /** @var Parser|null $instance */ static $instance = null; if ($instance === null) { diff --git a/src/Validation/TypeValidator.php b/src/Validation/TypeValidator.php index d969381..16eae2c 100644 --- a/src/Validation/TypeValidator.php +++ b/src/Validation/TypeValidator.php @@ -180,7 +180,7 @@ public function isTextTransform(string $transform): bool return isset($this->allowedTextTransform[$transform]); } - public function getValidator(string $validatorType) + public function getValidator(string $validatorType): Validatable { $validatorClassName = __NAMESPACE__ . '\\Validators\\' . ucwords($validatorType) . 'Validator';