# Rename PhpToken::getAll()?

- Thread: https://externals.io/message/112189
- Original archive: https://news-web.php.net/php.internals/112189
- Started by Nikita Popov on 2020-11-07T09:09:32+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #112189 — Nikita Popov — 2020-11-07T09:09:32+00:00

URL: https://externals.io/message/112189#112189

Hi internals,

Cross-posting from https://bugs.php.net/bug.php?id=80328 to a place where
someone might see it...

The PhpToken::getAll() API introduced in PHP 8.0 is of course inspired by
the existing `token_get_all()` function. But arguably, the name is not that
great.

The reporter suggests to rename it into PhpToken::tokenize() instead, which
seems like a sensible suggestion to me.

Any thoughts on doing that rename? It's pretty late in the release cycle,
but if we want to rename something, this is our last chance :)

Regards,
Nikita

PS: Because I know someone is going to suggest it: No, we will not
introduce a separate PhpLexer class at this point in time.

---

## #112190 — Hans Henrik Bergan — 2020-11-07T09:45:18+00:00

URL: https://externals.io/message/112189#112190 · In reply to: #112189

+1 for ::tokenize()

---

## #112191 — Sebastian Bergmann — 2020-11-07T10:34:48+00:00

URL: https://externals.io/message/112189#112191 · In reply to: #112189

Am 07.11.2020 um 10:09 schrieb Nikita Popov:
> The reporter suggests to rename it into PhpToken::tokenize() instead, which
> seems like a sensible suggestion to me.

+1

---

## #112193 — Gabriel Caruso — 2020-11-07T14:30:02+00:00

URL: https://externals.io/message/112189#112193 · In reply to: #112189

> Hi internals,
>
> Cross-posting from https://bugs.php.net/bug.php?id=80328 to a place where
> someone might see it...
>
> The PhpToken::getAll() API introduced in PHP 8.0 is of course inspired by
> the existing `token_get_all()` function. But arguably, the name is not that
> great.
>
> The reporter suggests to rename it into PhpToken::tokenize() instead, which
> seems like a sensible suggestion to me.
>
> Any thoughts on doing that rename? It's pretty late in the release cycle,
> but if we want to rename something, this is our last chance :)
>
> Regards,
> Nikita
>
> PS: Because I know someone is going to suggest it: No, we will not
> introduce a separate PhpLexer class at this point in time.
>

Agreed, and as one of PHP 8.0 RM, I see no problem on doing this renaming,
just make sure to document it.

Naming stuff is hard, but it's never too late to improve it :)

---

## #112198 — Sara Golemon — 2020-11-07T20:30:27+00:00

URL: https://externals.io/message/112189#112198 · In reply to: #112189

> The PhpToken::getAll() API introduced in PHP 8.0 is of course inspired by
> the existing `token_get_all()` function. But arguably, the name is not that
> great.
>
> The reporter suggests to rename it into PhpToken::tokenize() instead, which
> seems like a sensible suggestion to me.
>
> Any thoughts on doing that rename? It's pretty late in the release cycle,
> but if we want to rename something, this is our last chance :)
>
>
Do I love a rename 3 weeks from GA? No.
Is there any good reason to object? Not really.  The change is super minor
and the functionality is new and as-yet undocumented.

Go for it.  The reasoning in favor is sound.

-Sara
