Example #1
0
 public static function defineCloseableSubclasses()
 {
     self::$closes = ClassLoader::defineClass('_WithTest_C0', Object::class, [Closeable::class], '{
   public $closed= false;
   public function close() { $this->closed= true; }
 }');
     self::$raises = ClassLoader::defineClass('_WithTest_C1', Object::class, [Closeable::class], '{
   public function close() { throw new \\lang\\IllegalArgumentException("Cannot close"); }
 }');
 }
Example #2
0
 public static function defineCloseableSubclasses()
 {
     self::$closes = ClassLoader::defineClass('_WithTest_C0', Object::class, [Closeable::class], '{
   public $closed= false;
   public function close() { $this->closed= true; }
 }');
     self::$raises = ClassLoader::defineClass('_WithTest_C1', Object::class, [Closeable::class], '{
   private $throwable;
   public function __construct($class) { $this->throwable= $class; }
   public function close() { throw new $this->throwable("Cannot close"); }
 }');
 }