update deps & install rector

This commit is contained in:
Dominik Liebler
2019-12-14 12:50:05 +01:00
parent 04acce6759
commit 579a5ac946
87 changed files with 2432 additions and 786 deletions

View File

@@ -2,6 +2,8 @@
namespace DesignPatterns\Behavioral\Memento;
use InvalidArgumentException;
class State
{
const STATE_CREATED = 'created';
@@ -9,24 +11,18 @@ class State
const STATE_ASSIGNED = 'assigned';
const STATE_CLOSED = 'closed';
/**
* @var string
*/
private $state;
private string $state;
/**
* @var string[]
*/
private static $validStates = [
private static array $validStates = [
self::STATE_CREATED,
self::STATE_OPENED,
self::STATE_ASSIGNED,
self::STATE_CLOSED,
];
/**
* @param string $state
*/
public function __construct(string $state)
{
self::ensureIsValidState($state);
@@ -37,7 +33,7 @@ class State
private static function ensureIsValidState(string $state)
{
if (!in_array($state, self::$validStates)) {
throw new \InvalidArgumentException('Invalid state given');
throw new InvalidArgumentException('Invalid state given');
}
}