-
-
Notifications
You must be signed in to change notification settings - Fork 736
Open
Labels
Description
Bug Report
Rector adds a Docblock for methods even though they override methods with existing Docblocks.
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/9dc1a1da-6e22-4297-85ba-03a40194ce65
<?php
declare(strict_types=1);
interface FooInterface
{
/**
* @return int[]
*/
public function getCodes(): iterable;
}
readonly abstract class FooBase
{
/**
* @return string[]
*/
abstract public function getMethods(): iterable;
}
readonly class Foo extends FooBase implements FooInterface
{
#[Override]
public function getCodes(): iterable
{
return [
200,
201,
];
}
#[Override]
public function getMethods(): iterable
{
return [
'GET',
'POST',
];
}
/**
* @return string[]
*/
public function getProtocols(): iterable
{
return [
'http',
'https',
];
}
}Responsible rules
DocblockReturnArrayFromDirectArrayInstanceRector
Expected Behavior
Rector should not add a Docblock to methods which override a method with existing Docblock.