4 * This file is part of the Prophecy.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6 * Marcello Duarte <marcello.duarte@gmail.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Prophecy\Doubler\ClassPatch;
14 use Prophecy\Doubler\Generator\Node\ClassNode;
17 * Exception patch for HHVM to remove the stubs from special methods
19 * @author Christophe Coevoet <stof@notk.org>
21 class HhvmExceptionPatch implements ClassPatchInterface
24 * Supports exceptions on HHVM.
26 * @param ClassNode $node
30 public function supports(ClassNode $node)
32 if (!defined('HHVM_VERSION')) {
36 return 'Exception' === $node->getParentClass() || is_subclass_of($node->getParentClass(), 'Exception');
40 * Removes special exception static methods from the doubled methods.
42 * @param ClassNode $node
46 public function apply(ClassNode $node)
48 if ($node->hasMethod('setTraceOptions')) {
49 $node->getMethod('setTraceOptions')->useParentCode();
51 if ($node->hasMethod('getTraceOptions')) {
52 $node->getMethod('getTraceOptions')->useParentCode();
59 public function getPriority()