Skip to content

Commit 6d9bf02

Browse files
committed
Fix some issues running workshop
1 parent d2fd051 commit 6d9bf02

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

app/config.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22

3+
use function DI\create;
34
use function DI\factory;
45
use function DI\object;
5-
use Interop\Container\ContainerInterface;
6+
use Psr\Container\ContainerInterface;
67
use PhpParser\Parser;
78
use PhpSchool\LearnYouPhp\Exercise\ArrayWeGo;
89
use PhpSchool\LearnYouPhp\Exercise\BabySteps;
@@ -22,9 +23,9 @@
2223

2324
return [
2425
//Exercises
25-
BabySteps::class => object(BabySteps::class),
26-
HelloWorld::class => object(HelloWorld::class),
27-
HttpJsonApi::class => object(HttpJsonApi::class),
26+
BabySteps::class => create(BabySteps::class),
27+
HelloWorld::class => create(HelloWorld::class),
28+
HttpJsonApi::class => create(HttpJsonApi::class),
2829
MyFirstIo::class => factory(function (ContainerInterface $c) {
2930
return new MyFirstIo($c->get(Filesystem::class), FakerFactory::create());
3031
}),
@@ -34,7 +35,6 @@
3435
ConcernedAboutSeparation::class => factory(function (ContainerInterface $c) {
3536
return new ConcernedAboutSeparation(
3637
$c->get(Filesystem::class),
37-
FakerFactory::create(),
3838
$c->get(Parser::class)
3939
);
4040
}),
@@ -57,11 +57,11 @@
5757
'eventListeners' => [
5858
'create-solution-for-first-exercise' => [
5959
'exercise.selected.hello-world' => [
60-
function () {
61-
if (!file_exists('hello-world.php')) {
62-
touch('hello-world.php');
60+
DI\value(function () {
61+
if (!file_exists(getcwd() . '/hello-world.php')) {
62+
touch(getcwd() . '/hello-world.php');
6363
}
64-
}
64+
})
6565
]
6666
]
6767
]

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@
3333
"bin": ["bin/learnyouphp"],
3434
"scripts" : {
3535
"test": [
36-
"phpunit",
37-
"@cs"
36+
"@unit-tests",
37+
"@cs",
38+
"@static"
3839
],
40+
"unit-tests": "simple-phpunit",
3941
"cs" : [
4042
"phpcs src --standard=PSR12",
4143
"phpcs test --standard=PSR12"

0 commit comments

Comments
 (0)