Skip to content

Commit fbd65c8

Browse files
committed
Use arrow function when possible
1 parent 806c790 commit fbd65c8

14 files changed

Lines changed: 29 additions & 81 deletions

File tree

apps/backoffice/backend/src/BackofficeBackendKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Backend;
66

apps/backoffice/backend/src/Controller/Courses/CoursesGetController.php

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

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Backend\Controller\Courses;
66

@@ -35,20 +35,16 @@ public function __invoke(Request $request): JsonResponse
3535
);
3636

3737
return new JsonResponse(
38-
map($this->toArray(), $response->courses()),
38+
map(
39+
fn(BackofficeCourseResponse $course) => [
40+
'id' => $course->id(),
41+
'name' => $course->name(),
42+
'duration' => $course->duration(),
43+
],
44+
$response->courses()
45+
),
3946
200,
4047
['Access-Control-Allow-Origin' => '*']
4148
);
4249
}
43-
44-
private function toArray(): callable
45-
{
46-
return static function (BackofficeCourseResponse $course) {
47-
return [
48-
'id' => $course->id(),
49-
'name' => $course->name(),
50-
'duration' => $course->duration(),
51-
];
52-
};
53-
}
5450
}

apps/backoffice/backend/src/Controller/HealthCheck/HealthCheckGetController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Backend\Controller\HealthCheck;
66

apps/backoffice/frontend/src/BackofficeFrontendKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Frontend;
66

apps/backoffice/frontend/src/Command/ImportCoursesToElasticsearchCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Frontend\Command;
66

apps/backoffice/frontend/src/Controller/Courses/CoursesGetWebController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Frontend\Controller\Courses;
66

apps/backoffice/frontend/src/Controller/Courses/CoursesPostWebController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Frontend\Controller\Courses;
66

apps/backoffice/frontend/src/Controller/HealthCheck/HealthCheckGetController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Frontend\Controller\HealthCheck;
66

apps/backoffice/frontend/src/Controller/Home/HomeGetWebController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace CodelyTv\Apps\Backoffice\Frontend\Controller\Home;
66

apps/mooc/backend/src/Command/DomainEvents/MySql/ConsumeMySqlDomainEventsCommand.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
4444
{
4545
$quantityEventsToProcess = (int) $input->getArgument('quantity');
4646

47-
$consumer = pipe($this->consumer(), $this->clearConnections());
47+
$consumer = pipe($this->consumer(), fn() => $this->connections->clear());
4848

4949
$this->consumer->consume($consumer, $quantityEventsToProcess);
5050
}
@@ -59,11 +59,4 @@ private function consumer(): callable
5959
}
6060
};
6161
}
62-
63-
private function clearConnections(): callable
64-
{
65-
return function () {
66-
$this->connections->clear();
67-
};
68-
}
6962
}

0 commit comments

Comments
 (0)