Skip to content

Commit bc8cbac

Browse files
committed
Simplify codebase
1 parent 254aaf5 commit bc8cbac

15 files changed

+29
-37
lines changed

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
}

tests/Functional/DoctrineCest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ public function grabNumRecords(FunctionalTester $I)
1919

2020
public function grabRepository(FunctionalTester $I)
2121
{
22-
//With classes
22+
// With classes
2323
$repository = $I->grabRepository(User::class);
2424
$I->assertInstanceOf(UserRepository::class, $repository);
2525

26-
//With Repository classes
26+
// With Repository classes
2727
$repository = $I->grabRepository(UserRepository::class);
2828
$I->assertInstanceOf(UserRepository::class, $repository);
2929

30-
//With Entities
30+
// With Entities
3131
$user = $I->grabEntityFromRepository(User::class, [
32-
'email' => '[email protected]'
32+
'email' => '[email protected]',
3333
]);
3434
$repository = $I->grabRepository($user);
3535
$I->assertInstanceOf(UserRepository::class, $repository);
3636

37-
//With Repository interfaces
37+
// With Repository interfaces
3838
$repository = $I->grabRepository(UserRepositoryInterface::class);
3939
$I->assertInstanceOf(UserRepository::class, $repository);
4040
}
@@ -43,5 +43,4 @@ public function seeNumRecords(FunctionalTester $I)
4343
{
4444
$I->seeNumRecords(1, User::class);
4545
}
46-
4746
}

tests/Functional/EventsCest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function seeEvent(FunctionalTester $I)
9393
$I->seeEvent('non-existent-event');
9494
} catch (ExpectationFailedException $ex) {
9595
$I->assertTrue(true, 'seeEvent assertion fails with non-existent events.');
96+
9697
return;
9798
}
9899
$I->fail('seeEvent assertion did not fail as expected');

tests/Functional/ParameterCest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final class ParameterCest
1010
{
1111
public function grabParameter(FunctionalTester $I)
1212
{
13-
$locale = (string) $I->grabParameter('app.business_name');
14-
$I->assertSame('Codeception', $locale);
13+
$businessName = (string) $I->grabParameter('app.business_name');
14+
$I->assertSame('Codeception', $businessName);
1515
}
1616
}

tests/Functional/RouterCest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@ public function seeInCurrentRoute(FunctionalTester $I)
3737
$I->amOnPage('/');
3838
$I->seeInCurrentRoute('index');
3939
}
40-
4140
}

0 commit comments

Comments
 (0)