From 84c1f7b973c79548fff822b03868694c7df8a16a Mon Sep 17 00:00:00 2001 From: programmer Date: Mon, 31 Aug 2020 22:54:26 +0300 Subject: [PATCH] Add psalm annotations to MessInterface, fix annotations of MissingMess --- src/MessInterface.php | 249 +++++++++++++++++++++++++++++++++++++++++- src/MissingMess.php | 26 +++-- 2 files changed, 262 insertions(+), 13 deletions(-) diff --git a/src/MessInterface.php b/src/MessInterface.php index 974de7b..dd88708 100644 --- a/src/MessInterface.php +++ b/src/MessInterface.php @@ -7,61 +7,308 @@ interface MessInterface extends ArrayAccess { + + /** + * @psalm-pure + * + * @return int + */ public function getInt(): int; + + /** + * @psalm-pure + * + * @return bool + */ public function getBool(): bool; + + /** + * @psalm-pure + * + * @return string + */ public function getString(): string; + + /** + * @psalm-pure + * @psalm-return list + * + * @return array + */ public function getListOfInt(): array; + + /** + * @psalm-pure + * @psalm-return list + * + * @return array + */ public function getListOfString(): array; + + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ public function getArrayOfStringToInt(): array; + + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ public function getArrayOfStringToBool(): array; + + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ public function getArrayOfStringToString(): array; + /** + * @psalm-pure + * + * @return int + */ public function getAsInt(): int; + + /** + * @psalm-pure + * + * @return bool + */ public function getAsBool(): bool; + + /** + * @psalm-pure + * + * @return string + */ public function getAsString(): string; + + /** + * @psalm-pure + * @psalm-return list + * + * @return array + */ public function getAsListOfInt(): array; + + /** + * @psalm-pure + * @psalm-return list + * + * @return array + */ public function getAsListOfString(): array; + + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ public function getAsArrayOfStringToInt(): array; + + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ public function getAsArrayOfStringToBool(): array; + + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ public function getAsArrayOfStringToString(): array; + + /** + * @psalm-pure + * + * @return int|null + */ public function findInt(): ?int; + + /** + * @psalm-pure + * + * @return bool|null + */ public function findBool(): ?bool; + + /** + * @psalm-pure + * + * @return string|null + */ public function findString(): ?string; + + /** + * @psalm-pure + * @psalm-return list|null + * + * @return array|null + */ public function findListOfInt(): ?array; + + /** + * @psalm-pure + * @psalm-return list|null + * + * @return array|null + */ public function findListOfString(): ?array; + + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ public function findArrayOfStringToInt(): ?array; + + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ public function findArrayOfStringToBool(): ?array; + + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ public function findArrayOfStringToString(): ?array; + + /** + * @psalm-pure + * + * @return int|null + */ public function findAsInt(): ?int; + + /** + * @psalm-pure + * + * @return bool|null + */ public function findAsBool(): ?bool; + + /** + * @psalm-pure + * + * @return string|null + */ public function findAsString(): ?string; + + /** + * @psalm-return list|null + * + * @return array|null + */ public function findAsListOfInt(): ?array; + + /** + * @psalm-return list|null + * + * @return array|null + */ public function findAsListOfString(): ?array; + + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ public function findAsArrayOfStringToInt(): ?array; + + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ public function findAsArrayOfStringToBool(): ?array; + + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ public function findAsArrayOfStringToString(): ?array; + /** + * @psalm-pure + * * @return mixed */ public function getMixed(); + + /** + * @return object + */ public function getObject(): object; + + /** + * @return array + */ public function getArray(): array; + + /** + * @psalm-pure + * @psalm-return array + * + * @return array + */ public function getArrayOfStringToMixed(): array; + /** + * @psalm-pure + * * @return mixed */ public function findMixed(); + + /** + * @return object|null + */ public function findObject(): ?object; + + /** + * @return array|null + */ public function findArray(): ?array; + + /** + * @psalm-pure + * @psalm-return array|null + * + * @return array|null + */ public function findArrayOfStringToMixed(): ?array; /** + * @psalm-pure + * * @param string|int $offset - * @return self + * @return MessInterface */ public function offsetGet($offset); } \ No newline at end of file diff --git a/src/MissingMess.php b/src/MissingMess.php index 3d14e80..2a9402e 100644 --- a/src/MissingMess.php +++ b/src/MissingMess.php @@ -86,7 +86,7 @@ public function getListOfString(): array /** * @psalm-pure - * @psalm-return list + * @psalm-return array * * @return array */ @@ -97,7 +97,7 @@ public function getArrayOfStringToInt(): array /** * @psalm-pure - * @psalm-return list + * @psalm-return array * * @return array */ @@ -108,7 +108,7 @@ public function getArrayOfStringToBool(): array /** * @psalm-pure - * @psalm-return list + * @psalm-return array * * @return array */ @@ -171,7 +171,7 @@ public function getAsListOfString(): array /** * @psalm-pure - * @psalm-return list + * @psalm-return array * * @return array */ @@ -182,7 +182,7 @@ public function getAsArrayOfStringToInt(): array /** * @psalm-pure - * @psalm-return list + * @psalm-return array * * @return array */ @@ -193,7 +193,7 @@ public function getAsArrayOfStringToBool(): array /** * @psalm-pure - * @psalm-return list + * @psalm-return array * * @return array */ @@ -256,7 +256,7 @@ public function findListOfString(): ?array /** * @psalm-pure - * @psalm-return list + * @psalm-return array|null * * @return array|null */ @@ -267,7 +267,7 @@ public function findArrayOfStringToInt(): ?array /** * @psalm-pure - * @psalm-return list + * @psalm-return array|null * * @return array|null */ @@ -278,7 +278,7 @@ public function findArrayOfStringToBool(): ?array /** * @psalm-pure - * @psalm-return list + * @psalm-return array|null * * @return array|null */ @@ -341,7 +341,7 @@ public function findAsListOfString(): ?array /** * @psalm-pure - * @psalm-return list + * @psalm-return array|null * * @return array|null */ @@ -352,7 +352,7 @@ public function findAsArrayOfStringToInt(): ?array /** * @psalm-pure - * @psalm-return list + * @psalm-return array|null * * @return array|null */ @@ -363,7 +363,7 @@ public function findAsArrayOfStringToBool(): ?array /** * @psalm-pure - * @psalm-return list + * @psalm-return array|null * * @return array|null */ @@ -404,6 +404,7 @@ public function getArray(): array /** * @psalm-pure + * @psalm-return array * * @return array */ @@ -444,6 +445,7 @@ public function findArray(): ?array /** * @psalm-pure + * @psalm-return array|null * * @return array|null */