rfc:object-model-improvements
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:object-model-improvements [2011/02/25 22:36] – edited martinscotta | rfc:object-model-improvements [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Request for Comments: | + | ====== Request for Comments: |
* Version: 1.0 | * Version: 1.0 | ||
- | * Date: 2008-03-06 | + | * Date: 2011-02-24 |
* Author: Martin Scotta < | * Author: Martin Scotta < | ||
* 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 | + | Actual PHP5 object model provides the basic for Object Oriented programming but it lacks for support for library or third parties |
==== New Features ==== | ==== New Features ==== | ||
- | | + | === Constructors |
* Provide a default empty constructor (if applicable) | * Provide a default empty constructor (if applicable) | ||
* Remove the inheritance | * Remove the inheritance | ||
* Disallow directly calls to them | * Disallow directly calls to them | ||
* Ensure constructor call on parent classes | * Ensure constructor call on parent classes | ||
- | + | === Magic methods | |
- | | + | |
* disallow directly call from outer context? | * disallow directly call from outer context? | ||
* markers interfaces | * markers interfaces | ||
- | + | === class / interface | |
- | | + | |
* provide a magic constant with the fully qualified class name | * provide a magic constant with the fully qualified class name | ||
- | < | + | < |
- | namespace Test { | + | namespace Foo { |
- | class Bar {} | + | class Baz {} |
- | var_dump( Bar::CLASS ); // string " | + | } |
- | } | + | namespace Test { |
+ | use \Foo\Baz; | ||
+ | |||
+ | interface Marker {} | ||
+ | class Bar implements Marker | ||
+ | |||
+ | var_dump( Marker:: | ||
+ | var_dump( Baz::CLASS ); // string " | ||
+ | var_dump( Bar::CLASS ); // string " | ||
+ | } | ||
+ | </ | ||
+ | === errors into exceptions === | ||
+ | * Improve PHP Exception class | ||
+ | * Remove errors/ | ||
+ | * Better stacks dump | ||
+ | <code php> | ||
+ | try { | ||
+ | include $file; // as of today we just die here | ||
+ | } catch(Exception $e) { | ||
+ | echo $e-> | ||
+ | throw new DomainException($e); | ||
+ | } | ||
</ | </ | ||
rfc/object-model-improvements.1298673376.txt.gz · Last modified: 2017/09/22 13:28 (external edit)