Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/Prophecy/Doubler/Generator/ClassMirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
*/
class ClassMirror
{
private const REFLECTABLE_METHODS = array(
'__construct',
'__destruct',
'__sleep',
'__wakeup',
'__toString',
'__call',
'__invoke'
);

/**
* Reflects provided arguments into class node.
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions tests/Doubler/Generator/ClassMirrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,18 @@ 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');

$mirror = new ClassMirror();

$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'));
}

/**
Expand Down