svn: /phpdoc/en/trunk/language/ namespaces.xml

From: Date: Sun, 24 Oct 2010 14:14:59 +0000
Subject: svn: /phpdoc/en/trunk/language/ namespaces.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-7319@lists.php.net to get a copy of this message
kalle Sun, 24 Oct 2010 14:14:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=304702 Log: Fixed bug #53133 (Scope of use keyword is not documented) Bug: http://bugs.php.net/53133 (Open) Scope of use keyword is not documented. Changed paths: U phpdoc/en/trunk/language/namespaces.xml Modified: phpdoc/en/trunk/language/namespaces.xml =================================================================== --- phpdoc/en/trunk/language/namespaces.xml 2010-10-24 14:05:10 UTC (rev 304701) +++ phpdoc/en/trunk/language/namespaces.xml 2010-10-24 14:14:59 UTC (rev 304702) @@ -681,6 +681,42 @@ </programlisting> </example> </para> + <sect2 xml:id="language.namespaces.importing.scope"> + <title>Scoping rules for importing</title> + <para> + The <literal>use</literal> keyword must be declared in the + outermost scope of a file (the global scope) or inside namespace + declarations. This is because the importing is done at compile + time and not runtime, so it cannot be block scoped. The following + example will show an illegal use of the <literal>use</literal> + keyword: + </para> + <para> + <example> + <title>Illegal importing rule</title> + <programlisting role="php"> +<![CDATA[ +<?php +namespace Languages; + +class Greenlandic +{ + use Languages\Danish; + + ... +} +?> +]]> + </programlisting> + </example> + </para> + <note> + <para> + Importing rules are per file basis, meaning included files will + <emphasis>NOT</emphasis> inherit the parent file's importing rules. + </para> + </note> + </sect2> </sect1> <sect1 xml:id="language.namespaces.global"> <title>Global space</title>

« previous php.doc.cvs (#7319) next »