pear:rfc:pear2_class_naming

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_class_naming [2009/05/28 16:16] – update based on PHP Standards group decisions ashnazgpear:rfc:pear2_class_naming [2009/09/20 19:28] – bump to 1.0 due to ratification; note incorporation into PEAR2 Standards ashnazg
Line 3: Line 3:
 ==== Document Information ==== ==== Document Information ====
   * Title: PEAR2 Class Naming Conventions   * Title: PEAR2 Class Naming Conventions
-  * Version: 0.1.0 +  * Version: 1.0.0 
-  * Status: Draft+  * Status: Ratified
   * Type: Informative Document   * Type: Informative Document
   * Wiki link:  http://wiki.php.net/pear/rfc/PEAR2_Class_Naming   * Wiki link:  http://wiki.php.net/pear/rfc/PEAR2_Class_Naming
 +  * Last Updated:  September 20th, 2009
 +  * Passed:  September 20th, 2009
 +
 +This RFC has been incorporated into the PEAR2 Standards ([[pear/rfc/pear2_standards]]).
  
 ==== Author(s) Information ==== ==== Author(s) Information ====
   * Name:  Chuck Burgess   * Name:  Chuck Burgess
-  * Name:  (second author needed)+  * Name:  Brett Bieber
   * Email: [[pear-group@php.net]]   * Email: [[pear-group@php.net]]
  
Line 33: Line 37:
 New guidelines for PEAR2: New guidelines for PEAR2:
   * syntax/scope hints in the class name must be suffixed rather than prefixed, e.g. abstract class FooAbstract {}   * syntax/scope hints in the class name must be suffixed rather than prefixed, e.g. abstract class FooAbstract {}
-    * such suffixing is required for abstract classes and interfaces, for additional clarity to non-native English readers+    * such suffixing is required for abstract classes and interfaces, for additional clarity to non-native English readers [4]
  
 ===== Issues ===== ===== Issues =====
Line 39: Line 43:
  
 ===== Proposed Solution ===== ===== Proposed Solution =====
 +
 Initial rules and guidelines: Initial rules and guidelines:
   * a suffix for an Abstract or Interface class name is required   * a suffix for an Abstract or Interface class name is required
Line 44: Line 49:
   * the suffix should be a full legible word, not a cryptic letter/abbreviation (e.g. FooAbst, FooA)   * the suffix should be a full legible word, not a cryptic letter/abbreviation (e.g. FooAbst, FooA)
     * this follows other well-known conventions (e.g. Java)     * this follows other well-known conventions (e.g. Java)
 +
 +The only exception to the Interface suffix requirement is the base package exception, which must be named simply "Exception". [3]
 +
 +One benefit of the suffix rather than a prefix is in alphabetical-based visual listing of classes.  Using prefixes would result in all unrelated abstract classes being listed togther... the same result would apply to all unrelated intefaces.
  
 ===== Examples ===== ===== Examples =====
Line 55: Line 64:
  
   * Demonstrating the new rules proposed by this RFC   * Demonstrating the new rules proposed by this RFC
-    * "interface Testing_DocTest_RunnerInterface" in Testing/DocTest/RunnerInterface.php becomes "interface Runner", or perhaps "interface Runnable" +    * "abstract class PHP_CodeSniffer_Standards_AbstractPatternSniff" in PHP_CodeSniffer/CodeSniffer/Standards/AbstractPatternSniff.php becomes "abstract class PatternSniffAbstract" 
-    +    * "interface Testing_DocTest_RunnerInterface" in Testing/DocTest/RunnerInterface.php becomes "interface RunnerInterface", or perhaps "interface RunnableInterface   
  
 ===== References ===== ===== References =====
pear/rfc/pear2_class_naming.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1