Skip to content

Commit

Permalink
fix get/find arrayOfStringToMixed
Browse files Browse the repository at this point in the history
  • Loading branch information
zakirullin committed Aug 1, 2020
1 parent eb61c29 commit 0bfd00f
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 30 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 🍺
Expand Down
60 changes: 30 additions & 30 deletions src/Mess.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,6 @@ public function getArrayOfStringToString(): array
return $this->value;
}

/**
* @psalm-pure
* @psalm-return array<string,mixed>
*
* @return array
*/
public function getArrayOfStringToMixed(): array
{
$this->assertType($this->findArrayOfStringToMixed(), TypeEnum::ARRAY_OF_STRING_TO_MIXED);

/**
* @psalm-var array<string,mixed>
*/
return $this->value;
}

/**
* @psalm-pure
*
Expand Down Expand Up @@ -423,20 +407,6 @@ public function findArrayOfStringToString(): ?array
return ArrayOfStringToTypeFinder::find($this->value, 'is_string');
}

/**
* @psalm-pure
* @psalm-return array<string,mixed>|null
*
* @return array|null
*/
public function findArrayOfStringToMixed(): ?array
{
/**
* @psalm-var array<string,string>|null
*/
return ArrayOfStringToMixedFinder::find($this->value);
}

/**
* @psalm-pure
*
Expand Down Expand Up @@ -571,6 +541,22 @@ public function getArray(): array
return $this->value;
}

/**
* @psalm-pure
* @psalm-return array<string,mixed>
*
* @return array
*/
public function getArrayOfStringToMixed(): array
{
$this->assertType($this->findArrayOfStringToMixed(), TypeEnum::ARRAY_OF_STRING_TO_MIXED);

/**
* @psalm-var array<string,mixed>
*/
return $this->value;
}

/**
* @psalm-pure
*
Expand Down Expand Up @@ -605,6 +591,20 @@ public function findArray(): ?array
return $this->value;
}

/**
* @psalm-pure
* @psalm-return array<string,mixed>|null
*
* @return array|null
*/
public function findArrayOfStringToMixed(): ?array
{
/**
* @psalm-var array<string,string>|null
*/
return ArrayOfStringToMixedFinder::find($this->value);
}

/**
* @psalm-pure
*
Expand Down
2 changes: 2 additions & 0 deletions src/MessInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ public function findAsArrayOfStringToString(): ?array;
public function getMixed();
public function getObject(): object;
public function getArray(): array;
public function getArrayOfStringToMixed(): array;

/**
* @return mixed
*/
public function findMixed();
public function findObject(): ?object;
public function findArray(): ?array;
public function findArrayOfStringToMixed(): ?array;

/**
* @param string|int $offset
Expand Down
20 changes: 20 additions & 0 deletions src/MissingMess.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0bfd00f

Please sign in to comment.