Skip to content

Commit 34faa2f

Browse files
committed
Use PHP 7.2+ code
1 parent 6e8380f commit 34faa2f

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

Symfony/Sniffs/Arrays/MultiLineArrayCommaSniff.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ public function process(File $phpcsFile, $stackPtr)
9696
while ($lastCommaPtr < $closePtr -1) {
9797
$lastCommaPtr++;
9898

99-
if ($tokens[$lastCommaPtr]['code'] !== T_WHITESPACE
100-
&& $tokens[$lastCommaPtr]['code'] !== T_PHPCS_IGNORE
101-
&& $tokens[$lastCommaPtr]['code'] !== T_COMMENT
99+
if (!in_array(
100+
$tokens[$lastCommaPtr]['code'],
101+
[T_WHITESPACE, T_PHPCS_IGNORE, T_COMMENT],
102+
true
103+
)
102104
) {
103105
$fix = $phpcsFile->addFixableError(
104106
'Add a comma after each item in a multi-line array',

Symfony/Sniffs/Classes/PropertyDeclarationSniff.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ public function process(File $phpcsFile, $stackPtr)
6868
{
6969
$tokens = $phpcsFile->getTokens();
7070

71-
$end = null;
72-
if (isset($tokens[$stackPtr]['scope_closer'])) {
73-
$end = $tokens[$stackPtr]['scope_closer'];
74-
}
71+
$end = $tokens[$stackPtr]['scope_closer'] ?? null;
7572

7673
$scope = $phpcsFile->findNext(
7774
T_FUNCTION,

Symfony/Sniffs/Commenting/AnnotationsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
class AnnotationsSniff implements Sniff
3030
{
31-
const PATTERN = '/^@([^\\\(]+).*$/i';
31+
private const PATTERN = '/^@([^\\\(]+).*$/i';
3232

3333
/**
3434
* Registers the tokens that this sniff wants to listen for.

Symfony/Sniffs/Functions/ScopeOrderSniff.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,7 @@ public function process(File $phpcsFile, $stackPtr)
8383
);
8484

8585
while ($function) {
86-
$end = null;
87-
88-
if (isset($tokens[$stackPtr]['scope_closer'])) {
89-
$end = $tokens[$stackPtr]['scope_closer'];
90-
}
86+
$end = $tokens[$stackPtr]['scope_closer'] ?? null;
9187

9288
$function = $phpcsFile->findNext(
9389
array(

0 commit comments

Comments
 (0)