zend-coding-standard icon indicating copy to clipboard operation
zend-coding-standard copied to clipboard

Conflicting indent rules

Open PatrickG opened this issue 6 years ago • 3 comments

  • [x] I was not able to find an open or closed issue matching what I'm seeing.
  • [x] This is not a question. (Questions should be asked on chat (Signup here) or our forums.)

It seems there are two conflicting indent rules.

Code to reproduce the issue

Variant 1

    $routes->connect('/test/:test', 'Test::test', [
        '_name'   => 'test',
        '_method' => ['GET', 'POST'],
    ])
        ->setPass(['test']);

Shows an error for line 2-4: Invalid indent. Expected 12 spaces, found 8. phpcbf corrects this to variant 2.

Variant 2

    $routes->connect('/test/:test', 'Test::test', [
            '_name'   => 'test',
            '_method' => ['GET', 'POST'],
        ])
        ->setPass(['test']);

Shows an error for line 2-4: Array key not indented correctly; expected 8 spaces but found 12. phpcbf corrects this to variant 1.

Variants that show no errors

    $routes->connect(
            '/test/:test',
            'Test::test',
            [
                '_name'   => 'test',
                '_method' => ['GET', 'POST'],
            ]
        )
        ->setPass(['test']);
    $routes
        ->connect(
            '/test/:test',
            'Test::test',
            [
                '_name'   => 'test',
                '_method' => ['GET', 'POST'],
            ]
        )
        ->setPass(['test']);
    $routes
        ->connect('/test/:test', 'Test::test', [
            '_name'   => 'test',
            '_method' => ['GET', 'POST'],
        ])
        ->setPass(['test']);

Expected results

One of the variants should show no error, or phpcbf should correct both variants to a variant that shows no error.

Actual results

Both variants show an error, and phpcbf corrects them in a loop.

PatrickG avatar Jun 26 '19 03:06 PatrickG

Which version are you using?

geerteltink avatar Jun 26 '19 22:06 geerteltink

2.0.x-dev

PatrickG avatar Jun 27 '19 04:06 PatrickG

This repository has been closed and moved to laminas/laminas-coding-standard; a new issue has been opened at https://github.com/laminas/laminas-coding-standard/issues/2.

weierophinney avatar Dec 31 '19 21:12 weierophinney