Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98617 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1146 invoked from network); 24 Mar 2017 15:23:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2017 15:23:49 -0000 X-Host-Fingerprint: 137.50.185.182 oa-edu-185-182.wireless.abdn.ac.uk Received: from [137.50.185.182] ([137.50.185.182:12018] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/06-40046-20A35D85 for ; Fri, 24 Mar 2017 10:23:46 -0500 Message-ID: <16.06.40046.20A35D85@pb1.pair.com> To: internals@lists.php.net References: Date: Fri, 24 Mar 2017 15:23:42 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 137.50.185.182 Subject: Re: TOKEN_AS_OBJECT for token_get_all() From: ajf@ajf.me (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; > public $line; > } Rather than adding a flag to token_get_all() to return objects, you could potentially instead make an equivalent static method on PhpToken (PhpToken::getAll() perhaps). That would avoid mixing “object-oriented” and “procedural” styles, though I don't know if it matters. It seems cleaner to me. Thanks! -- Andrea Faulds https://ajf.me/