Skip to content

Commit

Permalink
Merge pull request #181 from sinisa86/ticket-162
Browse files Browse the repository at this point in the history
#162 Modified @deprecated validator to consider it valid if comment is absent but @see tag is set
  • Loading branch information
lenaorobei authored Sep 2, 2020
2 parents ea0eb81 + 4bd4113 commit 7f6fd20
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Magento2/Helpers/Commenting/PHPDocFormattingValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,15 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
return true;
}

$seeTagRequired = false;
if ($tokens[$deprecatedPtr + 2]['code'] !== T_DOC_COMMENT_STRING) {
return false;
$seeTagRequired = true;
}

$seePtr = $this->getTagPosition('@see', $commentStartPtr, $tokens);
if ($seePtr === -1) {
return true;
return !$seeTagRequired;
}
if ($tokens[$seePtr + 2]['code'] !== T_DOC_COMMENT_STRING) {
return false;
}

return true;
return $tokens[$seePtr + 2]['code'] === T_DOC_COMMENT_STRING;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,12 @@ class DoNotCareHandler
{

}

/**
* @deprecated
* @see Magento\Framework\NewHandler
*/
class OldHandler
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ class Profiler
*/
const COMPUTER = 'Deep Thought';

/**
* @deprecated
* @see \ComputationalMatrix\Mars
*/
const KEYBOARD = 'Ergonomic';

/**
* @see
*/
Expand Down

0 comments on commit 7f6fd20

Please sign in to comment.