diff --git a/src/Prophecy/Doubler/Generator/ClassMirror.php b/src/Prophecy/Doubler/Generator/ClassMirror.php index f5f3b7a4e..c69137867 100644 --- a/src/Prophecy/Doubler/Generator/ClassMirror.php +++ b/src/Prophecy/Doubler/Generator/ClassMirror.php @@ -31,15 +31,6 @@ */ class ClassMirror { - private const REFLECTABLE_METHODS = array( - '__construct', - '__destruct', - '__sleep', - '__wakeup', - '__toString', - '__call', - '__invoke' - ); /** * Reflects provided arguments into class node. @@ -116,11 +107,6 @@ private function reflectClassToNode(ReflectionClass $class, Node\ClassNode $node } foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { - if (0 === strpos($method->getName(), '_') - && !in_array($method->getName(), self::REFLECTABLE_METHODS)) { - continue; - } - if (true === $method->isFinal()) { $node->addUnextendableMethod($method->getName()); continue; diff --git a/tests/Doubler/Generator/ClassMirrorTest.php b/tests/Doubler/Generator/ClassMirrorTest.php index b77a9c3c3..271ae2492 100644 --- a/tests/Doubler/Generator/ClassMirrorTest.php +++ b/tests/Doubler/Generator/ClassMirrorTest.php @@ -302,7 +302,7 @@ public function it_reflects_all_interfaces_methods() /** * @test */ - public function it_ignores_virtually_private_methods() + public function it_does_not_ignores_virtually_private_methods() { $class = new \ReflectionClass('Fixtures\Prophecy\WithVirtuallyPrivateMethod'); @@ -310,10 +310,10 @@ public function it_ignores_virtually_private_methods() $classNode = $mirror->reflect($class, array()); - $this->assertCount(2, $classNode->getMethods()); + $this->assertCount(3, $classNode->getMethods()); $this->assertTrue($classNode->hasMethod('isAbstract')); $this->assertTrue($classNode->hasMethod('__toString')); - $this->assertFalse($classNode->hasMethod('_getName')); + $this->assertTrue($classNode->hasMethod('_getName')); } /**