1: <?php
2:
3: namespace Mockery\Generator\StringManipulation\Pass;
4:
5: use Mockery\Generator\MockConfiguration;
6:
7: 8: 9: 10: 11: 12:
13: class RemoveBuiltinMethodsThatAreFinalPass
14: {
15: protected $methods = array(
16: '__wakeup' => '/public function __wakeup\(\)\s+\{.*?\}/sm',
17: );
18:
19: public function apply($code, MockConfiguration $config)
20: {
21: $target = $config->getTargetClass();
22:
23: if (!$target) {
24: return $code;
25: }
26:
27: foreach ($target->getMethods() as $method) {
28: if ($method->isFinal() && isset($this->methods[$method->getName()])) {
29: $code = preg_replace($this->methods[$method->getName()], '', $code);
30: }
31: }
32:
33: return $code;
34: }
35:
36: }
37: