Skip to content

Commit ad0bcb6

Browse files
committed
little cleanup
1 parent 60e154c commit ad0bcb6

File tree

5 files changed

+6
-94
lines changed

5 files changed

+6
-94
lines changed

app/config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ function (CgiResult $result) use ($c) {
399399
'cli.run.start' => [
400400
containerListener(CodePatchListener::class, 'patch'),
401401
],
402-
'cli.run.finish' => [
402+
'cli.ruCodePatchListenern.finish' => [
403403
containerListener(CodePatchListener::class, 'revert'),
404404
],
405405
'cgi.verify.start' => [

src/Application.php

+3-21
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ public function __construct(string $workshopTitle, string $diConfigFile)
8686

8787
$this->workshopTitle = $workshopTitle;
8888
$this->diConfigFile = $diConfigFile;
89-
90-
set_error_handler([$this, 'handleInternalError']);
9189
}
9290

9391
/**
@@ -196,17 +194,13 @@ public function configure(): ContainerInterface
196194
}
197195
}
198196

199-
$tearDown = function () use ($container): bool {
200-
// TODO: This works.. but wrong event as PatchListener take ExerciseRunnerEvent
197+
set_error_handler(function () use ($container): bool {
201198
$container
202199
->get(EventDispatcher::class)
203200
->dispatch(new Event('application.tear-down'));
204201

205-
// Fallback to default error handler
206-
return false;
207-
};
208-
209-
set_error_handler($tearDown);
202+
return false; // Use default error handler
203+
});
210204

211205
return $container;
212206
}
@@ -288,16 +282,4 @@ private function getContainer(): Container
288282

289283
return $containerBuilder->build();
290284
}
291-
292-
private function handleInternalError(
293-
int $errno,
294-
string $errstr,
295-
string $errfile,
296-
int $errline
297-
): bool {
298-
299-
300-
301-
return false;
302-
}
303285
}

src/Listener/CodePatchListener.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ public function patch(ExerciseRunnerEvent $event): void
4747
$files[] = $exercise->getSolution()->getEntryPoint();
4848
}
4949

50-
foreach ($files as $fileName) {
51-
if (null === $fileName) {
52-
return;
53-
}
54-
50+
foreach (array_filter($files) as $fileName) {
5551
$this->originalCode[$fileName] = (string) file_get_contents($fileName);
5652

5753
file_put_contents(

src/Listener/InMemorySolutionListener.php

-66
This file was deleted.

src/Solution/InMemorySolution.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static function fromSolution(SolutionInterface $solution)
6666
}
6767

6868
/**
69-
* Get the entry point. This is the PHP file that PHO would execute in order to run the
69+
* Get the entry point. This is the PHP file that PHP would execute in order to run the
7070
* program. This should be the absolute path.
7171
*
7272
* @return string

0 commit comments

Comments
 (0)