Skip to content

Commit 97cc661

Browse files
added correct formatted examples
1 parent 740410b commit 97cc661

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
5656

5757
if ($foundVar === null) {
5858
$error = 'Missing @var tag in class property comment';
59-
$phpcsFile->addWarning($error, $commentEnd, 'MissingVar');
59+
$phpcsFile->addWarning($error, $stackPtr, 'MissingVar');
6060
return;
6161
}
6262

Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ class Foo
1010
/**
1111
* Foo
1212
*/
13-
private $_withoutClassAttribute = '';
13+
public $_withoutClassAttribute = '';
1414

1515
/**
1616
* @var Test
1717
*
1818
* Short Description
1919
*/
20-
private $_classAttributeWithShortDescription = '';
20+
protected $_classAttributeWithShortDescription = '';
2121

2222
/**
2323
* @var
@@ -33,3 +33,27 @@ class Foo
3333

3434
private $_missingDocBlockClassAttribute = '';
3535
}
36+
37+
class Bar {
38+
39+
/**
40+
* @var correctlyFormattedPublicClassMember
41+
*
42+
* Short Description
43+
*/
44+
public $correctlyFormattedPublicClassMember;
45+
46+
/**
47+
* @var correctlyFormattedPrivateClassMember
48+
*
49+
* Short Description
50+
*/
51+
private $correctlyFormattedPrivateClassMember;
52+
53+
/**
54+
* @var correctlyFormattedProtectedClassMember
55+
*
56+
* Short Description
57+
*/
58+
protected $correctlyFormattedProtectedClassMember;
59+
}

Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getErrorList()
2323
public function getWarningList()
2424
{
2525
return [
26-
12 => 1,
26+
13 => 1,
2727
23 => 1,
2828
30 => 1,
2929
34 => 1

0 commit comments

Comments
 (0)