Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  use psalm 5
  mention the hash is a non empty string
  • Loading branch information
Baptouuuu committed May 18, 2023
2 parents c79062c + af536a2 commit fbd7342
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.3.0 - 2023-05-18

### Changed

- `Innmind\Hash\Value::hex()` return type is `non-empty-string`

## 1.2.0 - 2023-01-25

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"require-dev": {
"phpunit/phpunit": "~9.5",
"vimeo/psalm": "~4.21",
"vimeo/psalm": "~5.11",
"innmind/black-box": "~4.10",
"innmind/coding-standard": "~2.0"
}
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<psalm
errorLevel="1"
resolveFromConfigFile="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
1 change: 1 addition & 0 deletions src/Incremental.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static function start(Hash $hash): self
*/
public function add(Str $chunk): self
{
/** @psalm-suppress ImpureFunctionCall */
$_ = \hash_update($this->context, $chunk->toString());

return $this;
Expand Down
9 changes: 9 additions & 0 deletions src/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,30 @@
*/
final class Value
{
/** @var non-empty-string */
private string $hex;

/**
* @param non-empty-string $hex
*/
private function __construct(string $hex)
{
$this->hex = $hex;
}

/**
* @psalm-pure
*
* @param non-empty-string $hex
*/
public static function of(string $hex): self
{
return new self($hex);
}

/**
* @return non-empty-string
*/
public function hex(): string
{
return $this->hex;
Expand Down

0 comments on commit fbd7342

Please sign in to comment.