GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 699b70...879176 )
by Chris
13:23
created
fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/EmptyEnclosingLineSniff.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,54 +26,54 @@
 block discarded – undo
26 26
 	/**
27 27
 	 * @inheritDoc
28 28
 	 */
29
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
29
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
30 30
 		$tokens = $phpcsFile->getTokens();
31
-		$errorData = [strtolower($tokens[$stackPtr]['content'])];
31
+		$errorData = [ strtolower( $tokens[ $stackPtr ][ 'content' ] ) ];
32 32
 
33
-		if (isset($tokens[$stackPtr]['scope_opener']) === false) {
33
+		if ( isset( $tokens[ $stackPtr ][ 'scope_opener' ] ) === false ) {
34 34
 			$error = 'Possible parse error: %s missing opening or closing brace';
35
-			$phpcsFile->addWarning($error, $stackPtr, 'MissingBrace', $errorData);
35
+			$phpcsFile->addWarning( $error, $stackPtr, 'MissingBrace', $errorData );
36 36
 			return;
37 37
 		}
38 38
 
39
-		$curlyBraceStartIndex = $tokens[$stackPtr]['scope_opener'];
40
-		$curlyBraceEndIndex = $tokens[$stackPtr]['scope_closer'];
39
+		$curlyBraceStartIndex = $tokens[ $stackPtr ][ 'scope_opener' ];
40
+		$curlyBraceEndIndex = $tokens[ $stackPtr ][ 'scope_closer' ];
41 41
 
42
-		$lastContentIndex = $phpcsFile->findPrevious(T_WHITESPACE, ($curlyBraceEndIndex - 1), $stackPtr, true);
42
+		$lastContentIndex = $phpcsFile->findPrevious( T_WHITESPACE, ( $curlyBraceEndIndex - 1 ), $stackPtr, true );
43 43
 
44
-		if ($lastContentIndex === $curlyBraceStartIndex) {
44
+		if ( $lastContentIndex === $curlyBraceStartIndex ) {
45 45
 			// Single new line for empty classes
46
-			if ($tokens[$curlyBraceEndIndex]['line'] === $tokens[$curlyBraceStartIndex]['line'] + 1) {
46
+			if ( $tokens[ $curlyBraceEndIndex ][ 'line' ] === $tokens[ $curlyBraceStartIndex ][ 'line' ] + 1 ) {
47 47
 				return;
48 48
 			}
49 49
 
50 50
 			$error = 'Closing brace of an empty %s must have a single new line between curly brackets';
51 51
 
52
-			$fix = $phpcsFile->addFixableError($error, $curlyBraceEndIndex, 'CloseBraceNewLine', $errorData);
53
-			if ($fix === true) {
54
-				if ($curlyBraceEndIndex - $curlyBraceStartIndex === 1) {
55
-					$phpcsFile->fixer->addNewline($curlyBraceStartIndex);
52
+			$fix = $phpcsFile->addFixableError( $error, $curlyBraceEndIndex, 'CloseBraceNewLine', $errorData );
53
+			if ( $fix === true ) {
54
+				if ( $curlyBraceEndIndex - $curlyBraceStartIndex === 1 ) {
55
+					$phpcsFile->fixer->addNewline( $curlyBraceStartIndex );
56 56
 				} else {
57
-					$phpcsFile->fixer->replaceToken($curlyBraceStartIndex + 1, '');
58
-					$phpcsFile->fixer->addNewline($curlyBraceStartIndex + 1);
57
+					$phpcsFile->fixer->replaceToken( $curlyBraceStartIndex + 1, '' );
58
+					$phpcsFile->fixer->addNewline( $curlyBraceStartIndex + 1 );
59 59
 				}
60 60
 			}
61 61
 			return;
62 62
 		}
63 63
 
64
-		$contentLine = $tokens[$lastContentIndex]['line'];
65
-		$braceLine = $tokens[$curlyBraceEndIndex]['line'];
64
+		$contentLine = $tokens[ $lastContentIndex ][ 'line' ];
65
+		$braceLine = $tokens[ $curlyBraceEndIndex ][ 'line' ];
66 66
 
67
-		if ($braceLine !== $contentLine + 2) {
68
-			$phpcsFile->recordMetric($stackPtr, 'Class closing brace placement', 'lines');
67
+		if ( $braceLine !== $contentLine + 2 ) {
68
+			$phpcsFile->recordMetric( $stackPtr, 'Class closing brace placement', 'lines' );
69 69
 			$error = 'Closing brace of a %s must have a new line between itself and the last content.';
70 70
 
71
-			$fix = $phpcsFile->addFixableError($error, $curlyBraceEndIndex, 'CloseBraceNewLine', $errorData);
72
-			if ($fix === true) {
73
-				if ($braceLine < $contentLine + 2) {
74
-					$phpcsFile->fixer->addNewlineBefore($curlyBraceEndIndex);
71
+			$fix = $phpcsFile->addFixableError( $error, $curlyBraceEndIndex, 'CloseBraceNewLine', $errorData );
72
+			if ( $fix === true ) {
73
+				if ( $braceLine < $contentLine + 2 ) {
74
+					$phpcsFile->fixer->addNewlineBefore( $curlyBraceEndIndex );
75 75
 				} else {
76
-					$phpcsFile->fixer->replaceToken($curlyBraceEndIndex - 1, '');
76
+					$phpcsFile->fixer->replaceToken( $curlyBraceEndIndex - 1, '' );
77 77
 				}
78 78
 			}
79 79
 		}
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/TabIndentSniff.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,37 +27,37 @@  discard block
 block discarded – undo
27 27
 	 * @inheritDoc
28 28
 	 */
29 29
 	public function register() {
30
-		return [T_WHITESPACE, T_DOC_COMMENT_OPEN_TAG];
30
+		return [ T_WHITESPACE, T_DOC_COMMENT_OPEN_TAG ];
31 31
 	}
32 32
 
33 33
 	/**
34 34
 	 * @inheritDoc
35 35
 	 */
36
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
36
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
37 37
 		$tokens = $phpcsFile->getTokens();
38 38
 
39
-		if ($tokens[$stackPtr]['code'] !== T_WHITESPACE) {
39
+		if ( $tokens[ $stackPtr ][ 'code' ] !== T_WHITESPACE ) {
40 40
 			// Doc block
41
-			if (empty($tokens[$stackPtr]['comment_closer'])) {
41
+			if ( empty( $tokens[ $stackPtr ][ 'comment_closer' ] ) ) {
42 42
 				return;
43 43
 			}
44 44
 
45
-			for ($i = $stackPtr + 1; $i < $tokens[$stackPtr]['comment_closer']; $i++) {
46
-				if ($tokens[$i]['code'] === 'PHPCS_T_DOC_COMMENT_WHITESPACE' && $tokens[$i]['column'] === 1) {
47
-					$this->fixTab($phpcsFile, $i, $tokens);
48
-				} elseif ($tokens[$i]['code'] === 'PHPCS_T_DOC_COMMENT_WHITESPACE') {
49
-					$this->fixSpace($phpcsFile, $i, $tokens);
45
+			for ( $i = $stackPtr + 1; $i < $tokens[ $stackPtr ][ 'comment_closer' ]; $i++ ) {
46
+				if ( $tokens[ $i ][ 'code' ] === 'PHPCS_T_DOC_COMMENT_WHITESPACE' && $tokens[ $i ][ 'column' ] === 1 ) {
47
+					$this->fixTab( $phpcsFile, $i, $tokens );
48
+				} elseif ( $tokens[ $i ][ 'code' ] === 'PHPCS_T_DOC_COMMENT_WHITESPACE' ) {
49
+					$this->fixSpace( $phpcsFile, $i, $tokens );
50 50
 				}
51 51
 			}
52 52
 			return;
53 53
 		}
54 54
 
55
-		$line = $tokens[$stackPtr]['line'];
56
-		if ($stackPtr > 0 && $tokens[($stackPtr - 1)]['line'] === $line) {
55
+		$line = $tokens[ $stackPtr ][ 'line' ];
56
+		if ( $stackPtr > 0 && $tokens[ ( $stackPtr - 1 ) ][ 'line' ] === $line ) {
57 57
 			return;
58 58
 		}
59 59
 
60
-		$this->fixTab($phpcsFile, $stackPtr, $tokens);
60
+		$this->fixTab( $phpcsFile, $stackPtr, $tokens );
61 61
 	}
62 62
 
63 63
 	/**
@@ -66,19 +66,19 @@  discard block
 block discarded – undo
66 66
 	 * @param array $tokens
67 67
 	 * @return void
68 68
 	 */
69
-	protected function fixTab(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens) {
70
-		$content = $tokens[$stackPtr]['content'];
69
+	protected function fixTab( PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens ) {
70
+		$content = $tokens[ $stackPtr ][ 'content' ];
71 71
 		$tabs = 0;
72
-		while (strpos($content, '    ') === 0) {
73
-			$content = substr($content, 4);
72
+		while ( strpos( $content, '    ' ) === 0 ) {
73
+			$content = substr( $content, 4 );
74 74
 			$tabs++;
75 75
 		}
76 76
 
77
-		if ($tabs) {
78
-			$error = ($tabs * 4) . ' spaces found, expected ' . $tabs . ' tabs';
79
-			$fix = $phpcsFile->addFixableError($error, $stackPtr);
80
-			if ($fix) {
81
-				$phpcsFile->fixer->replaceToken($stackPtr, str_repeat("\t", $tabs) . $content);
77
+		if ( $tabs ) {
78
+			$error = ( $tabs * 4 ) . ' spaces found, expected ' . $tabs . ' tabs';
79
+			$fix = $phpcsFile->addFixableError( $error, $stackPtr );
80
+			if ( $fix ) {
81
+				$phpcsFile->fixer->replaceToken( $stackPtr, str_repeat( "\t", $tabs ) . $content );
82 82
 			}
83 83
 		}
84 84
 	}
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 	 * @param array $tokens
90 90
 	 * @return void
91 91
 	 */
92
-	protected function fixSpace(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens) {
93
-		$content = $tokens[$stackPtr]['content'];
92
+	protected function fixSpace( PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens ) {
93
+		$content = $tokens[ $stackPtr ][ 'content' ];
94 94
 
95
-		$newContent = str_replace("\t", '    ', $content);
95
+		$newContent = str_replace( "\t", '    ', $content );
96 96
 
97
-		if ($newContent !== $content) {
97
+		if ( $newContent !== $content ) {
98 98
 			$error = 'Non-indentation (inline) tabs found, expected spaces';
99
-			$fix = $phpcsFile->addFixableError($error, $stackPtr);
100
-			if ($fix) {
101
-				$phpcsFile->fixer->replaceToken($stackPtr, $newContent);
99
+			$fix = $phpcsFile->addFixableError( $error, $stackPtr );
100
+			if ( $fix ) {
101
+				$phpcsFile->fixer->replaceToken( $stackPtr, $newContent );
102 102
 			}
103 103
 		}
104 104
 	}
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/CommaSpacingSniff.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -17,29 +17,29 @@  discard block
 block discarded – undo
17 17
 	 * @inheritDoc
18 18
 	 */
19 19
 	public function register() {
20
-		return [T_COMMA];
20
+		return [ T_COMMA ];
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @inheritDoc
25 25
 	 */
26
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
26
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
27 27
 		$tokens = $phpcsFile->getTokens();
28 28
 
29
-		$next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
30
-		$this->checkNext($phpcsFile, $stackPtr, $next);
29
+		$next = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true );
30
+		$this->checkNext( $phpcsFile, $stackPtr, $next );
31 31
 
32
-		$previous = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
32
+		$previous = $phpcsFile->findPrevious( T_WHITESPACE, ( $stackPtr - 1 ), null, true );
33 33
 
34
-		if ($tokens[$previous]['code'] !== T_WHITESPACE && ($previous !== $stackPtr - 1)) {
35
-			if ($tokens[$previous]['code'] === T_COMMA) {
34
+		if ( $tokens[ $previous ][ 'code' ] !== T_WHITESPACE && ( $previous !== $stackPtr - 1 ) ) {
35
+			if ( $tokens[ $previous ][ 'code' ] === T_COMMA ) {
36 36
 				return;
37 37
 			}
38 38
 
39 39
 			$error = 'Space before comma, expected none, though';
40
-			$fix = $phpcsFile->addFixableError($error, $previous);
41
-			if ($fix) {
42
-				$phpcsFile->fixer->replaceToken($previous + 1, '');
40
+			$fix = $phpcsFile->addFixableError( $error, $previous );
41
+			if ( $fix ) {
42
+				$phpcsFile->fixer->replaceToken( $previous + 1, '' );
43 43
 			}
44 44
 		}
45 45
 	}
@@ -50,34 +50,34 @@  discard block
 block discarded – undo
50 50
 	 * @param int $next
51 51
 	 * @return void
52 52
 	 */
53
-	public function checkNext(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $next) {
53
+	public function checkNext( PHP_CodeSniffer_File $phpcsFile, $stackPtr, $next ) {
54 54
 		$tokens = $phpcsFile->getTokens();
55 55
 
56 56
 		// Closing inline array should not have a comma before
57
-		if ($tokens[$next]['code'] === T_CLOSE_SHORT_ARRAY && $tokens[$next]['line'] === $tokens[$stackPtr]['line']) {
57
+		if ( $tokens[ $next ][ 'code' ] === T_CLOSE_SHORT_ARRAY && $tokens[ $next ][ 'line' ] === $tokens[ $stackPtr ][ 'line' ] ) {
58 58
 			$error = 'Invalid comma before closing inline array end `]`.';
59
-			$fix = $phpcsFile->addFixableError($error, $next);
60
-			if ($fix) {
61
-				$phpcsFile->fixer->replaceToken($stackPtr, '');
59
+			$fix = $phpcsFile->addFixableError( $error, $next );
60
+			if ( $fix ) {
61
+				$phpcsFile->fixer->replaceToken( $stackPtr, '' );
62 62
 			}
63 63
 			return;
64 64
 		}
65 65
 
66
-		if ($tokens[$next]['code'] !== T_WHITESPACE && ($next !== $stackPtr + 2)) {
66
+		if ( $tokens[ $next ][ 'code' ] !== T_WHITESPACE && ( $next !== $stackPtr + 2 ) ) {
67 67
 			// Last character in a line is ok.
68
-			if ($tokens[$next]['line'] !== $tokens[$stackPtr]['line']) {
68
+			if ( $tokens[ $next ][ 'line' ] !== $tokens[ $stackPtr ][ 'line' ] ) {
69 69
 				return;
70 70
 			}
71 71
 
72 72
 			// Closing inline array is also ignored
73
-			if ($tokens[$next]['code'] === T_CLOSE_SHORT_ARRAY) {
73
+			if ( $tokens[ $next ][ 'code' ] === T_CLOSE_SHORT_ARRAY ) {
74 74
 				return;
75 75
 			}
76 76
 
77 77
 			$error = 'Missing space after comma';
78
-			$fix = $phpcsFile->addFixableError($error, $next);
79
-			if ($fix) {
80
-				$phpcsFile->fixer->addContent($stackPtr, ' ');
78
+			$fix = $phpcsFile->addFixableError( $error, $next );
79
+			if ( $fix ) {
80
+				$phpcsFile->fixer->addContent( $stackPtr, ' ' );
81 81
 			}
82 82
 		}
83 83
 	}
Please login to merge, or discard this patch.
fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/DocBlockAlignmentSniff.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 	 * @inheritDoc
31 31
 	 */
32 32
 	public function register() {
33
-		return [T_DOC_COMMENT_OPEN_TAG];
33
+		return [ T_DOC_COMMENT_OPEN_TAG ];
34 34
 	}
35 35
 
36 36
 	/**
37 37
 	 * @inheritDoc
38 38
 	 */
39
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
39
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
40 40
 		$tokens = $phpcsFile->getTokens();
41 41
 		$leftWall = [
42 42
 			T_CLASS,
@@ -50,80 +50,80 @@  discard block
 block discarded – undo
50 50
 			T_VARIABLE,
51 51
 			T_CONST
52 52
 		];
53
-		$allTokens = array_merge($leftWall, $oneIndentation);
54
-		$isNotFlatFile = $phpcsFile->findNext(T_NAMESPACE, 0);
55
-		$nextIndex = $phpcsFile->findNext($allTokens, $stackPtr + 1);
56
-
57
-		$expectedColumn = $tokens[$nextIndex]['column'];
58
-		$firstNonWhitespaceIndex = $this->findFirstNonWhitespaceInLine($phpcsFile, $nextIndex);
59
-		if ($firstNonWhitespaceIndex) {
60
-			$expectedColumn = $tokens[$firstNonWhitespaceIndex]['column'];
53
+		$allTokens = array_merge( $leftWall, $oneIndentation );
54
+		$isNotFlatFile = $phpcsFile->findNext( T_NAMESPACE, 0 );
55
+		$nextIndex = $phpcsFile->findNext( $allTokens, $stackPtr + 1 );
56
+
57
+		$expectedColumn = $tokens[ $nextIndex ][ 'column' ];
58
+		$firstNonWhitespaceIndex = $this->findFirstNonWhitespaceInLine( $phpcsFile, $nextIndex );
59
+		if ( $firstNonWhitespaceIndex ) {
60
+			$expectedColumn = $tokens[ $firstNonWhitespaceIndex ][ 'column' ];
61 61
 		}
62 62
 
63 63
 		// We should allow for tabs and spaces
64 64
 		$expectedColumnAdjusted = $expectedColumn;
65
-		if ($expectedColumn === 2) {
65
+		if ( $expectedColumn === 2 ) {
66 66
 			$expectedColumnAdjusted = 5;
67
-		} elseif ($expectedColumn === 5) {
67
+		} elseif ( $expectedColumn === 5 ) {
68 68
 			$expectedColumnAdjusted = 2;
69 69
 		}
70 70
 
71
-		if ($nextIndex) {
72
-			$isNotWalled = (in_array($tokens[$nextIndex]['code'], $leftWall) && $tokens[$stackPtr]['column'] !== 1);
71
+		if ( $nextIndex ) {
72
+			$isNotWalled = ( in_array( $tokens[ $nextIndex ][ 'code' ], $leftWall ) && $tokens[ $stackPtr ][ 'column' ] !== 1 );
73 73
 			$isNotIndented = false;
74
-			if ($isNotFlatFile) {
75
-				$isNotIndented = (in_array($tokens[$nextIndex]['code'], $oneIndentation) && $tokens[$stackPtr]['column'] !== $expectedColumn && $tokens[$stackPtr]['column'] !== $expectedColumnAdjusted);
74
+			if ( $isNotFlatFile ) {
75
+				$isNotIndented = ( in_array( $tokens[ $nextIndex ][ 'code' ], $oneIndentation ) && $tokens[ $stackPtr ][ 'column' ] !== $expectedColumn && $tokens[ $stackPtr ][ 'column' ] !== $expectedColumnAdjusted );
76 76
 			}
77
-			if ($isNotWalled || $isNotIndented) {
78
-				$fix = $phpcsFile->addFixableError('Expected docblock to be aligned with code.', $stackPtr, 'NotAllowed');
79
-				if ($fix) {
80
-					$docBlockEndIndex = $tokens[$stackPtr]['comment_closer'];
77
+			if ( $isNotWalled || $isNotIndented ) {
78
+				$fix = $phpcsFile->addFixableError( 'Expected docblock to be aligned with code.', $stackPtr, 'NotAllowed' );
79
+				if ( $fix ) {
80
+					$docBlockEndIndex = $tokens[ $stackPtr ][ 'comment_closer' ];
81 81
 
82
-					if ($isNotWalled) {
82
+					if ( $isNotWalled ) {
83 83
 						$prevIndex = $stackPtr - 1;
84
-						if ($tokens[$prevIndex]['code'] !== T_WHITESPACE) {
84
+						if ( $tokens[ $prevIndex ][ 'code' ] !== T_WHITESPACE ) {
85 85
 							return;
86 86
 						}
87 87
 
88 88
 						$phpcsFile->fixer->beginChangeset();
89 89
 
90
-						$this->outdent($phpcsFile, $prevIndex);
90
+						$this->outdent( $phpcsFile, $prevIndex );
91 91
 
92
-						for ($i = $stackPtr; $i <= $docBlockEndIndex; $i++) {
93
-							if (!$this->isGivenKind(T_DOC_COMMENT_WHITESPACE, $tokens[$i]) || $tokens[$i]['column'] !== 1) {
92
+						for ( $i = $stackPtr; $i <= $docBlockEndIndex; $i++ ) {
93
+							if ( ! $this->isGivenKind( T_DOC_COMMENT_WHITESPACE, $tokens[ $i ] ) || $tokens[ $i ][ 'column' ] !== 1 ) {
94 94
 								continue;
95 95
 							}
96
-							$this->outdent($phpcsFile, $i);
96
+							$this->outdent( $phpcsFile, $i );
97 97
 						}
98 98
 						$phpcsFile->fixer->endChangeset();
99 99
 						return;
100 100
 					}
101 101
 
102
-					if ($isNotIndented) {
102
+					if ( $isNotIndented ) {
103 103
 						// + means too much indentation (we need to outdend), - means not enough indentation (needs indenting)
104
-						if ($tokens[$stackPtr]['column'] < $expectedColumnAdjusted) {
105
-							$diff = $tokens[$stackPtr]['column'] - $expectedColumn;
104
+						if ( $tokens[ $stackPtr ][ 'column' ] < $expectedColumnAdjusted ) {
105
+							$diff = $tokens[ $stackPtr ][ 'column' ] - $expectedColumn;
106 106
 						} else {
107
-							$diff = ($tokens[$stackPtr]['column'] - $expectedColumnAdjusted) / 4;
107
+							$diff = ( $tokens[ $stackPtr ][ 'column' ] - $expectedColumnAdjusted ) / 4;
108 108
 						}
109 109
 
110 110
 						$phpcsFile->fixer->beginChangeset();
111 111
 
112 112
 						$prevIndex = $stackPtr - 1;
113
-						if ($diff < 0 && $tokens[$prevIndex]['line'] !== $tokens[$stackPtr]['line']) {
114
-							$phpcsFile->fixer->addContentBefore($stackPtr, str_repeat("\t", -$diff));
113
+						if ( $diff < 0 && $tokens[ $prevIndex ][ 'line' ] !== $tokens[ $stackPtr ][ 'line' ] ) {
114
+							$phpcsFile->fixer->addContentBefore( $stackPtr, str_repeat( "\t", -$diff ) );
115 115
 						} else {
116
-							$this->outdent($phpcsFile, $prevIndex);
116
+							$this->outdent( $phpcsFile, $prevIndex );
117 117
 						}
118 118
 
119
-						for ($i = $stackPtr; $i <= $docBlockEndIndex; $i++) {
120
-							if (!$this->isGivenKind(T_DOC_COMMENT_WHITESPACE, $tokens[$i]) || $tokens[$i]['column'] !== 1) {
119
+						for ( $i = $stackPtr; $i <= $docBlockEndIndex; $i++ ) {
120
+							if ( ! $this->isGivenKind( T_DOC_COMMENT_WHITESPACE, $tokens[ $i ] ) || $tokens[ $i ][ 'column' ] !== 1 ) {
121 121
 								continue;
122 122
 							}
123
-							if ($diff < 0) {
124
-								$this->indent($phpcsFile, $i, -$diff);
123
+							if ( $diff < 0 ) {
124
+								$this->indent( $phpcsFile, $i, -$diff );
125 125
 							} else {
126
-								$this->outdent($phpcsFile, $i, $diff);
126
+								$this->outdent( $phpcsFile, $i, $diff );
127 127
 							}
128 128
 						}
129 129
 						$phpcsFile->fixer->endChangeset();
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 	 * @param int $index
139 139
 	 * @return int|null
140 140
 	 */
141
-	protected function findFirstNonWhitespaceInLine(PHP_CodeSniffer_File $phpcsFile, $index) {
141
+	protected function findFirstNonWhitespaceInLine( PHP_CodeSniffer_File $phpcsFile, $index ) {
142 142
 		$tokens = $phpcsFile->getTokens();
143 143
 
144 144
 		$firstIndex = $index;
145
-		while (!empty($tokens[$firstIndex - 1]) && $tokens[$firstIndex - 1]['line'] === $tokens[$index]['line']) {
145
+		while ( ! empty( $tokens[ $firstIndex - 1 ] ) && $tokens[ $firstIndex - 1 ][ 'line' ] === $tokens[ $index ][ 'line' ] ) {
146 146
 			$firstIndex--;
147 147
 		}
148 148
 
149
-		return $phpcsFile->findNext(T_WHITESPACE, $firstIndex, $index, true);
149
+		return $phpcsFile->findNext( T_WHITESPACE, $firstIndex, $index, true );
150 150
 	}
151 151
 
152 152
 }
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/ArraySpacingSniff.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 	 * @inheritDoc
18 18
 	 */
19 19
 	public function register() {
20
-		return [T_OPEN_SHORT_ARRAY];
20
+		return [ T_OPEN_SHORT_ARRAY ];
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @inheritDoc
25 25
 	 */
26
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
26
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
27 27
 		$tokens = $phpcsFile->getTokens();
28 28
 
29
-		$endIndex = $tokens[$stackPtr]['bracket_closer'];
30
-		$this->checkBeginning($phpcsFile, $stackPtr);
31
-		$this->checkEnding($phpcsFile, $endIndex);
29
+		$endIndex = $tokens[ $stackPtr ][ 'bracket_closer' ];
30
+		$this->checkBeginning( $phpcsFile, $stackPtr );
31
+		$this->checkEnding( $phpcsFile, $endIndex );
32 32
 	}
33 33
 
34 34
 	/**
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 	 * @param int $stackPtr
37 37
 	 * @return void
38 38
 	 */
39
-	protected function checkBeginning(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
39
+	protected function checkBeginning( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
40 40
 		$tokens = $phpcsFile->getTokens();
41 41
 
42
-		$nextIndex = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
43
-		if ($nextIndex - $stackPtr === 1) {
42
+		$nextIndex = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
43
+		if ( $nextIndex - $stackPtr === 1 ) {
44 44
 			return;
45 45
 		}
46
-		if ($tokens[$nextIndex]['line'] !== $tokens[$stackPtr]['line']) {
46
+		if ( $tokens[ $nextIndex ][ 'line' ] !== $tokens[ $stackPtr ][ 'line' ] ) {
47 47
 			return;
48 48
 		}
49 49
 
50
-		$fix = $phpcsFile->addFixableError('No whitespace after opening bracket', $stackPtr, 'InvalidAfter');
51
-		if ($fix) {
52
-			$phpcsFile->fixer->replaceToken($nextIndex - 1, '');
50
+		$fix = $phpcsFile->addFixableError( 'No whitespace after opening bracket', $stackPtr, 'InvalidAfter' );
51
+		if ( $fix ) {
52
+			$phpcsFile->fixer->replaceToken( $nextIndex - 1, '' );
53 53
 		}
54 54
 	}
55 55
 
@@ -58,25 +58,25 @@  discard block
 block discarded – undo
58 58
 	 * @param int $stackPtr
59 59
 	 * @return void
60 60
 	 */
61
-	protected function checkEnding(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
61
+	protected function checkEnding( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
62 62
 		$tokens = $phpcsFile->getTokens();
63 63
 
64
-		$previousIndex = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
65
-		if ($stackPtr - $previousIndex === 1) {
64
+		$previousIndex = $phpcsFile->findPrevious( T_WHITESPACE, ( $stackPtr - 1 ), null, true );
65
+		if ( $stackPtr - $previousIndex === 1 ) {
66 66
 			return;
67 67
 		}
68
-		if ($tokens[$previousIndex]['line'] !== $tokens[$stackPtr]['line']) {
68
+		if ( $tokens[ $previousIndex ][ 'line' ] !== $tokens[ $stackPtr ][ 'line' ] ) {
69 69
 			return;
70 70
 		}
71 71
 
72 72
 		// Let another sniffer take care of invalid commas
73
-		if ($tokens[$previousIndex]['code'] === T_COMMA) {
73
+		if ( $tokens[ $previousIndex ][ 'code' ] === T_COMMA ) {
74 74
 			return;
75 75
 		}
76 76
 
77
-		$fix = $phpcsFile->addFixableError('No whitespace before closing bracket', $stackPtr, 'InvalidBefore');
78
-		if ($fix) {
79
-			$phpcsFile->fixer->replaceToken($previousIndex + 1, '');
77
+		$fix = $phpcsFile->addFixableError( 'No whitespace before closing bracket', $stackPtr, 'InvalidBefore' );
78
+		if ( $fix ) {
79
+			$phpcsFile->fixer->replaceToken( $previousIndex + 1, '' );
80 80
 		}
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -33,54 +33,54 @@
 block discarded – undo
33 33
 	/**
34 34
 	 * @inheritDoc
35 35
 	 */
36
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
36
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
37 37
 		$tokens = $phpcsFile->getTokens();
38 38
 
39
-		if ($tokens[($stackPtr + 1)]['code'] === T_SEMICOLON) {
39
+		if ( $tokens[ ( $stackPtr + 1 ) ][ 'code' ] === T_SEMICOLON ) {
40 40
 			// No content for this language construct.
41 41
 			return;
42 42
 		}
43 43
 
44 44
 		// We don't care about the following whitespace and let another sniff take care of that
45
-		$nextIndex = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
45
+		$nextIndex = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true );
46 46
 
47 47
 		// No brackets
48
-		if ($tokens[$nextIndex]['code'] !== T_OPEN_PARENTHESIS) {
48
+		if ( $tokens[ $nextIndex ][ 'code' ] !== T_OPEN_PARENTHESIS ) {
49 49
 			// Check if there is at least a whitespace in between
50
-			if ($nextIndex - $stackPtr > 1) {
50
+			if ( $nextIndex - $stackPtr > 1 ) {
51 51
 				// Everything's fine
52 52
 				return;
53 53
 			}
54 54
 
55 55
 			$error = 'Language constructs must contain a whitespace.';
56
-			$phpcsFile->addFixableError($error, $stackPtr, 'MissingWhitespace');
56
+			$phpcsFile->addFixableError( $error, $stackPtr, 'MissingWhitespace' );
57 57
 
58
-			if ($phpcsFile->fixer->enabled === true) {
59
-				$phpcsFile->fixer->addContent($stackPtr, ' ');
58
+			if ( $phpcsFile->fixer->enabled === true ) {
59
+				$phpcsFile->fixer->addContent( $stackPtr, ' ' );
60 60
 			}
61 61
 
62 62
 			return;
63 63
 		}
64 64
 
65
-		$closingTokenIndex = $tokens[$nextIndex]['parenthesis_closer'];
65
+		$closingTokenIndex = $tokens[ $nextIndex ][ 'parenthesis_closer' ];
66 66
 
67
-		$lastTokenIndex = $phpcsFile->findNext(T_WHITESPACE, ($closingTokenIndex + 1), null, true);
68
-		if (!$lastTokenIndex || $tokens[$lastTokenIndex]['type'] !== 'T_SEMICOLON') {
67
+		$lastTokenIndex = $phpcsFile->findNext( T_WHITESPACE, ( $closingTokenIndex + 1 ), null, true );
68
+		if ( ! $lastTokenIndex || $tokens[ $lastTokenIndex ][ 'type' ] !== 'T_SEMICOLON' ) {
69 69
 			return;
70 70
 		}
71 71
 
72 72
 		$error = 'Language constructs must not be followed by parenthesesis.';
73
-		$phpcsFile->addFixableError($error, $stackPtr, 'IncorrectParenthesis');
73
+		$phpcsFile->addFixableError( $error, $stackPtr, 'IncorrectParenthesis' );
74 74
 
75 75
 		// Do we need to add a space?
76 76
 		$replacement = '';
77
-		if ($nextIndex - $stackPtr === 1) {
77
+		if ( $nextIndex - $stackPtr === 1 ) {
78 78
 			$replacement = ' ';
79 79
 		}
80 80
 
81
-		if ($phpcsFile->fixer->enabled === true) {
82
-			$phpcsFile->fixer->replaceToken($nextIndex, $replacement);
83
-			$phpcsFile->fixer->replaceToken($closingTokenIndex, '');
81
+		if ( $phpcsFile->fixer->enabled === true ) {
82
+			$phpcsFile->fixer->replaceToken( $nextIndex, $replacement );
83
+			$phpcsFile->fixer->replaceToken( $closingTokenIndex, '' );
84 84
 		}
85 85
 	}
86 86
 
Please login to merge, or discard this patch.
fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/UnaryOperatorSpacingSniff.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -16,51 +16,51 @@  discard block
 block discarded – undo
16 16
 	 * @inheritDoc
17 17
 	 */
18 18
 	public function register() {
19
-		return [T_INC, T_DEC, T_MINUS, T_PLUS, T_NONE, T_ASPERAND, T_BITWISE_AND];
19
+		return [ T_INC, T_DEC, T_MINUS, T_PLUS, T_NONE, T_ASPERAND, T_BITWISE_AND ];
20 20
 	}
21 21
 
22 22
 	/**
23 23
 	 * @inheritDoc
24 24
 	 */
25
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
25
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
26 26
 		$tokens = $phpcsFile->getTokens();
27 27
 
28
-		if ($tokens[$stackPtr]['code'] === T_PLUS) {
28
+		if ( $tokens[ $stackPtr ][ 'code' ] === T_PLUS ) {
29 29
 			// Skip for now, another sniff is reverting it
30 30
 			return;
31 31
 		}
32 32
 
33
-		if ($tokens[$stackPtr]['code'] === T_ASPERAND || $tokens[$stackPtr]['code'] === T_NONE) {
34
-			$nextIndex = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
33
+		if ( $tokens[ $stackPtr ][ 'code' ] === T_ASPERAND || $tokens[ $stackPtr ][ 'code' ] === T_NONE ) {
34
+			$nextIndex = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true );
35 35
 
36
-			if ($nextIndex - $stackPtr === 1) {
36
+			if ( $nextIndex - $stackPtr === 1 ) {
37 37
 				return;
38 38
 			}
39 39
 
40
-			$fix = $phpcsFile->addFixableError('No whitespace should be between ' . $tokens[$stackPtr]['content'] . ' operator and variable.', $stackPtr);
41
-			if ($fix) {
42
-				$phpcsFile->fixer->replaceToken($stackPtr + 1, '');
40
+			$fix = $phpcsFile->addFixableError( 'No whitespace should be between ' . $tokens[ $stackPtr ][ 'content' ] . ' operator and variable.', $stackPtr );
41
+			if ( $fix ) {
42
+				$phpcsFile->fixer->replaceToken( $stackPtr + 1, '' );
43 43
 			}
44 44
 			return;
45 45
 		}
46 46
 
47
-		if ($tokens[$stackPtr]['code'] === T_DEC || $tokens[$stackPtr]['code'] === T_INC) {
48
-			$this->checkBefore($phpcsFile, $stackPtr);
49
-			$this->checkAfter($phpcsFile, $stackPtr);
47
+		if ( $tokens[ $stackPtr ][ 'code' ] === T_DEC || $tokens[ $stackPtr ][ 'code' ] === T_INC ) {
48
+			$this->checkBefore( $phpcsFile, $stackPtr );
49
+			$this->checkAfter( $phpcsFile, $stackPtr );
50 50
 			return;
51 51
 		}
52 52
 
53 53
 		// Find the last syntax item to determine if this is an unary operator.
54 54
 		$lastSyntaxItem = $phpcsFile->findPrevious(
55
-			[T_WHITESPACE],
56
-			($stackPtr - 1),
57
-			(($tokens[$stackPtr]['column']) * -1),
55
+			[ T_WHITESPACE ],
56
+			( $stackPtr - 1 ),
57
+			( ( $tokens[ $stackPtr ][ 'column' ] ) * -1 ),
58 58
 			true,
59 59
 			null,
60 60
 			true
61 61
 		);
62 62
 		$operatorSuffixAllowed = in_array(
63
-			$tokens[$lastSyntaxItem]['code'],
63
+			$tokens[ $lastSyntaxItem ][ 'code' ],
64 64
 			[
65 65
 				T_LNUMBER,
66 66
 				T_DNUMBER,
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 			]
74 74
 		);
75 75
 
76
-		if ($operatorSuffixAllowed === false
77
-			&& $tokens[($stackPtr + 1)]['code'] === T_WHITESPACE
76
+		if ( $operatorSuffixAllowed === false
77
+			&& $tokens[ ( $stackPtr + 1 ) ][ 'code' ] === T_WHITESPACE
78 78
 		) {
79 79
 			$error = 'A unary operator statement must not be followed by a space';
80
-			$fix = $phpcsFile->addFixableError($error, $stackPtr, 'WrongSpace');
81
-			if ($fix) {
82
-				$phpcsFile->fixer->replaceToken(($stackPtr + 1), '');
80
+			$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'WrongSpace' );
81
+			if ( $fix ) {
82
+				$phpcsFile->fixer->replaceToken( ( $stackPtr + 1 ), '' );
83 83
 			}
84 84
 		}
85 85
 	}
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
 	 * @param int $stackPtr
90 90
 	 * @return void
91 91
 	 */
92
-	protected function checkBefore(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
92
+	protected function checkBefore( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
93 93
 		$tokens = $phpcsFile->getTokens();
94 94
 
95
-		$prevIndex = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
96
-		if ($tokens[$prevIndex]['code'] === T_VARIABLE) {
97
-			if ($stackPtr - $prevIndex === 1) {
95
+		$prevIndex = $phpcsFile->findPrevious( T_WHITESPACE, ( $stackPtr - 1 ), null, true );
96
+		if ( $tokens[ $prevIndex ][ 'code' ] === T_VARIABLE ) {
97
+			if ( $stackPtr - $prevIndex === 1 ) {
98 98
 				return;
99 99
 			}
100 100
 
101
-			$fix = $phpcsFile->addFixableError('No whitespace should be between variable and incrementor.', $stackPtr);
102
-			if ($fix) {
103
-				$phpcsFile->fixer->replaceToken($stackPtr - 1, '');
101
+			$fix = $phpcsFile->addFixableError( 'No whitespace should be between variable and incrementor.', $stackPtr );
102
+			if ( $fix ) {
103
+				$phpcsFile->fixer->replaceToken( $stackPtr - 1, '' );
104 104
 			}
105 105
 		}
106 106
 	}
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
 	 * @param int $stackPtr
111 111
 	 * @return void
112 112
 	 */
113
-	protected function checkAfter(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
113
+	protected function checkAfter( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
114 114
 		$tokens = $phpcsFile->getTokens();
115 115
 
116
-		$nextIndex = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
117
-		if ($tokens[$nextIndex]['code'] === T_VARIABLE) {
118
-			if ($nextIndex - $stackPtr === 1) {
116
+		$nextIndex = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true );
117
+		if ( $tokens[ $nextIndex ][ 'code' ] === T_VARIABLE ) {
118
+			if ( $nextIndex - $stackPtr === 1 ) {
119 119
 				return;
120 120
 			}
121 121
 
122
-			$fix = $phpcsFile->addFixableError('No whitespace should be between incrementor and variable.', $stackPtr);
123
-			if ($fix) {
124
-				$phpcsFile->fixer->replaceToken($stackPtr + 1, '');
122
+			$fix = $phpcsFile->addFixableError( 'No whitespace should be between incrementor and variable.', $stackPtr );
123
+			if ( $fix ) {
124
+				$phpcsFile->fixer->replaceToken( $stackPtr + 1, '' );
125 125
 			}
126 126
 		}
127 127
 	}
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/OperatorSpacingSniff.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
 		$operators = PHP_CodeSniffer_Tokens::$operators;
32 32
 		$assignment = PHP_CodeSniffer_Tokens::$assignmentTokens;
33 33
 
34
-		return array_unique(array_merge($comparison, $operators, $assignment));
34
+		return array_unique( array_merge( $comparison, $operators, $assignment ) );
35 35
 	}
36 36
 
37 37
 	/**
38 38
 	 * @inheritDoc
39 39
 	 */
40
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
40
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
41 41
 		$tokens = $phpcsFile->getTokens();
42 42
 
43 43
 		// Skip default values in function declarations.
44
-		if ($tokens[$stackPtr]['code'] === T_EQUAL
45
-			|| $tokens[$stackPtr]['code'] === T_MINUS
44
+		if ( $tokens[ $stackPtr ][ 'code' ] === T_EQUAL
45
+			|| $tokens[ $stackPtr ][ 'code' ] === T_MINUS
46 46
 		) {
47
-			if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
48
-				$parenthesis = array_keys($tokens[$stackPtr]['nested_parenthesis']);
49
-				$bracket = array_pop($parenthesis);
50
-				if (isset($tokens[$bracket]['parenthesis_owner']) === true) {
51
-					$function = $tokens[$bracket]['parenthesis_owner'];
52
-					if ($tokens[$function]['code'] === T_FUNCTION) {
47
+			if ( isset( $tokens[ $stackPtr ][ 'nested_parenthesis' ] ) === true ) {
48
+				$parenthesis = array_keys( $tokens[ $stackPtr ][ 'nested_parenthesis' ] );
49
+				$bracket = array_pop( $parenthesis );
50
+				if ( isset( $tokens[ $bracket ][ 'parenthesis_owner' ] ) === true ) {
51
+					$function = $tokens[ $bracket ][ 'parenthesis_owner' ];
52
+					if ( $tokens[ $function ][ 'code' ] === T_FUNCTION ) {
53 53
 						return;
54 54
 					}
55 55
 				}
56 56
 			}
57 57
 		}
58 58
 
59
-		if ($tokens[$stackPtr]['code'] === T_EQUAL) {
59
+		if ( $tokens[ $stackPtr ][ 'code' ] === T_EQUAL ) {
60 60
 			/*
61 61
 			// Skip for '=&' case.
62 62
 			if (isset($tokens[($stackPtr + 1)]) === true && $tokens[($stackPtr + 1)]['code'] === T_BITWISE_AND) {
@@ -65,44 +65,44 @@  discard block
 block discarded – undo
65 65
 			*/
66 66
 		}
67 67
 
68
-		if ($tokens[$stackPtr]['code'] === T_BITWISE_AND) {
68
+		if ( $tokens[ $stackPtr ][ 'code' ] === T_BITWISE_AND ) {
69 69
 			// If its not a reference, then we expect one space either side of the
70 70
 			// bitwise operator.
71
-			if ($phpcsFile->isReference($stackPtr) === false) {
71
+			if ( $phpcsFile->isReference( $stackPtr ) === false ) {
72 72
 				// Check there is one space before the & operator.
73
-				if ($tokens[($stackPtr - 1)]['code'] !== T_WHITESPACE) {
73
+				if ( $tokens[ ( $stackPtr - 1 ) ][ 'code' ] !== T_WHITESPACE ) {
74 74
 					$error = 'Expected 1 space before "&" operator; 0 found';
75
-					$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpaceBeforeAmp');
76
-					if ($fix) {
77
-						$phpcsFile->fixer->addContent($stackPtr - 1, ' ');
75
+					$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceBeforeAmp' );
76
+					if ( $fix ) {
77
+						$phpcsFile->fixer->addContent( $stackPtr - 1, ' ' );
78 78
 					}
79 79
 				}
80 80
 
81 81
 				// Check there is one space after the & operator.
82
-				if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
82
+				if ( $tokens[ ( $stackPtr + 1 ) ][ 'code' ] !== T_WHITESPACE ) {
83 83
 					$error = 'Expected 1 space after "&" operator; 0 found';
84
-					$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpaceAfterAmp');
85
-					if ($fix) {
86
-						$phpcsFile->fixer->addContent($stackPtr, ' ');
84
+					$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceAfterAmp' );
85
+					if ( $fix ) {
86
+						$phpcsFile->fixer->addContent( $stackPtr, ' ' );
87 87
 					}
88 88
 				}
89 89
 			}
90 90
 		} else {
91
-			if ($tokens[$stackPtr]['code'] === T_MINUS) {
91
+			if ( $tokens[ $stackPtr ][ 'code' ] === T_MINUS ) {
92 92
 				// Check minus spacing, but make sure we aren't just assigning
93 93
 				// a minus value or returning one.
94
-				$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
95
-				if ($tokens[$prev]['code'] === T_RETURN) {
94
+				$prev = $phpcsFile->findPrevious( T_WHITESPACE, ( $stackPtr - 1 ), null, true );
95
+				if ( $tokens[ $prev ][ 'code' ] === T_RETURN ) {
96 96
 					// Just returning a negative value; eg. return -1.
97 97
 					return;
98 98
 				}
99 99
 
100
-				if (in_array($tokens[$prev]['code'], PHP_CodeSniffer_Tokens::$operators) === true) {
100
+				if ( in_array( $tokens[ $prev ][ 'code' ], PHP_CodeSniffer_Tokens::$operators ) === true ) {
101 101
 					// Just trying to operate on a negative value; eg. ($var * -1).
102 102
 					return;
103 103
 				}
104 104
 
105
-				if (in_array($tokens[$prev]['code'], PHP_CodeSniffer_Tokens::$comparisonTokens) === true) {
105
+				if ( in_array( $tokens[ $prev ][ 'code' ], PHP_CodeSniffer_Tokens::$comparisonTokens ) === true ) {
106 106
 					// Just trying to compare a negative value; eg. ($var === -1).
107 107
 					return;
108 108
 				}
@@ -121,31 +121,31 @@  discard block
 block discarded – undo
121 121
 					T_CASE,
122 122
 				];
123 123
 
124
-				if (in_array($tokens[$prev]['code'], $invalidTokens) === true) {
124
+				if ( in_array( $tokens[ $prev ][ 'code' ], $invalidTokens ) === true ) {
125 125
 					// Just trying to use a negative value; eg. myFunction($var, -2).
126 126
 					return;
127 127
 				}
128
-				if (in_array($tokens[$prev]['code'], PHP_CodeSniffer_Tokens::$assignmentTokens) === true) {
128
+				if ( in_array( $tokens[ $prev ][ 'code' ], PHP_CodeSniffer_Tokens::$assignmentTokens ) === true ) {
129 129
 					// Just trying to assign a negative value; eg. ($var = -1).
130 130
 					return;
131 131
 				}
132 132
 			}
133 133
 
134
-			$operator = $tokens[$stackPtr]['content'];
134
+			$operator = $tokens[ $stackPtr ][ 'content' ];
135 135
 
136
-			if ($tokens[($stackPtr - 1)]['code'] !== T_WHITESPACE) {
136
+			if ( $tokens[ ( $stackPtr - 1 ) ][ 'code' ] !== T_WHITESPACE ) {
137 137
 				$error = "Expected 1 space before \"$operator\"; 0 found";
138
-				$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpaceBefore');
139
-				if ($fix) {
140
-					$phpcsFile->fixer->addContent($stackPtr - 1, ' ');
138
+				$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceBefore' );
139
+				if ( $fix ) {
140
+					$phpcsFile->fixer->addContent( $stackPtr - 1, ' ' );
141 141
 				}
142 142
 			}
143 143
 
144
-			if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
144
+			if ( $tokens[ ( $stackPtr + 1 ) ][ 'code' ] !== T_WHITESPACE ) {
145 145
 				$error = "Expected 1 space after \"$operator\"; 0 found";
146
-				$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpaceAfter');
147
-				if ($fix) {
148
-					$phpcsFile->fixer->addContent($stackPtr, ' ');
146
+				$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceAfter' );
147
+				if ( $fix ) {
148
+					$phpcsFile->fixer->addContent( $stackPtr, ' ' );
149 149
 				}
150 150
 			}
151 151
 		}
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/WhiteSpace/MethodSpacingSniff.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,41 +17,41 @@
 block discarded – undo
17 17
 	 * @inheritDoc
18 18
 	 */
19 19
 	public function register() {
20
-		return [T_FUNCTION];
20
+		return [ T_FUNCTION ];
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @inheritDoc
25 25
 	 */
26
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
26
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
27 27
 		$tokens = $phpcsFile->getTokens();
28 28
 
29
-		$stringIndex = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
30
-		if ($tokens[$stringIndex]['code'] !== T_STRING) {
29
+		$stringIndex = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true );
30
+		if ( $tokens[ $stringIndex ][ 'code' ] !== T_STRING ) {
31 31
 			return;
32 32
 		}
33 33
 
34
-		$parenthesisIndex = $phpcsFile->findNext(T_WHITESPACE, ($stringIndex + 1), null, true);
35
-		if ($tokens[$parenthesisIndex]['type'] !== 'T_OPEN_PARENTHESIS') {
34
+		$parenthesisIndex = $phpcsFile->findNext( T_WHITESPACE, ( $stringIndex + 1 ), null, true );
35
+		if ( $tokens[ $parenthesisIndex ][ 'type' ] !== 'T_OPEN_PARENTHESIS' ) {
36 36
 			return;
37 37
 		}
38 38
 
39
-		if ($parenthesisIndex - $stringIndex !== 1) {
39
+		if ( $parenthesisIndex - $stringIndex !== 1 ) {
40 40
 			$error = 'There should be no space between method name and opening parenthesis';
41
-			$fix = $phpcsFile->addFixableError($error, $stackPtr, 'ContentBeforeOpen');
42
-			if ($fix === true) {
43
-				$phpcsFile->fixer->replaceToken($parenthesisIndex - 1, '');
41
+			$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'ContentBeforeOpen' );
42
+			if ( $fix === true ) {
43
+				$phpcsFile->fixer->replaceToken( $parenthesisIndex - 1, '' );
44 44
 			}
45 45
 		}
46 46
 
47
-		$parenthesisEndIndex = $tokens[$parenthesisIndex]['parenthesis_closer'];
47
+		$parenthesisEndIndex = $tokens[ $parenthesisIndex ][ 'parenthesis_closer' ];
48 48
 
49
-		$braceStartIndex = $phpcsFile->findNext(T_WHITESPACE, ($parenthesisEndIndex + 1), null, true);
50
-		if ($tokens[$braceStartIndex]['code'] !== T_OPEN_CURLY_BRACKET) {
49
+		$braceStartIndex = $phpcsFile->findNext( T_WHITESPACE, ( $parenthesisEndIndex + 1 ), null, true );
50
+		if ( $tokens[ $braceStartIndex ][ 'code' ] !== T_OPEN_CURLY_BRACKET ) {
51 51
 			return;
52 52
 		}
53 53
 
54
-		if ($braceStartIndex - $parenthesisEndIndex === 2 && $tokens[$braceStartIndex - 1]['content'] === ' ') {
54
+		if ( $braceStartIndex - $parenthesisEndIndex === 2 && $tokens[ $braceStartIndex - 1 ][ 'content' ] === ' ' ) {
55 55
 			return;
56 56
 		}
57 57
 
Please login to merge, or discard this patch.