Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[make:form] fix generated field options_code indentation #1469

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

IndraGunawan
Copy link
Contributor

@IndraGunawan IndraGunawan commented Feb 29, 2024

when generating form with EntityType, the indentation of options_code looks wrong

below example is Foo <-- ManyToMany --> Bar
Before

<?php

class BarType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('name')
            ->add('Foo', EntityType::class, [
                'class' => Foo::class,
'choice_label' => 'id',
'multiple' => true,
            ])
        ;
    }

    // ....
}

After

<?php

class BarType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('name')
            ->add('Foo', EntityType::class, [
                'class' => Foo::class,
                'choice_label' => 'id',
                'multiple' => true,
            ])
        ;
    }

    // ....
}

@jrushlow jrushlow added Bug Bug Fix Unconfirmed Status: Needs Review Needs to be reviewed labels Mar 1, 2024
src/Doctrine/EntityDetails.php Outdated Show resolved Hide resolved
@@ -59,7 +59,7 @@ public function lintPhpTemplate(string|array $templateFilePath): void
$templateFilePath = [$templateFilePath];
}

$ignoreEnv = str_contains(strtolower(\PHP_OS), 'win') ? 'set PHP_CS_FIXER_IGNORE_ENV=1&' : 'PHP_CS_FIXER_IGNORE_ENV=1 ';
$ignoreEnv = str_starts_with(strtolower(\PHP_OS), 'win') ? 'set PHP_CS_FIXER_IGNORE_ENV=1& ' : 'PHP_CS_FIXER_IGNORE_ENV=1 ';
Copy link
Contributor Author

@IndraGunawan IndraGunawan Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrushlow i also made changes on this as these changes didn't seem right https://github.com/symfony/maker-bundle/pull/1435/files#diff-63196606ee883ed9470b1dfceed2cc28540986c0180afdb82e274812fa4690daR59

using str_contains, it was affect Darwin as well

Copy link
Collaborator

@jrushlow jrushlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, Thank you @IndraGunawan

@jrushlow jrushlow added Status: Reviewed Has been reviewed by a maintainer and removed Unconfirmed Status: Needs Review Needs to be reviewed labels Mar 4, 2024
@jrushlow jrushlow merged commit 7706a2f into symfony:main Mar 4, 2024
6 checks passed
@jrushlow jrushlow mentioned this pull request Mar 4, 2024
@IndraGunawan IndraGunawan deleted the fix-form-options-indent branch March 4, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants