Skip to content

Double arrow tokenized as T_STRING when placed after non-arrow function "fn" keyword #2865

@jrfnl

Description

@jrfnl

Given the below code sample, PHP itself tokenizes the => as T_DOUBLE_ARROW, however, since PHPCS 3.5.4, PHPCS tokenizes it as T_STRING.

I haven't traced back yet which commit introduced this, nor figured out yet where to apply the fix.

class Foo { public $fn = 'key'; public function bar() { return [ $this->fn => 'value', ]; } }

https://3v4l.org/OXelC

Related to #2523

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions