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

From: Date: Mon, 24 Aug 2015 08:19:36 +0000
Subject: svn: /phpdoc/en/trunk/language/ namespaces.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-13644@lists.php.net to get a copy of this message
salathe Mon, 24 Aug 2015 08:19:36 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=337598 Log: fix build - and move "group use" section to the aliasing/importing namespaces page Changed paths: U phpdoc/en/trunk/language/namespaces.xml Modified: phpdoc/en/trunk/language/namespaces.xml =================================================================== --- phpdoc/en/trunk/language/namespaces.xml 2015-08-24 04:33:10 UTC (rev 337597) +++ phpdoc/en/trunk/language/namespaces.xml 2015-08-24 08:19:36 UTC (rev 337598) @@ -16,7 +16,7 @@ but two copies of <literal>foo.txt</literal> cannot co-exist in the same directory. In addition, to access the <literal>foo.txt</literal> file outside of the <literal>/home/greg</literal> directory, we must prepend the directory name to the file - name using the directory separator to get <literal>/home/greg/foo.txt</literal>. This + naem using the directory separator to get <literal>/home/greg/foo.txt</literal>. This same principle extends to namespaces in the programming world. </simpara> <para> @@ -432,40 +432,6 @@ </programlisting> </example> </para> - <para> - <title>Group <literal>use</literal> Declarations</title> - <para> - This gives the ability to group multiple <literal>use</literal> declarations - according to the parent namespace. This seeks to remove code verbosity when - importing multiple classes, functions, or constants that come under the same - namespace. - </para> - <informalexample> - <programlisting role="php"> -<![CDATA[ -<?php - -// Pre PHP 7 code -use some\namespace\ClassA; -use some\namespace\ClassB; -use some\namespace\ClassC as C; - -use function some\namespace\fn_a; -use function some\namespace\fn_b; -use function some\namespace\fn_c; - -use const some\namespace\ConstA; -use const some\namespace\ConstB; -use const some\namespace\ConstC; - -// PHP 7+ code -use some\namespace\{ClassA, ClassB, ClassC as C}; -use function some\namespace\{fn_a, fn_b, fn_c}; -use const some\namespace\{ConstA, ConstB, ConstC}; -]]> - </programlisting> - </informalexample> - </para> </sect1> <sect1 xml:id="language.namespaces.dynamic"> <title>Namespaces and dynamic language features</title> @@ -795,6 +761,40 @@ </para> </note> </sect2> + <sect2 xml:id="language.namespaces.importing.group"> + <title>Group <literal>use</literal> Declarations</title> + <para> + This gives the ability to group multiple <literal>use</literal> declarations + according to the parent namespace. This seeks to remove code verbosity when + importing multiple classes, functions, or constants that come under the same + namespace. + </para> + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php + +// Pre PHP 7 code +use some\namespace\ClassA; +use some\namespace\ClassB; +use some\namespace\ClassC as C; + +use function some\namespace\fn_a; +use function some\namespace\fn_b; +use function some\namespace\fn_c; + +use const some\namespace\ConstA; +use const some\namespace\ConstB; +use const some\namespace\ConstC; + +// PHP 7+ code +use some\namespace\{ClassA, ClassB, ClassC as C}; +use function some\namespace\{fn_a, fn_b, fn_c}; +use const some\namespace\{ConstA, ConstB, ConstC}; +]]> + </programlisting> + </informalexample> + </sect2> </sect1> <sect1 xml:id="language.namespaces.global"> <title>Global space</title>

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