rfc:object-model-improvements

Differences

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

Link to this comparison view

Next revision
Previous revision
rfc:object-model-improvements [2011/02/25 22:27]
martinscotta created
rfc:object-model-improvements [2011/03/03 14:14]
martinscotta
Line 1: Line 1:
-====== Request for Comments: ​How to write RFCs ======+====== Request for Comments: ​Object Model Improvements ​======
   * Version: 1.0   * Version: 1.0
-  * Date: 2008-03-06+  * Date: 2011-02-24
   * Author: Martin Scotta <​martinscotta@gmail.com>​   * Author: Martin Scotta <​martinscotta@gmail.com>​
   * Status: Under Discussion   * Status: Under Discussion
Line 14: Line 14:
 ==== Why do we need this ==== ==== Why do we need this ====
  
-Actual PHP5 object model provides the basic for Object Oriented programming but it lacks for support for library or third parties ​developer.+Actual PHP5 object model provides the basic for Object Oriented programming but it lacks for support for library or third parties ​developers.
  
 +==== New Features ====
 +=== Constructors ===
 +    * Provide a default empty constructor (if applicable)
 +    * Remove the inheritance
 +    * Disallow directly calls to them
 +    * Ensure constructor call on parent classes
 +=== Magic methods ===
 +    * disallow directly call from outer context?
 +    * markers interfaces
 +=== class / interface ===
 +    * provide a magic constant with the fully qualified class name
 +      <code php>
 +namespace Foo {
 + class Baz {} 
 +}
 +namespace Test { 
 + use \Foo\Baz;
 +
 + interface Marker {}
 + class Bar implements Marker {}
 +
 + var_dump( Marker::​CLASS ); // string "​Test\Marker"​
 + var_dump( Baz::CLASS ); // string "​Foo\Baz"​
 + var_dump( Bar::CLASS ); // string "​Test\Bar"​
 +}
 +      </​code>​
 +=== errors into exceptions ===
 +   * Improve PHP Exception class
 +   * Remove errors/​warnings,​ throw an Exceptions instead
 +   * Better stacks dump
 +      <code php>
 +try {
 + include $file; // as of today we just die here
 +} catch(Exception $e) {
 + echo $e->​getMessage();​
 + throw new DomainException($e);​
 +}
 +      </​code>​
  
 ===== Changelog ===== ===== Changelog =====
rfc/object-model-improvements.txt · Last modified: 2017/09/22 13:28 (external edit)