Skip to content

Commit 6a3f52f

Browse files
committed
magento#162 Modified @deprecated validator to consider it valid if comment is absent but @see tag is set
1 parent 919dcc1 commit 6a3f52f

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Magento2/Helpers/Commenting/PHPDocFormattingValidator.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,18 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
122122
return true;
123123
}
124124

125+
$seeTagRequired = false;
125126
if ($tokens[$deprecatedPtr + 2]['code'] !== T_DOC_COMMENT_STRING) {
126-
return false;
127+
$seeTagRequired = true;
127128
}
128129

129130
$seePtr = $this->getTagPosition('@see', $commentStartPtr, $tokens);
130131
if ($seePtr === -1) {
131-
return true;
132+
if ($seeTagRequired) {
133+
return false;
134+
} else {
135+
return true;
136+
}
132137
}
133138
if ($tokens[$seePtr + 2]['code'] !== T_DOC_COMMENT_STRING) {
134139
return false;

Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,12 @@ class DoNotCareHandler
153153
{
154154

155155
}
156+
157+
/**
158+
* @deprecated
159+
* @see Magento\Framework\NewHandler
160+
*/
161+
class OldHandler
162+
{
163+
164+
}

Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.1.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ class Profiler
3838
*/
3939
const COMPUTER = 'Deep Thought';
4040

41+
/**
42+
* @deprecated
43+
* @see \ComputationalMatrix\Mars
44+
*/
45+
const KEYBOARD = 'Ergonomic';
46+
4147
/**
4248
* @see
4349
*/

0 commit comments

Comments
 (0)