pear:rfc:pear2_standards

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
pear:rfc:pear2_standards [2009/09/20 19:15] – bump version based on ratification and incorporation of Exception Interface and Class Naming RFCs ashnazgpear:rfc:pear2_standards [2010/06/15 15:21] – Correct path to data file saltybeagle
Line 166: Line 166:
  
    <?php    <?php
-   if (!class_exists("PEAR2_PackageName_Driver_$class", true)) {+   if (!class_exists("\PEAR2\PackageName\Driver\$class", true)) {
        throw new \PEAR2\PackageName\Exception('Unknown driver ' . $class .        throw new \PEAR2\PackageName\Exception('Unknown driver ' . $class .
                  ', be sure the driver exists and is loaded prior to use');                  ', be sure the driver exists and is loaded prior to use');
Line 236: Line 236:
 The only exception to this rule is the Base Package Exception Interface, which is specifically required to be named "vendor\Package\Exception" rather than "vendor\Package\ExceptionInterface". The only exception to this rule is the Base Package Exception Interface, which is specifically required to be named "vendor\Package\Exception" rather than "vendor\Package\ExceptionInterface".
  
-==== Package Naming convention ==== +
-A package naming rule may potentially be added to these standards, if the [[pear/rfc/pear2_naming_standards]] RFC is adopted.+
  
 ==== Base Exception interface ==== ==== Base Exception interface ====
Line 289: Line 288:
  require_once 'PEAR2/Autoload.php';  require_once 'PEAR2/Autoload.php';
  try {  try {
-     $p = new PEAR2\PackageName\Foo();+     $p = new \PEAR2\PackageName\Foo();
      $p->run('bar');      $p->run('bar');
- } catch (PEAR2\PackageName\Exception $e) {+ } catch (\PEAR2\PackageName\Exception $e) {
      echo "Caught exception from PEAR2\\PackageName";      echo "Caught exception from PEAR2\\PackageName";
  }  }
Line 312: Line 311:
    ...    ...
    // retrieve data from info.txt    // retrieve data from info.txt
-   $info = file_get_contents(dirname(__FILE__) . '../../../data/pear2.php.net/PEAR2_PackageName/info.txt');+   $info = file_get_contents(dirname(__FILE__) . '/../../../data/pear2.php.net/PEAR2_PackageName/info.txt');
    ?>    ?>
  
pear/rfc/pear2_standards.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1