Skip to content

Commit 05e0dc4

Browse files
author
Vincent Langlet
committed
💄 Minor improvements
1 parent 96a8949 commit 05e0dc4

15 files changed

+64
-136
lines changed

Symfony3Custom/Sniffs/Classes/PropertyDeclarationSniff.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
*/
66
class Symfony3Custom_Sniffs_Classes_PropertyDeclarationSniff implements PHP_CodeSniffer_Sniff
77
{
8-
/**
9-
* A list of tokenizers this sniff supports.
10-
*
11-
* @var array
12-
*/
13-
public $supportedTokenizers = array(
14-
'PHP',
15-
);
16-
178
/**
189
* Returns an array of tokens this test wants to listen for.
1910
*

Symfony3Custom/Sniffs/Commenting/DocCommentForbiddenTagsSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ class Symfony3Custom_Sniffs_Commenting_DocCommentForbiddenTagsSniff implements P
2222
*/
2323
public function register()
2424
{
25-
return array(T_DOC_COMMENT_TAG);
25+
return array(
26+
T_DOC_COMMENT_TAG
27+
);
2628
}
2729

2830
/**

Symfony3Custom/Sniffs/Commenting/DocCommentGroupSameTypeSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class Symfony3Custom_Sniffs_Commenting_DocCommentGroupSameTypeSniff implements P
4848
*/
4949
public function register()
5050
{
51-
return array(T_DOC_COMMENT_OPEN_TAG);
51+
return array(
52+
T_DOC_COMMENT_OPEN_TAG
53+
);
5254
}
5355

5456
/**

Symfony3Custom/Sniffs/Commenting/FunctionCommentSniff.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
117117
$this->processParams($phpcsFile, $stackPtr, $commentStart);
118118
$this->processThrows($phpcsFile, $stackPtr, $commentStart);
119119
} else {
120-
$this->processWhitespace($phpcsFile, $commentStart, $hasComment);
121-
122120
if (count($realParams) > 0) {
123121
foreach ($realParams as $neededParam) {
124122
$error = 'Doc comment for parameter "%s" missing';
@@ -127,6 +125,8 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
127125
}
128126
}
129127
}
128+
129+
$this->processWhitespace($phpcsFile, $commentStart);
130130
}
131131

132132
/**
@@ -284,8 +284,6 @@ protected function processParams(
284284
return;
285285
}
286286

287-
$this->processWhitespace($phpcsFile, $commentStart);
288-
289287
parent::processParams($phpcsFile, $stackPtr, $commentStart);
290288
}
291289

Symfony3Custom/Sniffs/Commenting/VariableCommentSniff.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ protected function processWhitespace(
114114
$found = $startLine - $prevLine - 1;
115115

116116
// Skip for class opening
117-
if ($found < 1 && !(0 === $found && 'T_OPEN_CURLY_BRACKET' === $tokens[$before]['type'])) {
117+
if ($found < 1
118+
&& !(0 === $found
119+
&& 'T_OPEN_CURLY_BRACKET' === $tokens[$before]['type'])
120+
) {
118121
if ($found < 0) {
119122
$found = 0;
120123
}

Symfony3Custom/Sniffs/Formatting/BlankLineBeforeReturnSniff.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,16 @@
77
*/
88
class Symfony3Custom_Sniffs_Formatting_BlankLineBeforeReturnSniff implements PHP_CodeSniffer_Sniff
99
{
10-
/**
11-
* A list of tokenizers this sniff supports.
12-
*
13-
* @var array
14-
*/
15-
public $supportedTokenizers = array(
16-
'PHP',
17-
'JS',
18-
);
19-
2010
/**
2111
* Returns an array of tokens this test wants to listen for.
2212
*
2313
* @return array
2414
*/
2515
public function register()
2616
{
27-
return array(T_RETURN);
17+
return array(
18+
T_RETURN
19+
);
2820
}
2921

3022
/**

Symfony3Custom/Sniffs/Functions/ScopeOrderSniff.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
*/
66
class Symfony3Custom_Sniffs_Functions_ScopeOrderSniff implements PHP_CodeSniffer_Sniff
77
{
8-
/**
9-
* A list of tokenizers this sniff supports.
10-
*
11-
* @var array
12-
*/
13-
public $supportedTokenizers = array(
14-
'PHP',
15-
);
16-
178
/**
189
* Returns an array of tokens this test wants to listen for.
1910
*

Symfony3Custom/Sniffs/NamingConventions/ValidClassNameSniff.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
*/
66
class Symfony3Custom_Sniffs_NamingConventions_ValidClassNameSniff implements PHP_CodeSniffer_Sniff
77
{
8-
/**
9-
* A list of tokenizers this sniff supports.
10-
*
11-
* @var array
12-
*/
13-
public $supportedTokenizers = array(
14-
'PHP',
15-
);
16-
178
/**
189
* Returns an array of tokens this test wants to listen for.
1910
*

Symfony3Custom/Sniffs/Objects/ObjectInstantiationSniff.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
*/
66
class Symfony3Custom_Sniffs_Objects_ObjectInstantiationSniff implements PHP_CodeSniffer_Sniff
77
{
8-
/**
9-
* A list of tokenizers this sniff supports.
10-
*
11-
* @var array
12-
*/
13-
public $supportedTokenizers = array(
14-
'PHP',
15-
);
16-
178
/**
189
* Returns an array of tokens this test wants to listen for.
1910
*

Symfony3Custom/Sniffs/WhiteSpace/CloseBracketSpacingSniff.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@
66
*/
77
class Symfony3Custom_Sniffs_WhiteSpace_CloseBracketSpacingSniff implements PHP_CodeSniffer_Sniff
88
{
9-
/**
10-
* A list of tokenizers this sniff supports.
11-
*
12-
* @var array
13-
*/
14-
public $supportedTokenizers = array(
15-
'PHP',
16-
'JS',
17-
);
18-
199
/**
2010
* Returns an array of tokens this test wants to listen for.
2111
*
@@ -42,13 +32,6 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
4232
{
4333
$tokens = $phpcsFile->getTokens();
4434

45-
// Ignore curly brackets in javascript files.
46-
if (T_CLOSE_CURLY_BRACKET === $tokens[$stackPtr]['code']
47-
&& 'JS' === $phpcsFile->tokenizerType
48-
) {
49-
return;
50-
}
51-
5235
if (isset($tokens[($stackPtr - 1)]) === true
5336
&& T_WHITESPACE === $tokens[($stackPtr - 1)]['code']
5437
) {

0 commit comments

Comments
 (0)