Skip to content

Add method to get a token at the same level as the start token #498

Open
@jrfnl

Description

@jrfnl

Sort of a mix between the File::getNext()/File::getPrevious() methods and the File::getStartOfStatement()/File::getEndOfStatement() methods.

Method should take the following parameters: File $phpcsFile, int $stackPtr, ?int $end, array|string|int $types

The method should skip over:

  • Sets of parentheses
  • Sets of square brackets, including short array/list brackets
  • Sets of curly/scope brackets
  • Sets of attributes brackets
  • Docblocks

$types should be checked to not include the tokens being skipped over.

Typical use cases:

  • Breaking up a function call to its individual parameters
  • Breaking up a match expression
  • Breaking up an array/list to its individual parts
  • etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions