microsoft / microsoft/tolerant-php-parser
Function names cannot be keywords
Open
Nobody has claimed this yet.
bug
- Dominant language
- PHP
- Stars
- 894
- Forks
- 85
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 3
Description
Summary
A function name must be a T_STRING token (or whatever its equivalent is in this parser).
Sample code:
function empty() {}
Expected
Parse error: syntax error, unexpected 'empty' (T_EMPTY), expecting '('
Actual
No error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the parser rule that accepts function declarations and the token definitions for T_STRING and T_EMPTY. Reproduce the sample function empty() {} and compare its result with the expected parse error. Done means keyword-named functions are rejected while ordinary function names continue to parse correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100