Automattic / phpcs-neutron-standard

A set of phpcs sniffs for PHP >7 development
MIT License
94 stars 7 forks source link

Auto fix PEAR.Functions.FunctionCallSignature.Indent #49

Open sirbrillig opened 6 years ago

sirbrillig commented 6 years ago

PEAR.Functions.FunctionCallSignature.Indent is good at finding incorrect indentation, but since auto-fix must be per-sniff and not per error, the current auto-fix requires running all of PEAR.Functions.FunctionCallSignature and there's some awkward formatting in that sniff.

Let's duplicate it and do a better job of fixing the indentation.

sirbrillig commented 6 years ago

This is what the sniff should detect:

    public function get_for_user( $user_id, $table ) {
        $exchanges = get_results( prepare( "SELECT * FROM {$table} " .
            'WHERE user_id = %d', $user_id ) );
        return array_map( [ $this, 'convert_data_types' ], $exchanges );
    }

And it should replace it with this:

    public function get_for_user( $user_id, $table ) {
        $exchanges = get_results( prepare( "SELECT * FROM {$table} " .
        'WHERE user_id = %d', $user_id ) );
        return array_map( [ $this, 'convert_data_types' ], $exchanges );
    }