Skip to content

Commit 9c50ec1

Browse files
committed
cs fixes
1 parent 298ba65 commit 9c50ec1

File tree

24 files changed

+208
-256
lines changed

24 files changed

+208
-256
lines changed

src/JsPackageManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@ private function addToPackageJson(string $package, string $version): void
8585

8686
$packageJson['devDependencies'] = $devDeps;
8787

88-
$this->files->dumpFile('package.json', json_encode($packageJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
88+
$this->files->dumpFile('package.json', json_encode($packageJson, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
8989
}
9090
}

src/Maker/MakeScaffold.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function getCommandDescription(): string
5959
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
6060
{
6161
$command
62-
->addArgument('name', InputArgument::OPTIONAL|InputArgument::IS_ARRAY, 'Scaffold name(s) to create')
62+
->addArgument('name', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Scaffold name(s) to create')
6363
;
6464

6565
$inputConfig->setArgumentAsNonInteractive('name');
@@ -103,7 +103,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
103103

104104
$availableScaffolds = array_combine(
105105
array_keys($this->availableScaffolds()),
106-
array_map(fn(array $scaffold) => $scaffold['description'], $this->availableScaffolds())
106+
array_map(fn (array $scaffold) => $scaffold['description'], $this->availableScaffolds())
107107
);
108108

109109
$input->setArgument('name', [$io->choice('Available scaffolds', $availableScaffolds)]);
@@ -176,14 +176,14 @@ private function generateScaffold(string $name, ConsoleStyle $io): void
176176

177177
private function availableScaffolds(): array
178178
{
179-
if (is_array($this->availableScaffolds)) {
179+
if (\is_array($this->availableScaffolds)) {
180180
return $this->availableScaffolds;
181181
}
182182

183183
$this->availableScaffolds = [];
184184
$finder = Finder::create()
185185
// todo, improve versioning system
186-
->in(\sprintf('%s/../Resources/scaffolds/%s.0', __DIR__, Kernel::MAJOR_VERSION))
186+
->in(sprintf('%s/../Resources/scaffolds/%s.0', __DIR__, Kernel::MAJOR_VERSION))
187187
->name('*.php')
188188
->depth(0)
189189
;
@@ -193,7 +193,7 @@ private function availableScaffolds(): array
193193

194194
$this->availableScaffolds[$name] = array_merge(
195195
require $file,
196-
['dir' => dirname($file->getRealPath()).'/'.$name]
196+
['dir' => \dirname($file->getRealPath()).'/'.$name]
197197
);
198198
}
199199

src/Resources/scaffolds/6.0/auth.php

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

3+
/*
4+
* This file is part of the Symfony MakerBundle package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Symfony\Bundle\MakerBundle\FileManager;
413

514
return [
@@ -12,16 +21,16 @@
1221
'symfony/web-profiler-bundle' => 'dev',
1322
'symfony/stopwatch' => 'dev',
1423
],
15-
'configure' => function(FileManager $files) {
24+
'configure' => function (FileManager $files) {
1625
// add LoginUser service
17-
$files->manipulateYaml('config/services.yaml', function(array $data) {
18-
$data['services']['App\Security\LoginUser']['$authenticator'] ='@security.authenticator.form_login.main';
26+
$files->manipulateYaml('config/services.yaml', function (array $data) {
27+
$data['services']['App\Security\LoginUser']['$authenticator'] = '@security.authenticator.form_login.main';
1928

2029
return $data;
2130
});
2231

2332
// make security.yaml adjustments
24-
$files->manipulateYaml('config/packages/security.yaml', function(array $data) {
33+
$files->manipulateYaml('config/packages/security.yaml', function (array $data) {
2534
$data['security']['providers'] = [
2635
'app_user_provider' => [
2736
'entity' => [

src/Resources/scaffolds/6.0/auth/tests/Browser/Authentication.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class Authentication extends Component
1212
{
1313
public static function assertAuthenticated(): \Closure
1414
{
15-
return static function(self $auth) {
15+
return static function (self $auth) {
1616
Assert::assertTrue($auth->collector()->isAuthenticated());
1717
};
1818
}
1919

2020
public static function assertAuthenticatedAs(string $email): \Closure
2121
{
22-
return static function(self $auth) use ($email) {
22+
return static function (self $auth) use ($email) {
2323
$collector = $auth->collector();
2424

2525
Assert::assertTrue($collector->isAuthenticated());
@@ -29,14 +29,14 @@ public static function assertAuthenticatedAs(string $email): \Closure
2929

3030
public static function assertNotAuthenticated(): \Closure
3131
{
32-
return static function(self $auth) {
32+
return static function (self $auth) {
3333
Assert::assertFalse($auth->collector()->isAuthenticated());
3434
};
3535
}
3636

3737
public static function expireSession(): \Closure
3838
{
39-
return static function(CookieJar $cookies) {
39+
return static function (CookieJar $cookies) {
4040
$cookies->expire('MOCKSESSID');
4141
};
4242
}
@@ -45,7 +45,7 @@ private function collector(): SecurityDataCollector
4545
{
4646
$browser = $this->browser();
4747

48-
assert($browser instanceof KernelBrowser);
48+
\assert($browser instanceof KernelBrowser);
4949

5050
$collector = $browser
5151
->withProfiling()
@@ -54,7 +54,7 @@ private function collector(): SecurityDataCollector
5454
->getCollector('security')
5555
;
5656

57-
assert($collector instanceof SecurityDataCollector);
57+
\assert($collector instanceof SecurityDataCollector);
5858

5959
return $collector;
6060
}

src/Resources/scaffolds/6.0/auth/tests/Functional/AuthenticationTest.php

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111

1212
class AuthenticationTest extends KernelTestCase
1313
{
14-
use HasBrowser, Factories, ResetDatabase;
14+
use Factories;
15+
use HasBrowser;
16+
use ResetDatabase;
1517

16-
/**
17-
* @test
18-
*/
19-
public function can_login_and_logout(): void
18+
public function testCanLoginAndLogout(): void
2019
{
2120
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
2221

@@ -35,10 +34,7 @@ public function can_login_and_logout(): void
3534
;
3635
}
3736

38-
/**
39-
* @test
40-
*/
41-
public function login_with_target(): void
37+
public function testLoginWithTarget(): void
4238
{
4339
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
4440

@@ -53,10 +49,7 @@ public function login_with_target(): void
5349
;
5450
}
5551

56-
/**
57-
* @test
58-
*/
59-
public function login_with_invalid_password(): void
52+
public function testLoginWithInvalidPassword(): void
6053
{
6154
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
6255

@@ -73,10 +66,7 @@ public function login_with_invalid_password(): void
7366
;
7467
}
7568

76-
/**
77-
* @test
78-
*/
79-
public function login_with_invalid_email(): void
69+
public function testLoginWithInvalidEmail(): void
8070
{
8171
$this->browser()
8272
->visit('/login')
@@ -91,10 +81,7 @@ public function login_with_invalid_email(): void
9181
;
9282
}
9383

94-
/**
95-
* @test
96-
*/
97-
public function login_with_invalid_csrf(): void
84+
public function testLoginWithInvalidCsrf(): void
9885
{
9986
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
10087

@@ -108,10 +95,7 @@ public function login_with_invalid_csrf(): void
10895
;
10996
}
11097

111-
/**
112-
* @test
113-
*/
114-
public function remember_me_enabled_by_default(): void
98+
public function testRememberMeEnabledByDefault(): void
11599
{
116100
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
117101

@@ -128,10 +112,7 @@ public function remember_me_enabled_by_default(): void
128112
;
129113
}
130114

131-
/**
132-
* @test
133-
*/
134-
public function can_disable_remember_me(): void
115+
public function testCanDisableRememberMe(): void
135116
{
136117
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
137118

@@ -149,10 +130,7 @@ public function can_disable_remember_me(): void
149130
;
150131
}
151132

152-
/**
153-
* @test
154-
*/
155-
public function fully_authenticated_login_redirect(): void
133+
public function testFullyAuthenticatedLoginRedirect(): void
156134
{
157135
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
158136

@@ -169,10 +147,7 @@ public function fully_authenticated_login_redirect(): void
169147
;
170148
}
171149

172-
/**
173-
* @test
174-
*/
175-
public function fully_authenticated_login_target(): void
150+
public function testFullyAuthenticatedLoginTarget(): void
176151
{
177152
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
178153

@@ -189,10 +164,7 @@ public function fully_authenticated_login_target(): void
189164
;
190165
}
191166

192-
/**
193-
* @test
194-
*/
195-
public function can_fully_authenticate_if_only_remembered(): void
167+
public function testCanFullyAuthenticateIfOnlyRemembered(): void
196168
{
197169
UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
198170

@@ -213,18 +185,15 @@ public function can_fully_authenticate_if_only_remembered(): void
213185
;
214186
}
215187

216-
/**
217-
* @test
218-
*/
219-
public function legacy_password_hash_is_automatically_migrated_on_login(): void
188+
public function testLegacyPasswordHashIsAutomaticallyMigratedOnLogin(): void
220189
{
221190
$user = UserFactory::createOne(['email' => 'mary@example.com', 'password' => '1234']);
222191

223192
// set the password to a legacy hash (argon2id, 1234)
224193
$user->setPassword('$argon2id$v=19$m=10,t=3,p=1$K9AFR15goJiUD6AdpK0a6Q$RsP6y+FRnYUBovBmhVZO7wN6Caj2eI8dMTnm3+5aTxk');
225194
$user->save();
226195

227-
$this->assertSame(\PASSWORD_ARGON2ID, \password_get_info($user->getPassword())['algo']);
196+
$this->assertSame(\PASSWORD_ARGON2ID, password_get_info($user->getPassword())['algo']);
228197

229198
$this->browser()
230199
->use(Authentication::assertNotAuthenticated())
@@ -237,22 +206,16 @@ public function legacy_password_hash_is_automatically_migrated_on_login(): void
237206
->use(Authentication::assertAuthenticatedAs('mary@example.com'))
238207
;
239208

240-
$this->assertSame(\PASSWORD_DEFAULT, \password_get_info($user->getPassword())['algo']);
209+
$this->assertSame(\PASSWORD_DEFAULT, password_get_info($user->getPassword())['algo']);
241210
}
242211

243-
/**
244-
* @test
245-
*/
246-
public function auto_redirected_to_authenticated_resource_after_login(): void
212+
public function testAutoRedirectedToAuthenticatedResourceAfterLogin(): void
247213
{
248214
// complete this test when you have a page that requires authentication
249215
$this->markTestIncomplete();
250216
}
251217

252-
/**
253-
* @test
254-
*/
255-
public function auto_redirected_to_fully_authenticated_resource_after_fully_authenticated(): void
218+
public function testAutoRedirectedToFullyAuthenticatedResourceAfterFullyAuthenticated(): void
256219
{
257220
// complete this test when/if you have a page that requires the user be "fully authenticated"
258221
$this->markTestIncomplete();

src/Resources/scaffolds/6.0/bootstrapcss.php

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

3+
/*
4+
* This file is part of the Symfony MakerBundle package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Symfony\Bundle\MakerBundle\FileManager;
413

514
return [
@@ -12,9 +21,9 @@
1221
'bootstrap' => '^5.0.0',
1322
'@popperjs/core' => '^2.0.0',
1423
],
15-
'configure' => function(FileManager $files) {
24+
'configure' => function (FileManager $files) {
1625
// add bootstrap form theme
17-
$files->manipulateYaml('config/packages/twig.yaml', function(array $data) {
26+
$files->manipulateYaml('config/packages/twig.yaml', function (array $data) {
1827
$data['twig']['form_themes'] = ['bootstrap_5_layout.html.twig'];
1928

2029
return $data;
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony MakerBundle package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
return [
413
'description' => 'Create change password form and tests.',
514
'dependents' => [
@@ -8,5 +17,5 @@
817
'packages' => [
918
'symfony/form' => 'all',
1019
'symfony/validator' => 'all',
11-
]
20+
],
1221
];

src/Resources/scaffolds/6.0/change-password/src/Controller/User/ChangePasswordController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public function __invoke(
2020
UserPasswordHasherInterface $userPasswordHasher,
2121
UserRepository $userRepository,
2222
?UserInterface $user = null,
23-
): Response
24-
{
23+
): Response {
2524
if (!$user) {
2625
throw $this->createAccessDeniedException();
2726
}
@@ -49,7 +48,7 @@ public function __invoke(
4948
}
5049

5150
return $this->render('user/change_password.html.twig', [
52-
'changePasswordForm' => $form->createView()
51+
'changePasswordForm' => $form->createView(),
5352
]);
5453
}
5554
}

0 commit comments

Comments
 (0)