Skip to content

ScopeIndent does not check indent correctly for method prefixes like public and abstract #687

@phlopsi

Description

@phlopsi
$ phpcbf --version
PHP_CodeSniffer version 2.3.3 (stable) by Squiz (http://www.squiz.net)

My example file "B.php":

<?php

namespace N0;

class C0
{
     public function m0()
    {
    }

    public function m1()
    {
    }
}

it has an indentation of 5 spaces (instead of 4) at the function declaration of m0

Then i run phpcbf ...

$ phpcbf --standard=PSR2 --no-patch B.php
Changing into directory C:\Users\[...]\Desktop
Processing B.php [PHP => 47 tokens in 14 lines]... DONE in 15ms (5 fixable violations)
        => Fixing file: 0/5 violations remaining [made 5 passes]... DONE in 80ms
        => File was overwritten
Fixed 1 files
Time: 155ms; Memory: 2.5Mb

... and the file now looks like this:

<?php

namespace N0;

class C0
{
     public function m0()
     {
     }

        public function m1()
        {
        }
}

the first function is completely indented at 5 and the second one at 8 spaces, which is obviously wrong.

If there's any additional info needed, just ask. I will gladly help fixing this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions