svn: /pear/peardoc/trunk/en/chapters/ pear2cs.xml

From: Date: Thu, 25 Feb 2010 14:37:49 +0000
Subject: svn: /pear/peardoc/trunk/en/chapters/ pear2cs.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-11909@lists.php.net to get a copy of this message
saltybeagle Thu, 25 Feb 2010 14:37:49 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295503 Log: Change namespace separator from :: to \ Changed paths: U pear/peardoc/trunk/en/chapters/pear2cs.xml Modified: pear/peardoc/trunk/en/chapters/pear2cs.xml =================================================================== --- pear/peardoc/trunk/en/chapters/pear2cs.xml 2010-02-25 14:05:20 UTC (rev 295502) +++ pear/peardoc/trunk/en/chapters/pear2cs.xml 2010-02-25 14:37:49 UTC (rev 295503) @@ -201,7 +201,7 @@ <programlisting role="php"> <![CDATA[ <?php -namespace PEAR2::HTTP; +namespace PEAR2\HTTP; class Request {} ?> ]]> @@ -209,7 +209,7 @@ <para> As such, underscores are no longer required of any classes if there is a namespace. Class <classname>PEAR2_HTTP_Request</classname> instead becomes - <classname>PEAR2::HTTP::Request</classname>. + <classname>PEAR2\HTTP\Request</classname>. Package names, however, will use underscores, making <classname>PEAR2_HTTP_Request</classname> the package name. @@ -237,7 +237,7 @@ <![CDATA[ <?php require_once 'PEAR2/OtherPackage.php'; -$class = new PEAR2::OtherPackage; +$class = new PEAR2\OtherPackage; ?> ]]> </programlisting> @@ -245,7 +245,7 @@ <programlisting role="php"> <![CDATA[ <?php -$class = new PEAR2::OtherPackage; +$class = new PEAR2\OtherPackage; ?> ]]> </programlisting> @@ -300,9 +300,9 @@ <para> All public classes must be in their own file with underscores (_) or - namespace separators (::) replaced by directory separator, so that + namespace separators (\) replaced by directory separator, so that <classname>PEAR2_PackageName_Base</classname> class or - <classname>PEAR2::PackageName::Base</classname> class is always + <classname>PEAR2\PackageName\Base</classname> class is always located in <literal>PEAR2/PackageName/Base.php</literal> (this is required to make autoload work) </para> @@ -316,21 +316,21 @@ <section xml:id="pear2cs.rules.baseexception"><info><title>Base Exception class</title></info> <para> - <classname>PEAR2::Exception</classname> is used as base class for all exception classes. Each + <classname>PEAR2\Exception</classname> is used as base class for all exception classes. Each package must define a base class that is packagename_Exception. For - example, the <classname>PEAR2::PackageName</classname> class defines an exception as follows in + example, the <classname>PEAR2\PackageName</classname> class defines an exception as follows in <literal>PEAR2/PackageName/Exception.php</literal>: </para> <programlisting role="php"> <![CDATA[ <?php -namespace PEAR2::PackageName; -class Exception extends PEAR2::Exception {} +namespace PEAR2\PackageName; +class Exception extends PEAR2\Exception {} ?> ]]> </programlisting> <para> - 'PEAR2::Exception will be its own package' + 'PEAR2\Exception will be its own package' </para> <section xml:id="pear2cs.rules.baseexception.requirement"><info><title>Requirement</title></info> @@ -384,7 +384,7 @@ <![CDATA[ <?php if (!class_exists("PEAR2_PackageName_Driver_$class", true)) { - throw new PEAR2::PackageName::Exception('Unknown driver ' . + throw new PEAR2\PackageName\Exception('Unknown driver ' . $class . ', be sure the driver exists and is loaded prior to use'); }

« previous php.pear.doc (#11909) next »