Skip to content

Commit 740410b

Browse files
Fixed false positive finding
1 parent 5fd88b5 commit 740410b

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
namespace Magento2\Sniffs\Commenting;
33

44
use PHP_CodeSniffer\Files\File;
5-
use PHP_CodeSniffer\Sniffs\Sniff;
5+
use PHP_CodeSniffer\Sniffs\AbstractVariableSniff;
66

7-
class ClassPropertyPHPDocFormattingSniff implements Sniff
7+
/**
8+
* Class ClassPropertyPHPDocFormattingSniff
9+
*/
10+
class ClassPropertyPHPDocFormattingSniff extends AbstractVariableSniff
811
{
912

13+
/**
14+
* @var array
15+
*/
1016
private $ignoreTokens = [
1117
T_PUBLIC,
1218
T_PRIVATE,
@@ -17,19 +23,11 @@ class ClassPropertyPHPDocFormattingSniff implements Sniff
1723
];
1824

1925
/**
20-
* @inheritDoc
26+
* @param File $phpcsFile
27+
* @param int $stackPtr
28+
* @return int|void
2129
*/
22-
public function register()
23-
{
24-
return [
25-
T_VARIABLE
26-
];
27-
}
28-
29-
/**
30-
* @inheritDoc
31-
*/
32-
public function process(File $phpcsFile, $stackPtr)
30+
public function processMemberVar(File $phpcsFile, $stackPtr)
3331
{
3432
$tokens = $phpcsFile->getTokens();
3533

@@ -69,4 +67,24 @@ public function process(File $phpcsFile, $stackPtr)
6967
return;
7068
}
7169
}
70+
71+
/**
72+
* @param File $phpcsFile
73+
* @param int $stackPtr
74+
* @return int|void
75+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
76+
*/
77+
protected function processVariable(File $phpcsFile, $stackPtr)
78+
{
79+
}
80+
81+
/**
82+
* @param File $phpcsFile
83+
* @param int $stackPtr
84+
* @return int|void
85+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
86+
*/
87+
protected function processVariableInString(File $phpcsFile, $stackPtr)
88+
{
89+
}
7290
}

Magento2/Sniffs/Exceptions/DirectThrowSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class DirectThrowSniff implements Sniff
1616
/**
1717
* String representation of warning.
1818
* phpcs:disable Generic.Files.LineLength.TooLong
19+
* @var string
1920
*/
2021
protected $warningMessage = 'Direct throw of generic Exception is discouraged. Use context specific instead.';
2122
//phpcs:enable

Magento2/Sniffs/Security/SuperglobalSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class SuperglobalSniff implements Sniff
4242
protected $errorCode = 'SuperglobalUsageError';
4343

4444
/**
45-
* @inheritdoc
45+
* @var array
4646
*/
4747
protected $superGlobalErrors = [
4848
'$GLOBALS',
@@ -55,7 +55,7 @@ class SuperglobalSniff implements Sniff
5555
];
5656

5757
/**
58-
* @inheritdoc
58+
* @var array
5959
*/
6060
protected $superGlobalWarning = [
6161
'$_COOKIE', //sometimes need to get list of all cookies array and there are no methods to do that in M2

0 commit comments

Comments
 (0)