Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Fixture;

use Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Source\ParentWithoutConstructor;

class RemovedEmptyConstructWhenNoParentConstruct extends ParentWithoutConstructor
{
public function __construct()
{
}
}

?>
-----
<?php

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Fixture;

use Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Source\ParentWithoutConstructor;

class RemovedEmptyConstructWhenNoParentConstruct extends ParentWithoutConstructor
{
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Fixture;

use Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Source\TraitWithConstructor;

class SkipConstructFromTrait
{
use TraitWithConstructor;

public function __construct()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Source;

class ParentWithoutConstructor
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector\Source;

trait TraitWithConstructor
{
public function __construct()
{
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ private function shouldSkipClassMethod(Class_ $class, ClassMethod $classMethod):
return true;
}

if ($this->isName($classMethod, MethodName::CONSTRUCT)) {
// has parent class?
return $class->extends instanceof FullyQualified;
}

if ($this->isName($classMethod, MethodName::CLONE)) {
return ! $classMethod->isPublic();
}
Expand Down
Loading