I'm using PHP 5.4, and have a PSR-0 class structure similar to the following.
(我使用的是PHP 5.4,并且具有类似于以下内容的PSR-0类结构。)
A\Library\Session.php :
(A \ Library \ Session.php :)
namespace ALibrary;
class Session { ... }
My\Application\Session.php :
(My \ Application \ Session.php :)
namespace MyApplication;
class Session { ... }
My\Application\Facebook.php :
(My \ Application \ Facebook.php :)
namespace MyApplication;
use ALibrarySession;
class Facebook { ... }
When I try to run the application, I get the following error:
(当我尝试运行该应用程序时,出现以下错误:)
Cannot use A\Library\Session as Session because the name is already in use in My\Application\Facebook.php
(无法将A \ Library \ Session用作Session,因为该名称已在My \ Application \ Facebook.php中使用)
Even though it's not, at least not in this file.
(即使不是,至少在此文件中也没有。)
The Facebook.php file declares only the Facebook
class, and imports exactly one Session
class, the A\Library
one. (Facebook.php文件仅声明Facebook
类,并且仅导入一个Session
类,即A\Library
。)
The only problem I can see is that another Session
class exists in the same namespace as the Facebook
class, but as it was never imported in the Facebook.php file, I thought it did not matter at all.
(我能看到的唯一问题是,另一个Session
类与Facebook
类存在于同一命名空间中,但是由于从未将其导入Facebook.php文件中,因此我认为这根本没有关系。)
Am I wrong (in that case please point to the relevant documentation), or is this a bug?
(我错了吗(在这种情况下,请指向相关文档),或者这是一个错误吗?)
ask by Benjamin translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…