Skip to content

Commit

Permalink
Fix non-abstract class contains abstract method with more than one-le…
Browse files Browse the repository at this point in the history
…vel parent class away
  • Loading branch information
ondrejmirtes committed Jun 14, 2020
1 parent 375f411 commit d8a0735
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"nette/utils": "^3.1.1",
"nikic/php-parser": "^4.5.0",
"ondram/ci-detector": "^3.1",
"ondrejmirtes/better-reflection": "^4.3.9",
"ondrejmirtes/better-reflection": "^4.3.10",
"phpdocumentor/type-resolver": "1.0.1",
"phpstan/phpdoc-parser": "^0.4.8",
"react/child-process": "^0.6.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ public function testRule(): void
]);
}

public function testBug3469(): void
{
$this->analyse([__DIR__ . '/data/bug-3469.php'], []);
}

}
29 changes: 29 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-3469.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Bug3469;

abstract class Tile{
abstract protected function readSaveData() : void;

abstract protected function writeSaveData() : void;
}


abstract class Spawnable extends Tile{
}

trait NameableTrait{

protected function loadName() : void{
}

protected function saveName() : void{
}
}

class EnchantTable extends Spawnable{
use NameableTrait {
loadName as readSaveData;
saveName as writeSaveData;
}
}

0 comments on commit d8a0735

Please sign in to comment.