|
1 | 1 | <?php
|
2 | 2 |
|
3 | 3 | use Colors\Color;
|
4 |
| -use function DI\object; |
| 4 | +use function DI\create; |
5 | 5 | use function DI\factory;
|
6 | 6 | use Kadet\Highlighter\KeyLighter;
|
7 | 7 | use function PhpSchool\PhpWorkshop\Event\containerListener;
|
8 |
| -use Interop\Container\ContainerInterface; |
| 8 | +use Psr\Container\ContainerInterface; |
9 | 9 | use League\CommonMark\DocParser;
|
10 | 10 | use League\CommonMark\Environment;
|
11 | 11 | use PhpParser\PrettyPrinter\Standard;
|
12 | 12 | use PhpSchool\CliMenu\Terminal\TerminalFactory;
|
13 |
| -use PhpSchool\CliMenu\Terminal\TerminalInterface; |
| 13 | +use PhpSchool\Terminal\Terminal; |
14 | 14 | use PhpParser\Parser;
|
15 | 15 | use PhpParser\ParserFactory;
|
16 | 16 | use PhpSchool\PhpWorkshop\Check\CheckRepository;
|
|
90 | 90 | $c->get(CheckRepository::class)
|
91 | 91 | );
|
92 | 92 | },
|
93 |
| - ResultAggregator::class => object(ResultAggregator::class), |
| 93 | + ResultAggregator::class => create(ResultAggregator::class), |
94 | 94 | CheckRepository::class => function (ContainerInterface $c) {
|
95 | 95 | return new CheckRepository([
|
96 | 96 | $c->get(FileExistsCheck::class),
|
|
123 | 123 | return $colors;
|
124 | 124 | },
|
125 | 125 | OutputInterface::class => function (ContainerInterface $c) {
|
126 |
| - return new StdOutput($c->get(Color::class), $c->get(TerminalInterface::class)); |
| 126 | + return new StdOutput($c->get(Color::class), $c->get(Terminal::class)); |
127 | 127 | },
|
128 | 128 |
|
129 | 129 | ExerciseRepository::class => function (ContainerInterface $c) {
|
|
135 | 135 | },
|
136 | 136 |
|
137 | 137 | EventDispatcher::class => factory(EventDispatcherFactory::class),
|
138 |
| - EventDispatcherFactory::class => object(), |
| 138 | + EventDispatcherFactory::class => create(), |
139 | 139 |
|
140 | 140 | //Exercise Runners
|
141 | 141 | RunnerManager::class => function (ContainerInterface $c) {
|
|
199 | 199 | },
|
200 | 200 |
|
201 | 201 | //Listeners
|
202 |
| - PrepareSolutionListener::class => object(), |
| 202 | + PrepareSolutionListener::class => create(), |
203 | 203 | CodePatchListener::class => function (ContainerInterface $c) {
|
204 | 204 | return new CodePatchListener($c->get(CodePatcher::class));
|
205 | 205 | },
|
|
216 | 216 | $c->get(RunnerManager::class)
|
217 | 217 | );
|
218 | 218 | },
|
219 |
| - RealPathListener::class => object(), |
| 219 | + RealPathListener::class => create(), |
220 | 220 |
|
221 | 221 | //checks
|
222 |
| - FileExistsCheck::class => object(), |
223 |
| - PhpLintCheck::class => object(), |
| 222 | + FileExistsCheck::class => create(), |
| 223 | + PhpLintCheck::class => create(), |
224 | 224 | CodeParseCheck::class => function (ContainerInterface $c) {
|
225 | 225 | return new CodeParseCheck($c->get(Parser::class));
|
226 | 226 | },
|
227 | 227 | FunctionRequirementsCheck::class => function (ContainerInterface $c) {
|
228 | 228 | return new FunctionRequirementsCheck($c->get(Parser::class));
|
229 | 229 | },
|
230 |
| - DatabaseCheck::class => object(), |
231 |
| - ComposerCheck::class => object(), |
| 230 | + DatabaseCheck::class => create(), |
| 231 | + ComposerCheck::class => create(), |
232 | 232 |
|
233 | 233 | //Utils
|
234 |
| - Filesystem::class => object(), |
| 234 | + Filesystem::class => create(), |
235 | 235 | Parser::class => function () {
|
236 | 236 | $parserFactory = new ParserFactory;
|
237 | 237 | return $parserFactory->create(ParserFactory::PREFER_PHP7);
|
|
247 | 247 | FakerGenerator::class => function () {
|
248 | 248 | return FakerFactory::create();
|
249 | 249 | },
|
250 |
| - RequestRenderer::class => object(), |
| 250 | + RequestRenderer::class => create(), |
251 | 251 |
|
252 |
| - TerminalInterface::class => factory([TerminalFactory::class, 'fromSystem']), |
| 252 | + Terminal::class => factory([TerminalFactory::class, 'fromSystem']), |
253 | 253 | 'menu' => factory(MenuFactory::class),
|
254 |
| - MenuFactory::class => object(), |
| 254 | + MenuFactory::class => create(), |
255 | 255 | ExerciseRenderer::class => function (ContainerInterface $c) {
|
256 | 256 | return new ExerciseRenderer(
|
257 | 257 | $c->get('appName'),
|
@@ -307,7 +307,7 @@ function (CgiResult $result) use ($c) {
|
307 | 307 | return new ResultsRenderer(
|
308 | 308 | $c->get('appName'),
|
309 | 309 | $c->get(Color::class),
|
310 |
| - $c->get(TerminalInterface::class), |
| 310 | + $c->get(Terminal::class), |
311 | 311 | $c->get(ExerciseRepository::class),
|
312 | 312 | $c->get(KeyLighter::class),
|
313 | 313 | $c->get(ResultRendererFactory::class)
|
|
0 commit comments