Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jrfnl opened this issue Jul 27, 2023 · 0 comments
Open

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

jrfnl opened this issue Jul 27, 2023 · 0 comments

Comments

@jrfnl
Copy link
Member

jrfnl commented Jul 27, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant