Skip to content

Commit

Permalink
Remove usage of @inheritdoc (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry committed Nov 28, 2019
1 parent d803a76 commit 9f51c11
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
29 changes: 29 additions & 0 deletions adr/0001-inheritdoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Inheritdoc usage [(#860)](https://github.com/infection/infection/issues/860)

### Decision

Do not use `@inheritdoc` tags or any of its variants.


###Status

Accepted


### Context

Using `@inheritdoc` was done inconsistently across the codebase so the decision of whether we use it
systematically or remove it systematically had to be done.

A number of points:

- [PHPDoc](https://docs.phpdoc.org/guides/inheritance.html) provides inheritance of the docblocks
by default when appropriate
- Static analysers such as PHPStan or Psalm can do without at the time of writting

Also it has a very limited value.


### Consequences

`@inheritdoc` tags and its variants must be removed when submitting pull requests.
9 changes: 0 additions & 9 deletions src/Locator/RootsFileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ public function __construct(array $roots, Filesystem $filesystem)
$this->filesystem = $filesystem;
}

/**
* {@inheritdoc}
*/
public function locate(string $fileName): string
{
$canonicalFileName = Path::canonicalize($fileName);
Expand All @@ -90,9 +87,6 @@ public function locate(string $fileName): string
throw FileNotFound::fromFileName($canonicalFileName, $this->roots);
}

/**
* {@inheritdoc}
*/
public function locateOneOf(array $fileNames): string
{
$file = $this->innerLocateOneOf($fileNames);
Expand All @@ -104,9 +98,6 @@ public function locateOneOf(array $fileNames): string
return $file;
}

/**
* {@inheritdoc}
*/
private function innerLocateOneOf(array $fileNames): ?string
{
if ($fileNames === []) {
Expand Down
6 changes: 0 additions & 6 deletions tests/phpunit/Configuration/ConfigurationFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,11 @@ final class ConfigurationFactoryTest extends TestCase
*/
private $configFactory;

/**
* {@inheritdoc}
*/
public static function tearDownAfterClass(): void
{
self::$mutators = null;
}

/**
* {@inheritdoc}
*/
protected function setUp(): void
{
$this->configFactory = new ConfigurationFactory(
Expand Down
9 changes: 0 additions & 9 deletions tests/phpunit/Fixtures/Mutator/Fake.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,15 @@

final class Fake extends Mutator
{
/**
* {@inheritdoc}
*/
public function __construct()
{
}

/**
* {@inheritdoc}
*/
public function mutate(Node $node): void
{
throw new \LogicException('Not expected to be called');
}

/**
* {@inheritdoc}
*/
protected function mutatesNode(Node $node): bool
{
throw new \LogicException('Not expected to be called');
Expand Down

0 comments on commit 9f51c11

Please sign in to comment.