Skip to content

Commit 7f6fd20

Browse files
authored
Merge pull request #181 from sinisa86/ticket-162
#162 Modified @deprecated validator to consider it valid if comment is absent but @see tag is set
2 parents ea0eb81 + 4bd4113 commit 7f6fd20

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

Magento2/Helpers/Commenting/PHPDocFormattingValidator.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,15 @@ 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
}
128-
129129
$seePtr = $this->getTagPosition('@see', $commentStartPtr, $tokens);
130130
if ($seePtr === -1) {
131-
return true;
131+
return !$seeTagRequired;
132132
}
133-
if ($tokens[$seePtr + 2]['code'] !== T_DOC_COMMENT_STRING) {
134-
return false;
135-
}
136-
137-
return true;
133+
return $tokens[$seePtr + 2]['code'] === T_DOC_COMMENT_STRING;
138134
}
139135

140136
/**

Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc

+9
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

+6
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)