yiisoft/yii2-coding-standards

Line indented incorrectly in rules

githubjeka opened this issue · 1 comments

This code not valid for phpcs:

<?php
namespace test;

class NEW1
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['date'], 'date'],
            [
                ['ip_manual'],
                'filter',
                'filter' => function ($v) {
                        if ($this->operator == 3 || $this->operator == 4) { //here
                            return null;
                        }
                        return $v;
                    } //and here
            ],
        ];
    }
}

PHPCS requires ugly operations from me:

<?php
namespace test;

class NEW1
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['date'], 'date'],
            [
                ['ip_manual'],
                'filter',
                'filter' => function ($v) {
            if ($this->operator == 3 || $this->operator == 4) {
                return null;
            }
            return $v;
                }
            ],
        ];
    }
}

I think it's a bug in PHPCS.