Re: Re: [RFC] Normalize token_get_all() output (with flag)
| From: | Stig Bakken | Date: | Sun, 17 Jan 2016 11:34:27 +0000 |
| Subject: | Re: Re: [RFC] Normalize token_get_all() output (with flag) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-90680@lists.php.net to get a copy of this message | ||
On Jan 17, 2016 05:23, "Sara Golemon" <pollita@php.net> wrote:
>
> Okay, i've got a starting point up at
> https://github.com/phplang/php-token . It's basically
> just
> token_get_all() and token_name() as they currently stand (I didn't
> even bother overriding the behavior in token_name() yet). I did
> change some of the codeflow layout a bit (and add support for scanning
> files in the process), but that's it.
I really like this, funny really that it took until now for someone to get
enough of the old interface :)
But rather than overloading the existing token_get_all() function with
flags that change its behavior, what about just adding a new function, say
token_get_all_assoc(), and give it a TOKEN_LINENUMS flag if you want to
make line numbers optional for performance?
At least in my experience, code becomes more readable with new
method/function names than with a bunch of optional flags in cases like
this.
- Stig