Skip to content
Permalink
Browse files

Fix #2013 - don’t add more specific return type when @inheritdoc present

  • Loading branch information...
muglug committed Sep 1, 2019
1 parent 914ef5a commit b4178c7ee17825c1374aa458ed2fca164e8c8940
@@ -493,6 +493,7 @@ public static function verifyReturnType(
} elseif ($codebase->alter_code
&& isset($project_analyzer->getIssuesToFix()['LessSpecificReturnType'])
&& !in_array('LessSpecificReturnType', $suppressed_issues)
&& !($function_like_storage instanceof MethodStorage && $function_like_storage->inheritdoc)
) {
if (!TypeAnalyzer::isContainedBy(
$codebase,
@@ -1316,6 +1316,40 @@ public function foo(): array {
false,
true,
],
'dontAlterForLessSpecificReturnTypeWhenInheritDocPresent' => [
'<?php
class A {
/** @return A */
public function getMe() {
return $this;
}
}
class B extends A {
/** @inheritdoc */
public function getMe() {
return $this;
}
}',
'<?php
class A {
/** @return A */
public function getMe() {
return $this;
}
}
class B extends A {
/** @inheritdoc */
public function getMe() {
return $this;
}
}',
'7.3',
['LessSpecificReturnType'],
false,
true,
],
];
}
}

0 comments on commit b4178c7

Please sign in to comment.
You can’t perform that action at this time.