[PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-23 Thread Jan TvrdĂ­k
On Thu, 23 Mar 2017 18:16:31 +0100, Nikita Popov wrote: Hi internals, I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which returns an array of PhpToken objects, rather than the mix of plain strings and arrays we currently have. The PhpToken class is defined as: class PhpT

[PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread Andrea Faulds
Hi Nikita, Nikita Popov wrote: I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which returns an array of PhpToken objects, rather than the mix of plain strings and arrays we currently have. The PhpToken class is defined as: class PhpToken { public $type; public $text;

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-23 Thread Sara Golemon
On Thu, 23 Mar 2017 18:16:31 +0100, Nikita Popov > I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which > returns an array of PhpToken objects, rather than the mix of plain strings > and arrays we currently have. The PhpToken class is defined as: > > class PhpToken { > public $

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-23 Thread Nikita Popov
On Fri, Mar 24, 2017 at 12:33 AM, Sara Golemon wrote: > On Thu, 23 Mar 2017 18:16:31 +0100, Nikita Popov > > I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which > > returns an array of PhpToken objects, rather than the mix of plain > strings > > and arrays we currently have. The

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-23 Thread Sebastian Bergmann
Am 24.03.2017 um 00:33 schrieb Sara Golemon: > If I may bikeshed a TINY bit, I'd ask that all tokens return as > objects, rather than char|PhpToken similar to the current char|array > format we have. Yes, please. That would basically/probably/hopefully make php-token-stream superfluous. -- PHP I

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread David Rodrigues
Em 24 de mar de 2017 12:24 PM, "Andrea Faulds" escreveu: Hi Nikita, Nikita Popov wrote: I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which > returns an array of PhpToken objects, rather than the mix of plain strings > and arrays we currently have. The PhpToken class is define

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread Levi Morrison
On Fri, Mar 24, 2017 at 9:23 AM, Andrea Faulds wrote: > Hi Nikita, > > Nikita Popov wrote: > >> I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which >> returns an array of PhpToken objects, rather than the mix of plain strings >> and arrays we currently have. The PhpToken class is

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread Fleshgrinder
On 3/24/2017 4:23 PM, Andrea Faulds wrote: > Hi Nikita, > > Nikita Popov wrote: > >> I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which >> returns an array of PhpToken objects, rather than the mix of plain >> strings >> and arrays we currently have. The PhpToken class is defined

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread guilhermebla...@gmail.com
Thanks Fleshgrinder! You expressed exactly what I thought, but was too busy... cough... lazy to put in an email. Cheers, On Fri, Mar 24, 2017 at 2:35 PM, Fleshgrinder wrote: > On 3/24/2017 4:23 PM, Andrea Faulds wrote: > > Hi Nikita, > > > > Nikita Popov wrote: > > > >> I'd like to add a new T

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread Nikita Popov
On Fri, Mar 24, 2017 at 5:26 PM, Levi Morrison wrote: > On Fri, Mar 24, 2017 at 9:23 AM, Andrea Faulds wrote: > > Hi Nikita, > > > > Nikita Popov wrote: > > > >> I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which > >> returns an array of PhpToken objects, rather than the mix of

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread Niklas Keller
2017-03-24 19:35 GMT+01:00 Fleshgrinder : > On 3/24/2017 4:23 PM, Andrea Faulds wrote: > > Hi Nikita, > > > > Nikita Popov wrote: > > > >> I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which > >> returns an array of PhpToken objects, rather than the mix of plain > >> strings > >>

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-24 Thread Fleshgrinder
On 3/24/2017 8:15 PM, Niklas Keller wrote: > If PhpToken::getAll() violates the SRP, then Lexer::fromFile() is just the > same sort of violation. > > Regards, Niklas > This is kind of true in PHP, because we are lacking proper abstractions for path and file handling. It is most certainly not tru

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-25 Thread Nikita Popov
On Sat, Mar 25, 2017 at 4:40 AM, Levi Morrison wrote: > On Fri, Mar 24, 2017 at 1:04 PM, Nikita Popov > wrote: > > On Fri, Mar 24, 2017 at 5:26 PM, Levi Morrison wrote: > >> I prefer a distinct function/method from `token_get_all`. I don't see > >> the value in having a return value that differ

Re: [PHP-DEV] Re: TOKEN_AS_OBJECT for token_get_all()

2017-03-25 Thread Fleshgrinder
On 3/25/2017 1:18 PM, Nikita Popov wrote: > Overall, I must say that this thread has left me rather disappointed. I was > harboring the misguided hope that it might be possible to introduce a > simple, self-contained improvement, that resolves a major ergonomics pain > point in ext/tokenizer, while