From 0bfd00fd40fb050689dca50610d85bbc010450e4 Mon Sep 17 00:00:00 2001 From: Artem Zakirullin Date: Sat, 1 Aug 2020 21:31:37 +0300 Subject: [PATCH] fix get/find arrayOfStringToMixed --- CHANGELOG.md | 5 ++++ src/Mess.php | 60 +++++++++++++++++++++---------------------- src/MessInterface.php | 2 ++ src/MissingMess.php | 20 +++++++++++++++ 4 files changed, 57 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8109fcc..d3aefbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.5.1] - 2020-08-01 +### Added +- `getArrayOfStringToMixed()` +- `findArrayOfStringToMixed()` + ## [0.5.0] - 2020-08-01 ### Added - It is Mess now 🍺 diff --git a/src/Mess.php b/src/Mess.php index 6e6ea79..a70cffd 100644 --- a/src/Mess.php +++ b/src/Mess.php @@ -175,22 +175,6 @@ public function getArrayOfStringToString(): array return $this->value; } - /** - * @psalm-pure - * @psalm-return array - * - * @return array - */ - public function getArrayOfStringToMixed(): array - { - $this->assertType($this->findArrayOfStringToMixed(), TypeEnum::ARRAY_OF_STRING_TO_MIXED); - - /** - * @psalm-var array - */ - return $this->value; - } - /** * @psalm-pure * @@ -423,20 +407,6 @@ public function findArrayOfStringToString(): ?array return ArrayOfStringToTypeFinder::find($this->value, 'is_string'); } - /** - * @psalm-pure - * @psalm-return array|null - * - * @return array|null - */ - public function findArrayOfStringToMixed(): ?array - { - /** - * @psalm-var array|null - */ - return ArrayOfStringToMixedFinder::find($this->value); - } - /** * @psalm-pure * @@ -571,6 +541,22 @@ public function getArray(): array return $this->value; } + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ + public function getArrayOfStringToMixed(): array + { + $this->assertType($this->findArrayOfStringToMixed(), TypeEnum::ARRAY_OF_STRING_TO_MIXED); + + /** + * @psalm-var array + */ + return $this->value; + } + /** * @psalm-pure * @@ -605,6 +591,20 @@ public function findArray(): ?array return $this->value; } + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ + public function findArrayOfStringToMixed(): ?array + { + /** + * @psalm-var array|null + */ + return ArrayOfStringToMixedFinder::find($this->value); + } + /** * @psalm-pure * diff --git a/src/MessInterface.php b/src/MessInterface.php index 14bebfe..974de7b 100644 --- a/src/MessInterface.php +++ b/src/MessInterface.php @@ -49,6 +49,7 @@ public function findAsArrayOfStringToString(): ?array; public function getMixed(); public function getObject(): object; public function getArray(): array; + public function getArrayOfStringToMixed(): array; /** * @return mixed @@ -56,6 +57,7 @@ public function getArray(): array; public function findMixed(); public function findObject(): ?object; public function findArray(): ?array; + public function findArrayOfStringToMixed(): ?array; /** * @param string|int $offset diff --git a/src/MissingMess.php b/src/MissingMess.php index 0e84f9e..3d14e80 100644 --- a/src/MissingMess.php +++ b/src/MissingMess.php @@ -402,6 +402,16 @@ public function getArray(): array throw new MissingKeyException($this->keySequence); } + /** + * @psalm-pure + * + * @return array + */ + public function getArrayOfStringToMixed(): array + { + throw new MissingKeyException($this->keySequence); + } + /** * @psalm-pure * @@ -432,6 +442,16 @@ public function findArray(): ?array return null; } + /** + * @psalm-pure + * + * @return array|null + */ + public function findArrayOfStringToMixed(): ?array + { + return null; + } + /** * @psalm-pure * @param mixed $offset