Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a957d87

Browse files
committed
Add test case for happy path
1 parent 10027cd commit a957d87

6 files changed

+73
-0
lines changed

‎Magento2/Helpers/Commenting/PHPDocFormattingValidator.php‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
78
namespace Magento2\Helpers\Commenting;
89

910
use PHP_CodeSniffer\Files\File;
@@ -18,6 +19,7 @@ class PHPDocFormattingValidator
1819
*
1920
* @param int $startPtr
2021
* @param File $phpcsFile
22+
*
2123
* @return int
2224
*/
2325
public function findPHPDoc($startPtr, $phpcsFile)
@@ -53,6 +55,7 @@ public function findPHPDoc($startPtr, $phpcsFile)
5355
* @param int $namePtr
5456
* @param int $commentStartPtr
5557
* @param array $tokens
58+
*
5659
* @return bool
5760
*/
5861
public function providesMeaning($namePtr, $commentStartPtr, $tokens)
@@ -113,6 +116,7 @@ public function providesMeaning($namePtr, $commentStartPtr, $tokens)
113116
*
114117
* @param int $commentStartPtr
115118
* @param array $tokens
119+
*
116120
* @return bool
117121
*/
118122
public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
@@ -129,6 +133,7 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
129133
)) {
130134
return true;
131135
}
136+
132137
return false;
133138
}
134139

@@ -141,6 +146,7 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
141146
* @param string $tag
142147
* @param int $commentStartPtr
143148
* @param array $tokens
149+
*
144150
* @return int
145151
*/
146152
private function getTagPosition($tag, $commentStartPtr, $tokens)

‎Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,16 @@ class MethodAnnotationFixture
380380
return false;
381381
}
382382

383+
/**
384+
* This deprecated function is correct even though it only contains the @deprecated tag.
385+
*
386+
* @deprecated This method will be removed in version 123.45.6789 without replacement
387+
*/
388+
public function correctBecauseOfKeywordPhraseLongVersion()
389+
{
390+
return false;
391+
}
392+
383393
/**
384394
* This deprecated function is correct even though it only contains the @deprecated tag.
385395
*
@@ -389,4 +399,14 @@ class MethodAnnotationFixture
389399
{
390400
return false;
391401
}
402+
403+
/**
404+
* This deprecated function is correct even though it only contains the @deprecated tag.
405+
*
406+
* @deprecated WOW! This method will be removed in version 123.45.6789 without replacement
407+
*/
408+
public function alsoCorrectBecauseOfKeywordPhraseLongVersion()
409+
{
410+
return false;
411+
}
392412
}

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ class DeprecatedButHandler
171171

172172
}
173173

174+
/**
175+
* @deprecated This class will be removed in version 123.45.6789 without replacement
176+
*/
177+
class DeprecatedButHandlerLongVersion
178+
{
179+
180+
}
181+
174182
/**
175183
* @deprecated It's also deprecated - This class will be removed in version 1.0.0 without replacement
176184
*/
@@ -179,3 +187,10 @@ class AlsoDeprecatedButHandler
179187

180188
}
181189

190+
/**
191+
* @deprecated It's also deprecated - This class will be removed in version 123.45.6789 without replacement
192+
*/
193+
class AlsoDeprecatedButHandlerLongVersion
194+
{
195+
196+
}

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,26 @@ interface DeprecatedButHandler
162162

163163
}
164164

165+
/**
166+
* @deprecated This interface will be removed in version 123.45.6789 without replacement
167+
*/
168+
interface DeprecatedButHandlerLongVersion
169+
{
170+
171+
}
172+
165173
/**
166174
* @deprecated Yeah! This interface will be removed in version 1.0.0 without replacement
167175
*/
168176
interface AlsoDeprecatedButHandler
169177
{
170178

171179
}
180+
181+
/**
182+
* @deprecated Yeah! This interface will be removed in version 123.45.6789 without replacement
183+
*/
184+
interface AlsoDeprecatedButHandlerLongVersion
185+
{
186+
187+
}

‎Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ class correctlyFormattedClassMemberDocBlock
201201
*/
202202
protected string $deprecatedWithKeyword;
203203

204+
/**
205+
* @var string
206+
* @deprecated This property will be removed in version 123.45.6789 without replacement
207+
*/
208+
protected string $deprecatedWithKeywordLongVersion;
209+
204210
/**
205211
* @var string
206212
*/

‎Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,18 @@ class Profiler
6969
*/
7070
const KEYWORD_PHRASE = false;
7171

72+
/**
73+
* @deprecated This constant will be removed in version 123.45.6789 without replacement
74+
*/
75+
const KEYWORD_PHRASE_LONG_VERSION = false;
76+
7277
/**
7378
* @deprecated It's awesome - This constant will be removed in version 1.0.0 without replacement
7479
*/
7580
const WITH_KEYWORD_PHRASE = false;
81+
82+
/**
83+
* @deprecated It's awesome - This constant will be removed in version 123.45.6789 without replacement
84+
*/
85+
const WITH_KEYWORD_PHRASE_LONG_VERSION = false;
7686
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /