rfc:object-model-improvements

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
Next revisionBoth sides next revision
rfc:object-model-improvements [2011/02/25 22:45] martinscottarfc:object-model-improvements [2011/03/03 14:12] martinscotta
Line 27: Line 27:
   - class / interface   - class / interface
     * provide a magic constant with the fully qualified class name     * provide a magic constant with the fully qualified class name
-<code> +      <code php
-<?php + <?php 
-namespace Test {  + namespace Foo { 
- class Bar {} + class Baz {}  
- var_dump( Bar::CLASS ); // string "Test\Bar" + } 
-}</code>+ 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(PHPParseException $e) { 
 + echo $e->getMessage(); 
 + throw new DomainException($e); 
 +
 +      </code>
  
 ===== Changelog ===== ===== Changelog =====
rfc/object-model-improvements.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1