/** * Suppress constructor in class * * @param string $classname * @throws PStub_Suppressor_Exception */ private function suppressConstructorInClass($classname) { $runkit = PStub_RunkitAdapter::getInstance(); try { $runkit->redefineConstructor($classname, '', ''); } catch (PStub_RunkitAdapter_Exception $e) { throw new PStub_Suppressor_Exception('Constructor suppression failed: ' . $e->getMessage()); } }
/** * Revert body to original * */ public function revertBody() { // if was not redefined, nothing to do if (!isset(self::$redefinedFunctionsBodies[$this->name])) { return; } $runkit = PStub_RunkitAdapter::getInstance(); try { $runkit->revertRedefinedFunction($this->name); } catch (PStub_RunkitAdapter_Exception $e) { // weird, but nothing criminal } unset(self::$redefinedFunctionsBodies[$this->name]); }
/** * Revert body to original * */ public function revertBody() { $classname = $this->getDeclaringClass()->getName(); // if was not redefined, nothing to do if (!isset(self::$redefinedMethodsBodies[$classname][$this->name])) { return; } $runkit = PStub_RunkitAdapter::getInstance(); try { $runkit->revertRedefinedMethod($classname, $this->name); } catch (PStub_RunkitAdapter_Exception $e) { // weird, but nothing criminal } unset(self::$redefinedMethodsBodies[$classname][$this->name]); }