Skip to content

Commit 697071d

Browse files
jrushlowweaverryan
authored andcommitted
update php-cs-fixer ruleset for php8
1 parent 7362329 commit 697071d

27 files changed

+242
-235
lines changed

.php-cs-fixer.dist.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
return (new PhpCsFixer\Config())
1717
->setRules(array(
18-
'@PHPUnit75Migration:risky' => true,
18+
'@PHP80Migration' => true,
19+
'@PHPUnit84Migration:risky' => true,
1920
'@Symfony' => true,
2021
'@Symfony:risky' => true,
2122
'header_comment' => [
@@ -30,6 +31,12 @@
3031
],
3132
'protected_to_private' => false,
3233
'semicolon_after_instruction' => false,
34+
'trailing_comma_in_multiline' => [
35+
'elements' => [
36+
'arrays',
37+
'parameters'
38+
],
39+
]
3340
))
3441
->setRiskyAllowed(true)
3542
->setFinder($finder)

src/Doctrine/EntityDetails.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
final class EntityDetails
2323
{
2424
public function __construct(
25-
private ClassMetadata|LegacyClassMetadata $metadata
25+
private ClassMetadata|LegacyClassMetadata $metadata,
2626
) {
2727
}
2828

src/Doctrine/EntityRegenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
private FileManager $fileManager,
3131
private Generator $generator,
3232
private EntityClassGenerator $entityClassGenerator,
33-
private bool $overwrite
33+
private bool $overwrite,
3434
) {
3535
}
3636

@@ -92,7 +92,7 @@ public function regenerateEntities(string $classOrNamespace): void
9292
foreach ($classMetadata->fieldMappings as $fieldName => $mapping) {
9393
// skip embedded fields
9494
if (false !== strpos($fieldName, '.')) {
95-
list($fieldName, $embeddedFiledName) = explode('.', $fieldName);
95+
[$fieldName, $embeddedFiledName] = explode('.', $fieldName);
9696

9797
$operations[$embeddedClasses[$fieldName]]->addEntityField($embeddedFiledName, $mapping);
9898

src/Doctrine/EntityRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class EntityRelation
3131
public function __construct(
3232
private string $type,
3333
private string $owningClass,
34-
private string $inverseClass
34+
private string $inverseClass,
3535
) {
3636
if (!\in_array($type, self::getValidRelationTypes())) {
3737
throw new \Exception(sprintf('Invalid relation type "%s"', $type));

src/FileManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(
3838
AutoloaderUtil $autoloaderUtil,
3939
MakerFileLinkFormatter $makerFileLinkFormatter,
4040
string $rootDirectory,
41-
string $twigDefaultPath = null
41+
string $twigDefaultPath = null,
4242
) {
4343
// move FileManagerTest stuff
4444
// update EntityRegeneratorTest to mock the autoloader

src/GeneratorTwigHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ public function getHeadPrintCode($title): string
6868
{
6969
if ($this->fileManager->fileExists($this->fileManager->getPathForTemplate('base.html.twig'))) {
7070
return <<<TWIG
71-
{% extends 'base.html.twig' %}
71+
{% extends 'base.html.twig' %}
7272
73-
{% block title %}$title{% endblock %}
73+
{% block title %}$title{% endblock %}
7474
75-
TWIG;
75+
TWIG;
7676
}
7777

7878
return <<<HTML
79-
<!DOCTYPE html>
79+
<!DOCTYPE html>
8080
81-
<title>$title</title>
81+
<title>$title</title>
8282
83-
HTML;
83+
HTML;
8484
}
8585

8686
public function getFileLink($path, $text = null, $line = 0): string

src/Maker/MakeAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct(
7070
private SecurityConfigUpdater $configUpdater,
7171
private Generator $generator,
7272
private DoctrineHelper $doctrineHelper,
73-
private SecurityControllerBuilder $securityControllerBuilder
73+
private SecurityControllerBuilder $securityControllerBuilder,
7474
) {
7575
}
7676

src/Maker/MakeEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(
5555
string $projectDirectory = null,
5656
Generator $generator = null,
5757
EntityClassGenerator $entityClassGenerator = null,
58-
PhpCompatUtil $phpCompatUtil = null
58+
PhpCompatUtil $phpCompatUtil = null,
5959
) {
6060
if (null !== $projectDirectory) {
6161
@trigger_error('The $projectDirectory constructor argument is no longer used since 1.41.0', \E_USER_DEPRECATED);

src/Maker/MakeRegistrationForm.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function __construct(
8686
private FileManager $fileManager,
8787
private FormTypeRenderer $formTypeRenderer,
8888
private RouterInterface $router,
89-
private DoctrineHelper $doctrineHelper
89+
private DoctrineHelper $doctrineHelper,
9090
) {
9191
}
9292

@@ -537,33 +537,33 @@ private function generateFormClass(ClassNameDetails $userClassDetails, Generator
537537
'agreeTerms' => [
538538
'type' => CheckboxType::class,
539539
'options_code' => <<<EOF
540-
'mapped' => false,
541-
'constraints' => [
542-
new IsTrue([
543-
'message' => 'You should agree to our terms.',
544-
]),
545-
],
546-
EOF
540+
'mapped' => false,
541+
'constraints' => [
542+
new IsTrue([
543+
'message' => 'You should agree to our terms.',
544+
]),
545+
],
546+
EOF
547547
],
548548
'plainPassword' => [
549549
'type' => PasswordType::class,
550550
'options_code' => <<<EOF
551-
// instead of being set onto the object directly,
552-
// this is read and encoded in the controller
553-
'mapped' => false,
554-
'attr' => ['autocomplete' => 'new-password'],
555-
'constraints' => [
556-
new NotBlank([
557-
'message' => 'Please enter a password',
558-
]),
559-
new Length([
560-
'min' => 6,
561-
'minMessage' => 'Your password should be at least {{ limit }} characters',
562-
// max length allowed by Symfony for security reasons
563-
'max' => 4096,
564-
]),
565-
],
566-
EOF
551+
// instead of being set onto the object directly,
552+
// this is read and encoded in the controller
553+
'mapped' => false,
554+
'attr' => ['autocomplete' => 'new-password'],
555+
'constraints' => [
556+
new NotBlank([
557+
'message' => 'Please enter a password',
558+
]),
559+
new Length([
560+
'min' => 6,
561+
'minMessage' => 'Your password should be at least {{ limit }} characters',
562+
// max length allowed by Symfony for security reasons
563+
'max' => 4096,
564+
]),
565+
],
566+
EOF
567567
],
568568
];
569569

src/Maker/MakeResetPassword.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class MakeResetPassword extends AbstractMaker
8888
public function __construct(
8989
private FileManager $fileManager,
9090
private DoctrineHelper $doctrineHelper,
91-
private EntityClassGenerator $entityClassGenerator
91+
private EntityClassGenerator $entityClassGenerator,
9292
) {
9393
}
9494

@@ -421,10 +421,10 @@ private function generateRequestEntity(Generator $generator, ClassNameDetails $r
421421
(new Param('selector'))->setType('string')->getNode(),
422422
(new Param('hashedToken'))->setType('string')->getNode(),
423423
], <<<'CODE'
424-
<?php
425-
$this->user = $user;
426-
$this->initialize($expiresAt, $selector, $hashedToken);
427-
CODE
424+
<?php
425+
$this->user = $user;
426+
$this->initialize($expiresAt, $selector, $hashedToken);
427+
CODE
428428
);
429429

430430
$manipulator->addManyToOneRelation((new RelationManyToOne())
@@ -466,9 +466,9 @@ private function generateRequestEntity(Generator $generator, ClassNameDetails $r
466466
(new Param('selector'))->setType('string')->getNode(),
467467
(new Param('hashedToken'))->setType('string')->getNode(),
468468
], <<<'CODE'
469-
<?php
470-
return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken);
471-
CODE
469+
<?php
470+
return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken);
471+
CODE
472472
);
473473

474474
$this->fileManager->dumpFile($pathRequestRepository, $manipulator->getSourceCode());

0 commit comments

Comments
 (0)