Skip to content

Commit 9c95ccd

Browse files
authored
Simplify codebase (#31)
1 parent f026b75 commit 9c95ccd

20 files changed

+39
-51
lines changed

config/packages/dev/monolog.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
use Symfony\Config\MonologConfig;
66

7-
return static function (MonologConfig $monolog): void
8-
{
7+
return static function (MonologConfig $monolog): void {
98
$monolog->handler('main', [
109
'type' => 'stream',
1110
'path' => '%kernel.logs_dir%/%kernel.environment%.log',

config/packages/prod/monolog.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@
44

55
use Symfony\Config\MonologConfig;
66

7-
return static function (MonologConfig $monolog): void
8-
{
7+
return static function (MonologConfig $monolog): void {
98
$monolog->handler('main', [
109
'type' => 'fingers_crossed',
1110
'action_level' => 'error',
1211
'handler' => 'nested',
13-
'buffer_size' => 50
12+
'buffer_size' => 50,
1413
])->excludedHttpCode()->code(404)->code(405);
1514
$monolog->handler('nested', [
1615
'type' => 'stream',
1716
'path' => 'php://stderr',
1817
'level' => 'debug',
19-
'formatter' => 'monolog.formatter.json'
18+
'formatter' => 'monolog.formatter.json',
2019
]);
2120
$monolog->handler('console', [
2221
'type' => 'console',
23-
'process_psr_3_messages' => false
22+
'process_psr_3_messages' => false,
2423
])->channels()->elements(['!event', '!doctrine']);
2524
};

config/packages/security.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
88
use Symfony\Config\SecurityConfig;
99

10-
return static function (SecurityConfig $security): void
11-
{
10+
return static function (SecurityConfig $security): void {
1211
$security->enableAuthenticatorManager(true);
1312
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto');
1413
$userProvider = $security->provider('app_user_provider');
@@ -32,6 +31,6 @@
3231
$mainFirewall->entryPoint('form_login');
3332

3433
$security->accessControl([
35-
'path' => '^/dashboard', 'roles' => 'ROLE_USER'
34+
'path' => '^/dashboard', 'roles' => 'ROLE_USER',
3635
]);
3736
};

config/packages/test/monolog.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
use Symfony\Config\MonologConfig;
66

7-
return static function (MonologConfig $monolog): void
8-
{
7+
return static function (MonologConfig $monolog): void {
98
$monolog->handler('main', [
109
'type' => 'fingers_crossed',
1110
'action_level' => 'error',
@@ -14,6 +13,6 @@
1413
$monolog->handler('nested', [
1514
'type' => 'stream',
1615
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
17-
'level' => 'debug'
16+
'level' => 'debug',
1817
]);
1918
};

src/Command/ExampleCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,10 @@ protected function configure(): void
3232
);
3333
}
3434

35-
protected function initialize(InputInterface $input, OutputInterface $output): void
35+
protected function execute(InputInterface $input, OutputInterface $output): int
3636
{
3737
$this->ioStream = new SymfonyStyle($input, $output);
38-
}
3938

40-
protected function execute(InputInterface $input, OutputInterface $output): int
41-
{
4239
$optionSomething = $input->getOption(self::OPTION_SOMETHING);
4340
if ($optionSomething) {
4441
$this->ioStream->text('Bye world!');

src/Controller/HttpClientController.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@
1212

1313
final class HttpClientController extends AbstractController
1414
{
15-
private HttpClientInterface $httpClient;
16-
17-
public function __construct(HttpClientInterface $httpClient)
15+
public function __construct(private readonly HttpClientInterface $httpClient)
1816
{
19-
$this->httpClient = $httpClient;
2017
}
2118

2219
public function routeUsingHttpClient(): Response
@@ -65,9 +62,7 @@ public function routeMakingMultipleRequests(): Response
6562

6663
public function internalEndpointPost(Request $request): Response
6764
{
68-
$data = json_decode($request->getContent(), true);
69-
70-
return $this->json(['received' => $data]);
65+
return $this->json(['received' => $request->toArray()]);
7166
}
7267

7368
public function routeShouldNotMakeSpecificRequest(): Response

src/Controller/RegistrationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class RegistrationController extends AbstractController
1919
public function __construct(
2020
private readonly Mailer $mailer,
2121
private readonly UserRepositoryInterface $userRepository,
22-
private readonly EventDispatcherInterface $eventDispatcher
22+
private readonly EventDispatcherInterface $eventDispatcher,
2323
) {
2424
}
2525

src/Entity/User.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static function create(string $email, string $password, array $roles = []
4040
$user->email = $email;
4141
$user->password = $password;
4242
$user->roles = $roles;
43+
4344
return $user;
4445
}
4546

src/Repository/Model/UserRepositoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ interface UserRepositoryInterface
99
public function save(User $user): void;
1010

1111
public function getByEmail(string $email): ?User;
12-
}
12+
}

src/Repository/UserRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function getByEmail(string $email): ?User
2727
{
2828
/** @var User|null $user */
2929
$user = $this->findOneBy(['email' => $email]);
30+
3031
return $user;
3132
}
3233
}

0 commit comments

Comments
 (0)