Skip to content

PSR2.Methods.FunctionCallSignature.Indent forces exact indent of ternary operator parameters #698

@mattsnowboard

Description

@mattsnowboard

I keep hitting a violation for PSR2.Methods.FunctionCallSignature.Indent with code like the following:

    $this->log(
        'error',
        sprintf(
            '[Stripe] Dispute created for charge %s, reason: %s, evidence due by: %s',
            $e->getData()['object']['charge'],
            $e->getData()['object']['reason'],
            isset($e->getData()['object']['evidence_details'])
                ? $e->getData()['object']['evidence_details']['due_by']
                : ''
        ),
        array($e->getData()['object'])
    );

phpcbf wants to fix it as

    $this->log(
        'error',
        sprintf(
            '[Stripe] Dispute created for charge %s, reason: %s, evidence due by: %s',
            $e->getData()['object']['charge'],
            $e->getData()['object']['reason'],
            isset($e->getData()['object']['evidence_details'])
            ? $e->getData()['object']['evidence_details']['due_by']
            : ''
        ),
        array($e->getData()['object'])
    );
  1. Is there a way to avoid that?
  2. Is there any accepted standard that has a rule specifically for this case?

I'm generally trying to stick to PSR-2 style rules, but I don't like the way the auto-fix tries to put that all at the same indent level

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