From aae5dd9263352308ef9bbb5d2c89e2ce77a0a4a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 22 Sep 2020 11:39:48 +0200 Subject: [PATCH] Fix: Extract private constructor --- test/Util/Scenario.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/Util/Scenario.php b/test/Util/Scenario.php index 7dc3e189..4c135f6a 100644 --- a/test/Util/Scenario.php +++ b/test/Util/Scenario.php @@ -25,14 +25,18 @@ final class Scenario */ private $initialState; - public static function fromCommandInvocationAndInitialState(CommandInvocation $commandInvocation, State $initialState): self + private function __construct(CommandInvocation $commandInvocation, State $initialState) { - $scenario = new self(); - - $scenario->commandInvocation = $commandInvocation; - $scenario->initialState = $initialState; + $this->commandInvocation = $commandInvocation; + $this->initialState = $initialState; + } - return $scenario; + public static function fromCommandInvocationAndInitialState(CommandInvocation $commandInvocation, State $initialState): self + { + return new self( + $commandInvocation, + $initialState + ); } public function directory(): Directory