webimpress/coding-standard

array indentation not working as intended

Closed this issue · 2 comments

https://travis-ci.org/zendframework/zend-coding-standard/jobs/540908054#L306

diff test/fix/array-indentation.php test/fixed/array-indentation.php
62c62
<             => App\Infrastructure\View\TemplateDefaultsMiddlewareFactory::class,
---
>                 => App\Infrastructure\View\TemplateDefaultsMiddlewareFactory::class,
The command "vendor/bin/phpcbf test/fix; diff test/fix test/fixed" exited with 1.
// phpstorm
            App\Infrastructure\View\TemplateDefaultsMiddleware::class
                                              => App\Infrastructure\View\TemplateDefaultsMiddlewareFactory::class,
            App\Http\HomePageHandler::class   => App\Http\HomePageHandlerFactory::class,
            App\Http\StaticPageHandler::class => App\Http\StaticPageHandlerFactory::class,

// alpha releases
            App\Infrastructure\View\TemplateDefaultsMiddleware::class
                => App\Infrastructure\View\TemplateDefaultsMiddlewareFactory::class,
            App\Http\HomePageHandler::class   => App\Http\HomePageHandlerFactory::class,
            App\Http\StaticPageHandler::class => App\Http\StaticPageHandlerFactory::class,

// 1.0.3
            App\Infrastructure\View\TemplateDefaultsMiddleware::class
            => App\Infrastructure\View\TemplateDefaultsMiddlewareFactory::class,
            App\Http\HomePageHandler::class   => App\Http\HomePageHandlerFactory::class,
            App\Http\StaticPageHandler::class => App\Http\StaticPageHandlerFactory::class,

I expect some form of indention like phpstorm or before 1.0.3.

I've checked it and it depends on PHPStorm configuration - looks like you have set aligning array key-value pairs and because of that => is aligned. With default settings - without aligning, the behaviour of the sniff and PHPStorm is the same.

I guess I would need an option to configure it in the sniff as well, then.

Thanks for reporting the issue, @xtreamwayz !

@geerteltink I've created PR #63 to solve it.
It required additional configuration to be used. There is an example in description and tests.

Prepared for 1.1.0 release.