Symfony-coding-standard: Bad indentation sniff on multiple array arguments

With this code:

        $formMapper
            ->with('General')
                ->add('name')
                ->add('values', 'sonata_type_collection', [
                    'by_reference'      => false,
                    'mapped'            => true,
                ], [
                    'edit'              => 'inline',
                    'inline'            => 'table',
                    'link_parameters'   => ['context' => $context],
                ])
            ->end()
        ;

CS found an error on line with ], [:

Multi-line function call not indented correctly; expected 20 spaces but found 16

But I think this is wrong.

The only way to make phpcs happy is to make this following “correction”:

        $formMapper
            ->with('General')
                ->add('name')
                ->add('values', 'sonata_type_collection', [
                    'by_reference'      => false,
                    'mapped'            => true,
                    ], [
                    'edit'              => 'inline',
                    'inline'            => 'table',
                    'link_parameters'   => ['context' => $context],
                    ])
            ->end()
        ;

But that makes no sense IMO.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

i think this one can be closed as

<?php

    $resolver->setDefaults([
        'attr' => [
            'novalidate' => 'novalidate',
        ],
    ]);

doesn’t raise an error anymore…