php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61070 How to distinguish tokenizer T_USE for namespace and 'use' in anonymous func ?
Submitted: 2012-02-13 13:49 UTC Modified: 2012-02-13 17:12 UTC
From: thomas dot lecarpentier+bugphp at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thomas dot lecarpentier+bugphp at gmail dot com
New email:
PHP Version: OS:

 

 [2012-02-13 13:49 UTC] thomas dot lecarpentier+bugphp at gmail dot com
Description:
------------
if I have an anonymous function with 'use' keyword (describe in page : http://fr2.php.net/manual/en/functions.anonymous.php ) , but with the tokenizer (token_get_all() : http://fr2.php.net/manual/en/function.token-get-all.php ) find and T_USE token, but the rest of line is not a namespace.

How can I distinguish the 2 use cases ?




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-13 17:12 UTC] nikic@php.net
This is not a PHP bug. That's pretty much what lexical tokens are good for, so they can be reused.

You have to determine what the token means from the context. Alternatively you can use a PHP parser which will do this for you.
 [2012-02-13 17:12 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 03:01:35 2024 UTC