Skip to content

Commit

Permalink
Remove redundand comments in PhpDocController (#18968)
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSilence committed Oct 21, 2021
1 parent d80974d commit dd1ed63
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions build/controllers/PhpDocController.php
Original file line number Diff line number Diff line change
Expand Up @@ -733,19 +733,17 @@ protected function generateClassPropertyDocs($fileName)
$docLine = ' * @property';
$note = '';
if (isset($prop['get'], $prop['set'])) {
if ($prop['get']['type'] != $prop['set']['type']) {
if ($prop['get']['type'] !== $prop['set']['type']) {
$note = ' Note that the type of this property differs in getter and setter.'
. ' See [[get' . ucfirst($propName) . '()]]'
. ' and [[set' . ucfirst($propName) . '()]] for details.';
}
} elseif (isset($prop['get'])) {
if (!$this->hasSetterInParents($className, $propName)) {
$note = ' This property is read-only.';
$docLine .= '-read';
}
} elseif (isset($prop['set'])) {
if (!$this->hasGetterInParents($className, $propName)) {
$note = ' This property is write-only.';
$docLine .= '-write';
}
} else {
Expand All @@ -754,7 +752,7 @@ protected function generateClassPropertyDocs($fileName)
$docLine .= ' ' . $this->getPropParam($prop, 'type') . " $$propName ";
$comment = explode("\n", $this->getPropParam($prop, 'comment') . $note);
foreach ($comment as &$cline) {
$cline = ltrim($cline, '* ');
$cline = ltrim(rtrim($cline), '* ');
}
$docLine = wordwrap($docLine . implode(' ', $comment), 110, "\n * ") . "\n";

Expand Down

0 comments on commit dd1ed63

Please sign in to comment.