php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40790 List interface parsed as T_LIST instead of T_STRING
Submitted: 2007-03-12 23:02 UTC Modified: 2007-03-12 23:16 UTC
From: markpk at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.1 OS:
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: markpk at gmail dot com
New email:
PHP Version: OS:

 

 [2007-03-12 23:02 UTC] markpk at gmail dot com
Description:
------------
An object named List, named after a common data structure, is parsed as a T_LIST. I know many PHP applications use list(), but I think the engine could be made a little smarter by checking if this T_LIST could _also_ be a T_STRING in cases like these:

interface List
{
    ...
}

and:

function anything(List $x)
{
    ,,,
}

It will be appreciated if the engine detects the user is declaring an object named List and thus not parsing it as a T_LIST in this case. Because List is the name of a common data structure, it is a little bit annoying to see PHP displays a parse error instead of recognizing it as a T_STRING.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-12 23:16 UTC] tony2001@php.net
http://www.php.net/manual/en/reserved.php
There are reserved words and you have to remember of them when naming you classes/functions.

>I think the engine could be made a little smarter by..

Stas was kind enough to write a comprehensive answer on this, so I won't duplicate it.
You can find it here: http://news.php.net/php.internals/28303
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 09:01:30 2024 UTC