Skip to content

Commit 60dee90

Browse files
authored
Merge pull request #192 from magento-commerce/imported-loginesta-magento-coding-standard-419
[Imported] Allow to skip see tag in annotation with specific deprecated comment
2 parents c2e4f0a + 246c67b commit 60dee90

6 files changed

+75
-0
lines changed

Magento2/Helpers/Commenting/PHPDocFormattingValidator.php

+6
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
123123
}
124124
$seePtr = $this->getTagPosition('@see', $commentStartPtr, $tokens);
125125
if ($seePtr === -1) {
126+
if (preg_match(
127+
"/This [a-zA-Z]* will be removed in version \d.\d.\d without replacement/",
128+
$tokens[$deprecatedPtr + 2]['content']
129+
)) {
130+
return true;
131+
}
126132
return false;
127133
}
128134

Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc

+20
Original file line numberDiff line numberDiff line change
@@ -369,4 +369,24 @@ class MethodAnnotationFixture
369369
{
370370
return true;
371371
}
372+
373+
/**
374+
* This deprecated function is correct even though it only contains the @deprecated tag.
375+
*
376+
* @deprecated This method will be removed in version 1.0.0 without replacement
377+
*/
378+
public function correctBecauseOfKeywordPhrase()
379+
{
380+
return false;
381+
}
382+
383+
/**
384+
* This deprecated function is correct even though it only contains the @deprecated tag.
385+
*
386+
* @deprecated WOW! This method will be removed in version 1.0.0 without replacement
387+
*/
388+
public function alsoCorrectBecauseOfKeywordPhrase()
389+
{
390+
return false;
391+
}
372392
}

Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc

+17
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,20 @@ class OldHandler
162162
{
163163

164164
}
165+
166+
/**
167+
* @deprecated This class will be removed in version 1.0.0 without replacement
168+
*/
169+
class DeprecatedButHandler
170+
{
171+
172+
}
173+
174+
/**
175+
* @deprecated It's also deprecated - This class will be removed in version 1.0.0 without replacement
176+
*/
177+
class AlsoDeprecatedButHandler
178+
{
179+
180+
}
181+

Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc

+16
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,19 @@ interface DoNotCareHandler
153153
{
154154

155155
}
156+
157+
/**
158+
* @deprecated This interface will be removed in version 1.0.0 without replacement
159+
*/
160+
interface DeprecatedButHandler
161+
{
162+
163+
}
164+
165+
/**
166+
* @deprecated Yeah! This interface will be removed in version 1.0.0 without replacement
167+
*/
168+
interface AlsoDeprecatedButHandler
169+
{
170+
171+
}

Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc

+6
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,10 @@ class correctlyFormattedClassMemberDocBlock
194194
* @see Message with some reference
195195
*/
196196
protected string $itIsCorrect;
197+
198+
/**
199+
* @var string
200+
* @deprecated This property will be removed in version 1.0.0 without replacement
201+
*/
202+
protected string $deprecatedWithKeyword;
197203
}

Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc

+10
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,14 @@ class Profiler
6363
* @see
6464
*/
6565
const d = 100;
66+
67+
/**
68+
* @deprecated This constant will be removed in version 1.0.0 without replacement
69+
*/
70+
const KEYWORD_PHRASE = false;
71+
72+
/**
73+
* @deprecated It's awesome - This constant will be removed in version 1.0.0 without replacement
74+
*/
75+
const WITH_KEYWORD_PHRASE = false;
6676
}

0 commit comments

Comments
 (0)