File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,15 @@ public function __construct($workshopTitle, $diConfigFile)
6666 }
6767
6868 /**
69- * @param CheckInterface $check
69+ * @param string $check
7070 */
71- public function addCheck (CheckInterface $ check )
71+ public function addCheck ($ check )
7272 {
7373 $ this ->checks [] = $ check ;
7474 }
7575
7676 /**
77- * @param ExerciseInterface $exercise
77+ * @param string $exercise
7878 */
7979 public function addExercise ($ exercise )
8080 {
@@ -141,9 +141,15 @@ public function run()
141141 }
142142
143143 $ checkRepository = $ container ->get (CheckRepository::class);
144- array_walk ($ this ->checks , function (CheckInterface $ check ) use ($ checkRepository ) {
145- $ checkRepository ->registerCheck ($ check );
146- });
144+ foreach ($ this ->checks as $ check ) {
145+ if (false === $ container ->has ($ check )) {
146+ throw new \RuntimeException (
147+ sprintf ('No DI config found for check: "%s". Register a factory. ' , $ check )
148+ );
149+ }
150+
151+ $ checkRepository ->registerCheck ($ container ->get ($ check ));
152+ }
147153
148154 try {
149155 $ exitCode = $ container ->get (CommandRouter::class)->route ();
You can’t perform that action at this time.
0 commit comments