Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41971 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90931 invoked from network); 17 Nov 2008 11:15:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2008 11:15:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=david@grudl.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=david@grudl.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain grudl.com from 66.249.92.173 cause and error) X-PHP-List-Original-Sender: david@grudl.com X-Host-Fingerprint: 66.249.92.173 ug-out-1314.google.com Received: from [66.249.92.173] ([66.249.92.173:12231] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/A1-17095-C5251294 for ; Mon, 17 Nov 2008 06:15:41 -0500 Received: by ug-out-1314.google.com with SMTP id 39so373393ugf.37 for ; Mon, 17 Nov 2008 03:15:36 -0800 (PST) Received: by 10.103.174.16 with SMTP id b16mr1222528mup.28.1226920536318; Mon, 17 Nov 2008 03:15:36 -0800 (PST) Received: from ?192.168.1.23? ([77.240.188.66]) by mx.google.com with ESMTPS id j9sm8706733mue.3.2008.11.17.03.15.34 (version=SSLv3 cipher=RC4-MD5); Mon, 17 Nov 2008 03:15:35 -0800 (PST) Message-ID: <49215237.9070202@grudl.com> Date: Mon, 17 Nov 2008 12:15:03 +0100 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: PHP internals Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Namespace resolution rules has been changed? From: david@grudl.com (David Grudl) > > Why? I have developed framework using PHP namespaces and studied Zend > > Framework source codes and result is: if we use the new resolution rules > > (1), than in nearly all cases developers must prefix class names with \, > > only in few cases prefix is not required. Why? Because usually classes in > > more nested namespaces extends classes in less nested namespaces. If you > > don't believe, look in framework sources :-) > > A quick study on the Zend Framework source reveals most top-level classes > requiring, using, and accepting as arguments "more inner" classes and > interfaces in the relevant namespace: > > Zend_Acl ==> Zend_Acl_Resource_Interface, Zend_Acl_Role_Interface, > Zend_Acl_Role_Registry, Zend_Acl_Assert_Registry... > > Regard, Stan Vassilev Stan, ZF doesn't use namespaces yet. This is not namespaced code. Namespaced code requires different convention (http://framework.zend.com/wiki/display/ZFPROP/Naming+conventions+for+2.0+-+Matthew+Ratzloff). In namespaced code there cannot be class Interface in namespace Zend\Acl\Role. There must be class RoleInterface in Zend\Acl namespace. Similary class Zend_Acl become Acl in Zend\Acl namespace. So look at the code with namespace-eyes. Classes Zend_Acl, Zend_Acl_Resource_Interface, Zend_Acl_Role_Interface... will exist in one namespace. Every concrete plugins extending Zend\Controller\AbstractPlugin may exists in namespace Zend\Controllers\Plugins. Classes in Zend\Controller may not use classes in Zend\Controllers\Plugins (more abstract/common may not use concrete plugins), but plugins in Zend\Controllers\Plugins depends on classes in Zend\Controller. The "dependency-direction" should be one way. DG.