Skip to content

Restore FnTokenEmulator#1141

Merged
nikic merged 3 commits into
nikic:masterfrom
WoutervdBrink:function-named-fn
Feb 26, 2026
Merged

Restore FnTokenEmulator#1141
nikic merged 3 commits into
nikic:masterfrom
WoutervdBrink:function-named-fn

Conversation

@WoutervdBrink
Copy link
Copy Markdown
Contributor

As of PHP 7.4, functions can no longer be named fn, due to the new arrow function syntax. Consequently, pre-7.4, functions may be called fn. This pull request restores a previously present token emulator that made this behavior possible.

Fixes #1139.

As of PHP 7.4, functions can no longer be named fn, due to the new
arrow function syntax. Consequently, pre-7.4, functions may be
called fn. This commit restores a previously present token emulator
that made this behavior possible.
Comment thread lib/PhpParser/Lexer/Emulative.php Outdated
Comment thread lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php
@nikic nikic merged commit 50f0d9c into nikic:master Feb 26, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling a function or class fn() is not allowed pre-7.4, but it should be

2 participants