Skip to content

Commit 6dd7444

Browse files
committed
Simplify codebase
1 parent 7ff7501 commit 6dd7444

17 files changed

+33
-41
lines changed

.github/workflows/symfony.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ name: CI
33
on:
44
push:
55
branches:
6-
- '6.4'
6+
- '6.4wApi'
77
pull_request:
88
branches:
9-
- '6.4'
9+
- '6.4wApi'
1010

1111
env:
1212
APP_ENV: test
1313

1414
jobs:
1515
symfony:
16-
name: Symfony 6.4 (PHP ${{ matrix.php-versions }})
16+
name: Symfony 6.4wApi (PHP ${{ matrix.php-versions }})
1717
runs-on: ubuntu-latest
1818
strategy:
1919
fail-fast: true

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
}

src/Utils/Mailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\Mailer\MailerInterface;
1010
use Symfony\Component\Mime\Address;
1111

12-
final class Mailer
12+
final readonly class Mailer
1313
{
1414
public function __construct(private MailerInterface $mailer)
1515
{

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
}

tests/Functional/SecurityCest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ public function dontSeeRememberedAuthentication(FunctionalTester $I)
2121
$I->submitForm('form[name=login]', [
2222
'email' => '[email protected]',
2323
'password' => '123456',
24-
'_remember_me' => false
24+
'_remember_me' => false,
2525
]);
2626
$I->dontSeeRememberedAuthentication();
2727
}
2828

2929
public function seeAuthentication(FunctionalTester $I)
3030
{
3131
$user = $I->grabEntityFromRepository(User::class, [
32-
'email' => '[email protected]'
32+
'email' => '[email protected]',
3333
]);
3434
$I->amLoggedInAs($user);
3535
$I->amOnPage('/dashboard');
@@ -43,15 +43,15 @@ public function seeRememberedAuthentication(FunctionalTester $I)
4343
$I->submitForm('form[name=login]', [
4444
'email' => '[email protected]',
4545
'password' => '123456',
46-
'_remember_me' => true
46+
'_remember_me' => true,
4747
]);
4848
$I->seeRememberedAuthentication();
4949
}
5050

5151
public function seeUserHasRole(FunctionalTester $I)
5252
{
5353
$user = $I->grabEntityFromRepository(User::class, [
54-
'email' => '[email protected]'
54+
'email' => '[email protected]',
5555
]);
5656
$I->amLoggedInAs($user);
5757
$I->amOnPage('/');
@@ -62,7 +62,7 @@ public function seeUserHasRole(FunctionalTester $I)
6262
public function seeUserHasRoles(FunctionalTester $I)
6363
{
6464
$user = $I->grabEntityFromRepository(User::class, [
65-
'email' => '[email protected]'
65+
'email' => '[email protected]',
6666
]);
6767
$I->amLoggedInAs($user);
6868
$I->amOnPage('/');
@@ -73,7 +73,7 @@ public function seeUserHasRoles(FunctionalTester $I)
7373
public function seeUserPasswordDoesNotNeedRehash(FunctionalTester $I)
7474
{
7575
$user = $I->grabEntityFromRepository(User::class, [
76-
'email' => '[email protected]'
76+
'email' => '[email protected]',
7777
]);
7878
$I->amLoggedInAs($user);
7979
$I->amOnPage('/dashboard');

tests/Functional/ServicesCest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ public function grabService(FunctionalTester $I)
1414
$security = $I->grabService('security.helper');
1515
$I->assertInstanceOf(Security::class, $security);
1616
}
17-
1817
}

tests/Functional/SessionCest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class SessionCest
1414
public function amLoggedInAs(FunctionalTester $I)
1515
{
1616
$user = $I->grabEntityFromRepository(User::class, [
17-
'email' => '[email protected]'
17+
'email' => '[email protected]',
1818
]);
1919
$I->amLoggedInAs($user);
2020
$I->amOnPage('/dashboard');
@@ -28,7 +28,7 @@ public function amLoggedInAs(FunctionalTester $I)
2828
public function amLoggedInWithToken(FunctionalTester $I)
2929
{
3030
$user = $I->grabEntityFromRepository(User::class, [
31-
'email' => '[email protected]'
31+
'email' => '[email protected]',
3232
]);
3333
$token = new PostAuthenticationToken($user, 'main', $user->getRoles());
3434
$I->amLoggedInWithToken($token);
@@ -49,7 +49,7 @@ public function dontSeeInSession(FunctionalTester $I)
4949
public function goToLogoutPath(FunctionalTester $I)
5050
{
5151
$user = $I->grabEntityFromRepository(User::class, [
52-
'email' => '[email protected]'
52+
'email' => '[email protected]',
5353
]);
5454
$I->amLoggedInAs($user);
5555
$I->amOnPage('/dashboard');
@@ -63,7 +63,7 @@ public function goToLogoutPath(FunctionalTester $I)
6363
public function logoutProgrammatically(FunctionalTester $I)
6464
{
6565
$user = $I->grabEntityFromRepository(User::class, [
66-
'email' => '[email protected]'
66+
'email' => '[email protected]',
6767
]);
6868
$I->amLoggedInAs($user);
6969
$I->amOnPage('/dashboard');
@@ -78,7 +78,7 @@ public function logoutProgrammatically(FunctionalTester $I)
7878
public function seeInSession(FunctionalTester $I)
7979
{
8080
$user = $I->grabEntityFromRepository(User::class, [
81-
'email' => '[email protected]'
81+
'email' => '[email protected]',
8282
]);
8383
$I->amLoggedInAs($user);
8484
$I->amOnPage('/');
@@ -89,7 +89,7 @@ public function seeInSession(FunctionalTester $I)
8989
public function seeSessionHasValues(FunctionalTester $I)
9090
{
9191
$user = $I->grabEntityFromRepository(User::class, [
92-
'email' => '[email protected]'
92+
'email' => '[email protected]',
9393
]);
9494
$I->amLoggedInAs($user);
9595
$I->amOnPage('/');

tests/Functional/TimeCest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ public function seeRequestElapsedTimeLessThan(FunctionalTester $I)
1414
$I->seeInCurrentUrl('register');
1515
$I->seeRequestTimeIsLessThan(400);
1616
}
17-
}
17+
}

tests/Functional/TwigCest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ public function seeRenderedTemplate(FunctionalTester $I)
2626
$I->seeRenderedTemplate('layout.html.twig');
2727
$I->seeRenderedTemplate('security/login.html.twig');
2828
}
29-
}
29+
}

0 commit comments

Comments
 (0)