Skip to content

Commit 966edc2

Browse files
authored
feat: add easy code standard (#353)
* feat: add easy code standard * style: apply easy code standard * style: add new php cs fixer rules * style: apply new php cs fixer rules * style: apply new php cs fixer rules
1 parent b2aa094 commit 966edc2

169 files changed

Lines changed: 604 additions & 981 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.php-cs-fixer.dist.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static-analysis: composer-env-file
4949

5050
.PHONY: lint
5151
lint:
52-
docker exec codely-php_ddd_skeleton-mooc_backend-php ./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.dist.php --allow-risky=yes --dry-run
52+
docker exec codely-php_ddd_skeleton-mooc_backend-php ./vendor/bin/ecs check
5353

5454
.PHONY: run-tests
5555
run-tests: composer-env-file
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
4-
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
6+
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
57
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
68
// WouterJ\EloquentBundle\WouterJEloquentBundle::class => ['test' => true]
79
];

apps/backoffice/backend/public/index.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use CodelyTv\Apps\Backoffice\Backend\BackofficeBackendKernel;
46
use Symfony\Component\ErrorHandler\Debug;
57
use Symfony\Component\HttpFoundation\Request;
@@ -23,8 +25,8 @@
2325
Request::setTrustedHosts([$trustedHosts]);
2426
}
2527

26-
$kernel = new BackofficeBackendKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
27-
$request = Request::createFromGlobals();
28+
$kernel = new BackofficeBackendKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
29+
$request = Request::createFromGlobals();
2830
$response = $kernel->handle($request);
2931
$response->send();
3032
$kernel->terminate($request, $response);

apps/backoffice/backend/src/BackofficeBackendKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use function dirname;
1414

15-
final class BackofficeBackendKernel extends Kernel
15+
class BackofficeBackendKernel extends Kernel
1616
{
1717
use MicroKernelTrait;
1818

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,31 @@
1515

1616
final readonly class CoursesGetController
1717
{
18-
public function __construct(private QueryBus $queryBus)
19-
{
20-
}
18+
public function __construct(private QueryBus $queryBus) {}
2119

2220
public function __invoke(Request $request): JsonResponse
2321
{
2422
$orderBy = $request->query->get('order_by');
2523
$order = $request->query->get('order');
26-
$limit = $request->query->get('limit');
24+
$limit = $request->query->get('limit');
2725
$offset = $request->query->get('offset');
2826

2927
/** @var BackofficeCoursesResponse $response */
3028
$response = $this->queryBus->ask(
3129
new SearchBackofficeCoursesByCriteriaQuery(
3230
(array) $request->query->get('filters'),
33-
null === $orderBy ? null : (string) $orderBy,
34-
null === $order ? null : (string) $order,
35-
null === $limit ? null : (int) $limit,
36-
null === $offset ? null : (int) $offset
31+
$orderBy === null ? null : (string) $orderBy,
32+
$order === null ? null : (string) $order,
33+
$limit === null ? null : (int) $limit,
34+
$offset === null ? null : (int) $offset
3735
)
3836
);
3937

4038
return new JsonResponse(
4139
map(
4240
fn (BackofficeCourseResponse $course) => [
43-
'id' => $course->id(),
44-
'name' => $course->name(),
41+
'id' => $course->id(),
42+
'name' => $course->name(),
4543
'duration' => $course->duration(),
4644
],
4745
$response->courses()

apps/backoffice/backend/src/Controller/Metrics/MetricsController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212
final readonly class MetricsController
1313
{
14-
public function __construct(private PrometheusMonitor $monitor)
15-
{
16-
}
14+
public function __construct(private PrometheusMonitor $monitor) {}
1715

1816
public function __invoke(Request $request): Response
1917
{
2018
$renderer = new RenderTextFormat();
21-
$result = $renderer->render($this->monitor->registry()->getMetricFamilySamples());
19+
$result = $renderer->render($this->monitor->registry()->getMetricFamilySamples());
2220

2321
return new Response($result, 200, ['Content-Type' => RenderTextFormat::MIME_TYPE]);
2422
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
4-
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
6+
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
57
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
6-
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
8+
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
79
// WouterJ\EloquentBundle\WouterJEloquentBundle::class => ['test' => true]
810
];

apps/backoffice/frontend/public/index.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use CodelyTv\Apps\Backoffice\Frontend\BackofficeFrontendKernel;
46
use Symfony\Component\ErrorHandler\Debug;
57
use Symfony\Component\HttpFoundation\Request;
@@ -23,8 +25,8 @@
2325
Request::setTrustedHosts([$trustedHosts]);
2426
}
2527

26-
$kernel = new BackofficeFrontendKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
27-
$request = Request::createFromGlobals();
28+
$kernel = new BackofficeFrontendKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
29+
$request = Request::createFromGlobals();
2830
$response = $kernel->handle($request);
2931
$response->send();
3032
$kernel->terminate($request, $response);

apps/backoffice/frontend/src/BackofficeFrontendKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use function dirname;
1414

15-
final class BackofficeFrontendKernel extends Kernel
15+
class BackofficeFrontendKernel extends Kernel
1616
{
1717
use MicroKernelTrait;
1818

0 commit comments

Comments
 (0)