Skip to content

using a closure as argument causes odd errors #525

Closed

Description

Appears to be a dupe of squizlabs/PHP_CodeSniffer#318 but still happening with me (on latest dev). Running against the following:

<?php
hm_add_rewrite_rule( array(
    'regex'            => '^emails/change-city/?$',
    'permission'       => 'logged_in_only',
    'request_callback' => function() {
        $user = User::current_user();
        return;
    },
));

I get:

----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 7 | ERROR | [x] Multi-line function call not indented correctly;
   |       |     expected 4 spaces but found 8
 8 | ERROR | [x] Multi-line function call not indented correctly;
   |       |     expected 4 spaces but found 8
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Not sure exactly what's going on here. If I don't have the return; line, it doesn't fail, but once I add any more lines I get these errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions