Skip to content

Commit

Permalink
add more purity and immutable markers
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed May 5, 2020
1 parent b0fb3f5 commit 9788bb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Async/EventStoreConnection.php
Expand Up @@ -43,6 +43,7 @@ interface EventStoreConnection
{
public function connectionName(): string;

/** @return Promise<void> */
public function connectAsync(): Promise;

public function close(): void;
Expand Down
5 changes: 5 additions & 0 deletions src/EndPoint.php
Expand Up @@ -13,6 +13,7 @@

namespace Prooph\EventStore;

/** @psalm-immutable */
class EndPoint
{
private string $host;
Expand All @@ -24,21 +25,25 @@ public function __construct(string $host, int $port)
$this->port = $port;
}

/** @psalm-pure */
public function host(): string
{
return $this->host;
}

/** @psalm-pure */
public function port(): int
{
return $this->port;
}

/** @psalm-pure */
public function equals(EndPoint $endPoint): bool
{
return $this->host === $endPoint->host && $this->port === $endPoint->port;
}

/** @psalm-pure */
public function __toString(): string
{
return $this->host . ':' . $this->port;
Expand Down
3 changes: 3 additions & 0 deletions src/UserCredentials.php
Expand Up @@ -15,6 +15,7 @@

use Prooph\EventStore\Exception\InvalidArgumentException;

/** @psalm-immutable */
class UserCredentials
{
private string $username;
Expand All @@ -34,11 +35,13 @@ public function __construct(string $username, string $password)
$this->password = $password;
}

/** @psalm-pure */
public function username(): string
{
return $this->username;
}

/** @psalm-pure */
public function password(): string
{
return $this->password;
Expand Down

0 comments on commit 9788bb0

Please sign in to comment.