zendframework / zend-coding-standard

Zend Framework Coding Standard
BSD 3-Clause "New" or "Revised" License
35 stars 8 forks source link

Conflicting indent rules #20

Open PatrickG opened 5 years ago

PatrickG commented 5 years ago

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.

geerteltink commented 5 years ago

Which version are you using?

PatrickG commented 5 years ago

2.0.x-dev

weierophinney commented 4 years ago

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.