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
psr2r-sniffer/PSR2R/Sniffs/Commenting/NoControlStructureEndCommentSniff.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@
 block discarded – undo
13 13
 	 * @inheritDoc
14 14
 	 */
15 15
 	public function register() {
16
-		return [T_COMMENT];
16
+		return [ T_COMMENT ];
17 17
 	}
18 18
 
19 19
 	/**
20 20
 	 * @inheritDoc
21 21
 	 */
22
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
22
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
23 23
 		$tokens = $phpcsFile->getTokens();
24 24
 
25
-		$possibleCurlyBracket = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), 0, true);
26
-		if ($possibleCurlyBracket === false || $tokens[$possibleCurlyBracket]['type'] !== 'T_CLOSE_CURLY_BRACKET') {
25
+		$possibleCurlyBracket = $phpcsFile->findPrevious( T_WHITESPACE, ( $stackPtr - 1 ), 0, true );
26
+		if ( $possibleCurlyBracket === false || $tokens[ $possibleCurlyBracket ][ 'type' ] !== 'T_CLOSE_CURLY_BRACKET' ) {
27 27
 			return;
28 28
 		}
29 29
 
30
-		$content = $tokens[$stackPtr]['content'];
31
-		if (strpos($content, '//end ') !== 0) {
30
+		$content = $tokens[ $stackPtr ][ 'content' ];
31
+		if ( strpos( $content, '//end ' ) !== 0 ) {
32 32
 			return;
33 33
 		}
34 34
 
35 35
 		$error = 'The unnecessary end comment must be removed';
36
-		$fix = $phpcsFile->addFixableError($error, $stackPtr, 'Unnecessary');
37
-		if ($fix === true) {
38
-			$phpcsFile->fixer->replaceToken($stackPtr, preg_replace('/[^\s]/', '', $content));
36
+		$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'Unnecessary' );
37
+		if ( $fix === true ) {
38
+			$phpcsFile->fixer->replaceToken( $stackPtr, preg_replace( '/[^\s]/', '', $content ) );
39 39
 		}
40 40
 	}
41 41
 
Please login to merge, or discard this patch.
PSR2R/Sniffs/Commenting/FullyQualifiedClassNameInDocBlockSniff.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -37,50 +37,50 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @inheritDoc
39 39
 	 */
40
-	public function process(PHP_CodeSniffer_File $phpCsFile, $stackPointer) {
40
+	public function process( PHP_CodeSniffer_File $phpCsFile, $stackPointer ) {
41 41
 		$tokens = $phpCsFile->getTokens();
42 42
 
43
-		$docBlockEndIndex = $this->findRelatedDocBlock($phpCsFile, $stackPointer);
43
+		$docBlockEndIndex = $this->findRelatedDocBlock( $phpCsFile, $stackPointer );
44 44
 
45
-		if (!$docBlockEndIndex) {
45
+		if ( ! $docBlockEndIndex ) {
46 46
 			return;
47 47
 		}
48 48
 
49
-		$docBlockStartIndex = $tokens[$docBlockEndIndex]['comment_opener'];
49
+		$docBlockStartIndex = $tokens[ $docBlockEndIndex ][ 'comment_opener' ];
50 50
 
51
-		for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) {
52
-			if ($tokens[$i]['type'] !== 'T_DOC_COMMENT_TAG') {
51
+		for ( $i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++ ) {
52
+			if ( $tokens[ $i ][ 'type' ] !== 'T_DOC_COMMENT_TAG' ) {
53 53
 				continue;
54 54
 			}
55
-			if (!in_array($tokens[$i]['content'], ['@return', '@yield', '@param', '@throws', '@var', '@method', '@see'])) {
55
+			if ( ! in_array( $tokens[ $i ][ 'content' ], [ '@return', '@yield', '@param', '@throws', '@var', '@method', '@see' ] ) ) {
56 56
 				continue;
57 57
 			}
58 58
 
59 59
 			$classNameIndex = $i + 2;
60 60
 
61
-			if ($tokens[$classNameIndex]['type'] !== 'T_DOC_COMMENT_STRING') {
61
+			if ( $tokens[ $classNameIndex ][ 'type' ] !== 'T_DOC_COMMENT_STRING' ) {
62 62
 				continue;
63 63
 			}
64 64
 
65
-			$content = $tokens[$classNameIndex]['content'];
65
+			$content = $tokens[ $classNameIndex ][ 'content' ];
66 66
 
67 67
 			$appendix = '';
68
-			$spaceIndex = strpos($content, ' ');
69
-			if ($spaceIndex) {
70
-				$appendix = substr($content, $spaceIndex);
71
-				$content = substr($content, 0, $spaceIndex);
68
+			$spaceIndex = strpos( $content, ' ' );
69
+			if ( $spaceIndex ) {
70
+				$appendix = substr( $content, $spaceIndex );
71
+				$content = substr( $content, 0, $spaceIndex );
72 72
 			}
73 73
 
74
-			if (empty($content)) {
74
+			if ( empty( $content ) ) {
75 75
 				continue;
76 76
 			}
77 77
 
78
-			$classNames = explode('|', $content);
79
-			if (count($classNames) > 1) {
80
-				$this->assertUniqueParts($phpCsFile, $classNames, $i);
78
+			$classNames = explode( '|', $content );
79
+			if ( count( $classNames ) > 1 ) {
80
+				$this->assertUniqueParts( $phpCsFile, $classNames, $i );
81 81
 			}
82 82
 
83
-			$this->fixClassNames($phpCsFile, $classNameIndex, $classNames, $tokens[$i]['content'], $appendix);
83
+			$this->fixClassNames( $phpCsFile, $classNameIndex, $classNames, $tokens[ $i ][ 'content' ], $appendix );
84 84
 		}
85 85
 	}
86 86
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return void
93 93
 	 */
94
-	protected function assertUniqueParts(PHP_CodeSniffer_File $phpCsFile, array $classNames, $index) {
95
-		$exists = [];
96
-		foreach ($classNames as $className) {
97
-			if (in_array($className, $exists, true)) {
98
-				$phpCsFile->addError('Type `' . $className . '` used twice', $index);
94
+	protected function assertUniqueParts( PHP_CodeSniffer_File $phpCsFile, array $classNames, $index ) {
95
+		$exists = [ ];
96
+		foreach ( $classNames as $className ) {
97
+			if ( in_array( $className, $exists, true ) ) {
98
+				$phpCsFile->addError( 'Type `' . $className . '` used twice', $index );
99 99
 				continue;
100 100
 			}
101
-			$exists[] = $className;
101
+			$exists[ ] = $className;
102 102
 		}
103 103
 	}
104 104
 
@@ -111,55 +111,55 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return void
113 113
 	 */
114
-	protected function fixClassNames(PHP_CodeSniffer_File $phpCsFile, $classNameIndex, array $classNames, $docBlockType, $appendix) {
115
-		$result = [];
116
-		foreach ($classNames as $key => $className) {
117
-			if (strpos($className, '\\') !== false) {
114
+	protected function fixClassNames( PHP_CodeSniffer_File $phpCsFile, $classNameIndex, array $classNames, $docBlockType, $appendix ) {
115
+		$result = [ ];
116
+		foreach ( $classNames as $key => $className ) {
117
+			if ( strpos( $className, '\\' ) !== false ) {
118 118
 				continue;
119 119
 			}
120 120
 
121 121
 			$suffix = '';
122
-			if (substr($className, -2) === '[]') {
122
+			if ( substr( $className, -2 ) === '[]' ) {
123 123
 				$suffix = '[]';
124
-				$className = substr($className, 0, -2);
125
-			} elseif ($docBlockType === '@see' && preg_match('/^[a-z]+\:\:/i', $className, $matches)) {
126
-				$pos = strpos($className, '::');
127
-				$suffix = substr($className, $pos);
128
-				$className = substr($className, 0, $pos);
124
+				$className = substr( $className, 0, -2 );
125
+			} elseif ( $docBlockType === '@see' && preg_match( '/^[a-z]+\:\:/i', $className, $matches ) ) {
126
+				$pos = strpos( $className, '::' );
127
+				$suffix = substr( $className, $pos );
128
+				$className = substr( $className, 0, $pos );
129 129
 			}
130 130
 
131
-			if (in_array($className, self::$whitelistedTypes)) {
131
+			if ( in_array( $className, self::$whitelistedTypes ) ) {
132 132
 				continue;
133 133
 			}
134 134
 
135
-			$useStatement = $this->findUseStatementForClassName($phpCsFile, $className);
136
-			if (!$useStatement) {
137
-				if ($docBlockType === '@see' && strpos($suffix, '::') !== 0) {
135
+			$useStatement = $this->findUseStatementForClassName( $phpCsFile, $className );
136
+			if ( ! $useStatement ) {
137
+				if ( $docBlockType === '@see' && strpos( $suffix, '::' ) !== 0 ) {
138 138
 					continue;
139 139
 				}
140 140
 
141
-				$phpCsFile->addError('Invalid class name "' . $className . '"', $classNameIndex);
141
+				$phpCsFile->addError( 'Invalid class name "' . $className . '"', $classNameIndex );
142 142
 				continue;
143 143
 			}
144 144
 
145
-			$classNames[$key] = $useStatement . ($suffix ?: '');
146
-			$result[$className . ($suffix ?: '')] = $classNames[$key];
145
+			$classNames[ $key ] = $useStatement . ( $suffix ? : '' );
146
+			$result[ $className . ( $suffix ? : '' ) ] = $classNames[ $key ];
147 147
 		}
148 148
 
149
-		if (!$result) {
149
+		if ( ! $result ) {
150 150
 			return;
151 151
 		}
152 152
 
153
-		$message = [];
154
-		foreach ($result as $className => $useStatement) {
155
-			$message[] = $className . ' => ' . $useStatement;
153
+		$message = [ ];
154
+		foreach ( $result as $className => $useStatement ) {
155
+			$message[ ] = $className . ' => ' . $useStatement;
156 156
 		}
157 157
 
158
-		$fix = $phpCsFile->addFixableError(implode(', ', $message), $classNameIndex);
159
-		if ($fix) {
160
-			$newContent = implode('|', $classNames);
158
+		$fix = $phpCsFile->addFixableError( implode( ', ', $message ), $classNameIndex );
159
+		if ( $fix ) {
160
+			$newContent = implode( '|', $classNames );
161 161
 
162
-			$phpCsFile->fixer->replaceToken($classNameIndex, $newContent . $appendix);
162
+			$phpCsFile->fixer->replaceToken( $classNameIndex, $newContent . $appendix );
163 163
 		}
164 164
 	}
165 165
 
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @return string|null
171 171
 	 */
172
-	protected function findUseStatementForClassName(PHP_CodeSniffer_File $phpCsFile, $className) {
173
-		$useStatements = $this->parseUseStatements($phpCsFile);
174
-		if (!isset($useStatements[$className])) {
175
-			$useStatement = $this->findInSameNameSpace($phpCsFile, $className);
176
-			if ($useStatement) {
172
+	protected function findUseStatementForClassName( PHP_CodeSniffer_File $phpCsFile, $className ) {
173
+		$useStatements = $this->parseUseStatements( $phpCsFile );
174
+		if ( ! isset( $useStatements[ $className ] ) ) {
175
+			$useStatement = $this->findInSameNameSpace( $phpCsFile, $className );
176
+			if ( $useStatement ) {
177 177
 				return $useStatement;
178 178
 			}
179 179
 
180 180
 			return null;
181 181
 		}
182 182
 
183
-		return $useStatements[$className];
183
+		return $useStatements[ $className ];
184 184
 	}
185 185
 
186 186
 	/**
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return string|null
191 191
 	 */
192
-	protected function findInSameNameSpace(PHP_CodeSniffer_File $phpCsFile, $className) {
193
-		if (!$this->hasNamespace($phpCsFile)) {
192
+	protected function findInSameNameSpace( PHP_CodeSniffer_File $phpCsFile, $className ) {
193
+		if ( ! $this->hasNamespace( $phpCsFile ) ) {
194 194
 			return null;
195 195
 		}
196
-		$currentNameSpace = $this->getNamespaceInfo($phpCsFile);
196
+		$currentNameSpace = $this->getNamespaceInfo( $phpCsFile );
197 197
 
198 198
 		$file = $phpCsFile->getFilename();
199
-		$dir = dirname($file) . DIRECTORY_SEPARATOR;
200
-		if (!file_exists($dir . $className . '.php')) {
199
+		$dir = dirname( $file ) . DIRECTORY_SEPARATOR;
200
+		if ( ! file_exists( $dir . $className . '.php' ) ) {
201 201
 			return null;
202 202
 		}
203 203
 
@@ -209,36 +209,36 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @return array
211 211
 	 */
212
-	protected function parseUseStatements(PHP_CodeSniffer_File $phpCsFile) {
213
-		$useStatements = [];
212
+	protected function parseUseStatements( PHP_CodeSniffer_File $phpCsFile ) {
213
+		$useStatements = [ ];
214 214
 		$tokens = $phpCsFile->getTokens();
215 215
 
216
-		foreach ($tokens as $id => $token) {
217
-			if ($token['type'] !== 'T_USE') {
216
+		foreach ( $tokens as $id => $token ) {
217
+			if ( $token[ 'type' ] !== 'T_USE' ) {
218 218
 				continue;
219 219
 			}
220 220
 
221
-			$endIndex = $phpCsFile->findEndOfStatement($id);
221
+			$endIndex = $phpCsFile->findEndOfStatement( $id );
222 222
 			$useStatement = '';
223
-			for ($i = $id + 2; $i < $endIndex; $i++) {
224
-				$useStatement .= $tokens[$i]['content'];
223
+			for ( $i = $id + 2; $i < $endIndex; $i++ ) {
224
+				$useStatement .= $tokens[ $i ][ 'content' ];
225 225
 			}
226 226
 
227
-			$useStatement = trim($useStatement);
227
+			$useStatement = trim( $useStatement );
228 228
 
229
-			if (strpos($useStatement, ' as ') !== false) {
230
-				list($useStatement, $className) = explode(' as ', $useStatement);
229
+			if ( strpos( $useStatement, ' as ' ) !== false ) {
230
+				list( $useStatement, $className ) = explode( ' as ', $useStatement );
231 231
 			} else {
232 232
 				$className = $useStatement;
233
-				if (strpos($useStatement, '\\') !== false) {
234
-					$lastSeparator = strrpos($useStatement, '\\');
235
-					$className = substr($useStatement, $lastSeparator + 1);
233
+				if ( strpos( $useStatement, '\\' ) !== false ) {
234
+					$lastSeparator = strrpos( $useStatement, '\\' );
235
+					$className = substr( $useStatement, $lastSeparator + 1 );
236 236
 				}
237 237
 			}
238 238
 
239
-			$useStatement = '\\' . ltrim($useStatement, '\\');
239
+			$useStatement = '\\' . ltrim( $useStatement, '\\' );
240 240
 
241
-			$useStatements[$className] = $useStatement;
241
+			$useStatements[ $className ] = $useStatement;
242 242
 		}
243 243
 
244 244
 		return $useStatements;
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/Commenting/DocBlockParamSniff.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,55 +28,55 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @inheritDoc
30 30
 	 */
31
-	public function process(PHP_CodeSniffer_File $phpCsFile, $stackPointer) {
31
+	public function process( PHP_CodeSniffer_File $phpCsFile, $stackPointer ) {
32 32
 		$tokens = $phpCsFile->getTokens();
33 33
 
34
-		$docBlockEndIndex = $this->findRelatedDocBlock($phpCsFile, $stackPointer);
34
+		$docBlockEndIndex = $this->findRelatedDocBlock( $phpCsFile, $stackPointer );
35 35
 
36
-		if (!$docBlockEndIndex) {
36
+		if ( ! $docBlockEndIndex ) {
37 37
 			return;
38 38
 		}
39 39
 
40
-		$docBlockStartIndex = $tokens[$docBlockEndIndex]['comment_opener'];
40
+		$docBlockStartIndex = $tokens[ $docBlockEndIndex ][ 'comment_opener' ];
41 41
 
42
-		if ($this->hasInheritDoc($phpCsFile, $docBlockStartIndex, $docBlockEndIndex)) {
42
+		if ( $this->hasInheritDoc( $phpCsFile, $docBlockStartIndex, $docBlockEndIndex ) ) {
43 43
 			return;
44 44
 		}
45 45
 
46
-		$methodSignature = $this->getMethodSignature($phpCsFile, $stackPointer);
47
-		if (!$methodSignature) {
46
+		$methodSignature = $this->getMethodSignature( $phpCsFile, $stackPointer );
47
+		if ( ! $methodSignature ) {
48 48
 			return;
49 49
 		}
50 50
 
51
-		$docBlockParams = [];
52
-		for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) {
53
-			if ($tokens[$i]['type'] !== 'T_DOC_COMMENT_TAG') {
51
+		$docBlockParams = [ ];
52
+		for ( $i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++ ) {
53
+			if ( $tokens[ $i ][ 'type' ] !== 'T_DOC_COMMENT_TAG' ) {
54 54
 				continue;
55 55
 			}
56
-			if (!in_array($tokens[$i]['content'], ['@param'])) {
56
+			if ( ! in_array( $tokens[ $i ][ 'content' ], [ '@param' ] ) ) {
57 57
 				continue;
58 58
 			}
59 59
 
60 60
 			$classNameIndex = $i + 2;
61 61
 
62
-			if ($tokens[$classNameIndex]['type'] !== 'T_DOC_COMMENT_STRING') {
63
-				$phpCsFile->addError('Missing type in param doc block', $i);
62
+			if ( $tokens[ $classNameIndex ][ 'type' ] !== 'T_DOC_COMMENT_STRING' ) {
63
+				$phpCsFile->addError( 'Missing type in param doc block', $i );
64 64
 				continue;
65 65
 			}
66 66
 
67
-			$content = $tokens[$classNameIndex]['content'];
67
+			$content = $tokens[ $classNameIndex ][ 'content' ];
68 68
 
69 69
 			$appendix = '';
70
-			$spacePos = strpos($content, ' ');
71
-			if ($spacePos) {
72
-				$appendix = substr($content, $spacePos);
73
-				$content = substr($content, 0, $spacePos);
70
+			$spacePos = strpos( $content, ' ' );
71
+			if ( $spacePos ) {
72
+				$appendix = substr( $content, $spacePos );
73
+				$content = substr( $content, 0, $spacePos );
74 74
 			}
75 75
 
76
-			preg_match('/\$[^\s]+/', $appendix, $matches);
77
-			$variable = $matches ? $matches[0] : '';
76
+			preg_match( '/\$[^\s]+/', $appendix, $matches );
77
+			$variable = $matches ? $matches[ 0 ] : '';
78 78
 
79
-			$docBlockParams[] = [
79
+			$docBlockParams[ ] = [
80 80
 				'index' => $classNameIndex,
81 81
 				'type' => $content,
82 82
 				'variable' => $variable,
@@ -84,26 +84,26 @@  discard block
 block discarded – undo
84 84
 			];
85 85
 		}
86 86
 
87
-		if (count($docBlockParams) !== count($methodSignature)) {
88
-			$phpCsFile->addError('Doc Block params do not match method signature', $stackPointer);
87
+		if ( count( $docBlockParams ) !== count( $methodSignature ) ) {
88
+			$phpCsFile->addError( 'Doc Block params do not match method signature', $stackPointer );
89 89
 			return;
90 90
 		}
91 91
 
92
-		foreach ($docBlockParams as $docBlockParam) {
93
-			$methodParam = array_shift($methodSignature);
94
-			$variableName = $tokens[$methodParam['variable']]['content'];
92
+		foreach ( $docBlockParams as $docBlockParam ) {
93
+			$methodParam = array_shift( $methodSignature );
94
+			$variableName = $tokens[ $methodParam[ 'variable' ] ][ 'content' ];
95 95
 
96
-			if ($docBlockParam['variable'] === $variableName) {
96
+			if ( $docBlockParam[ 'variable' ] === $variableName ) {
97 97
 				continue;
98 98
 			}
99 99
 			// We let other sniffers take care of missing type for now
100
-			if (strpos($docBlockParam['type'], '$') !== false) {
100
+			if ( strpos( $docBlockParam[ 'type' ], '$' ) !== false ) {
101 101
 				continue;
102 102
 			}
103 103
 
104
-			$error = 'Doc Block param variable `' . $docBlockParam['variable'] . '` should be `' . $variableName . '`';
104
+			$error = 'Doc Block param variable `' . $docBlockParam[ 'variable' ] . '` should be `' . $variableName . '`';
105 105
 			// For now just report (buggy yet)
106
-			$phpCsFile->addError($error, $docBlockParam['index'], 'VariableWrong');
106
+			$phpCsFile->addError( $error, $docBlockParam[ 'index' ], 'VariableWrong' );
107 107
 
108 108
 			/*
109 109
 			$fix = $phpCsFile->addFixableError($error, $docBlockParam['index'], 'VariableWrong');
@@ -126,33 +126,33 @@  discard block
 block discarded – undo
126 126
 	 * @param int $stackPtr
127 127
 	 * @return array
128 128
 	 */
129
-	private function getMethodSignature(PHP_CodeSniffer_File $phpCsFile, $stackPtr) {
129
+	private function getMethodSignature( PHP_CodeSniffer_File $phpCsFile, $stackPtr ) {
130 130
 		$tokens = $phpCsFile->getTokens();
131 131
 
132
-		$startIndex = $phpCsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr + 1);
133
-		$endIndex = $tokens[$startIndex]['parenthesis_closer'];
132
+		$startIndex = $phpCsFile->findNext( T_OPEN_PARENTHESIS, $stackPtr + 1 );
133
+		$endIndex = $tokens[ $startIndex ][ 'parenthesis_closer' ];
134 134
 
135
-		$arguments = [];
135
+		$arguments = [ ];
136 136
 		$i = $startIndex;
137
-		while ($nextVariableIndex = $phpCsFile->findNext(T_VARIABLE, $i + 1, $endIndex)) {
137
+		while ( $nextVariableIndex = $phpCsFile->findNext( T_VARIABLE, $i + 1, $endIndex ) ) {
138 138
 			$typehint = $default = null;
139
-			$possibleTypeHint = $phpCsFile->findPrevious([T_ARRAY_HINT, T_CALLABLE], $nextVariableIndex - 1, $nextVariableIndex - 3);
140
-			if ($possibleTypeHint) {
139
+			$possibleTypeHint = $phpCsFile->findPrevious( [ T_ARRAY_HINT, T_CALLABLE ], $nextVariableIndex - 1, $nextVariableIndex - 3 );
140
+			if ( $possibleTypeHint ) {
141 141
 				$typehint = $possibleTypeHint;
142 142
 			}
143
-			if ($possibleTypeHint) {
143
+			if ( $possibleTypeHint ) {
144 144
 				$typehint = $possibleTypeHint;
145 145
 			}
146 146
 
147
-			$possibleEqualIndex = $phpCsFile->findNext([T_EQUAL], $nextVariableIndex + 1, $nextVariableIndex + 2);
148
-			if ($possibleEqualIndex) {
149
-				$possibleDefaultValue = $phpCsFile->findNext([T_STRING, T_TRUE, T_FALSE, T_NULL, T_ARRAY], $possibleEqualIndex + 1, $possibleEqualIndex + 2);
150
-				if ($possibleDefaultValue) {
147
+			$possibleEqualIndex = $phpCsFile->findNext( [ T_EQUAL ], $nextVariableIndex + 1, $nextVariableIndex + 2 );
148
+			if ( $possibleEqualIndex ) {
149
+				$possibleDefaultValue = $phpCsFile->findNext( [ T_STRING, T_TRUE, T_FALSE, T_NULL, T_ARRAY ], $possibleEqualIndex + 1, $possibleEqualIndex + 2 );
150
+				if ( $possibleDefaultValue ) {
151 151
 					$default = $possibleDefaultValue;
152 152
 				}
153 153
 			}
154 154
 
155
-			$arguments[] = [
155
+			$arguments[ ] = [
156 156
 				'variable' => $nextVariableIndex,
157 157
 				'typehint' => $typehint,
158 158
 				'default' => $default
Please login to merge, or discard this patch.
fig-r/psr2r-sniffer/PSR2R/Sniffs/Commenting/DocBlockReturnVoidSniff.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -22,64 +22,64 @@  discard block
 block discarded – undo
22 22
 	 * @inheritDoc
23 23
 	 */
24 24
 	public function register() {
25
-		return [T_FUNCTION];
25
+		return [ T_FUNCTION ];
26 26
 	}
27 27
 
28 28
 	/**
29 29
 	 * @inheritDoc
30 30
 	 */
31
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
31
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
32 32
 		$tokens = $phpcsFile->getTokens();
33 33
 
34
-		$nextIndex = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true);
35
-		if ($tokens[$nextIndex]['content'] === '__construct' || $tokens[$nextIndex]['content'] === '__destruct') {
36
-			$this->checkConstructorAndDestructor($phpcsFile, $nextIndex);
34
+		$nextIndex = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true );
35
+		if ( $tokens[ $nextIndex ][ 'content' ] === '__construct' || $tokens[ $nextIndex ][ 'content' ] === '__destruct' ) {
36
+			$this->checkConstructorAndDestructor( $phpcsFile, $nextIndex );
37 37
 			return;
38 38
 		}
39 39
 
40 40
 		// Don't mess with closures
41
-		$prevIndex = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr - 1, null, true);
42
-		if (!$this->isGivenKind(PHP_CodeSniffer_Tokens::$methodPrefixes, $tokens[$prevIndex])) {
41
+		$prevIndex = $phpcsFile->findPrevious( PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr - 1, null, true );
42
+		if ( ! $this->isGivenKind( PHP_CodeSniffer_Tokens::$methodPrefixes, $tokens[ $prevIndex ] ) ) {
43 43
 			return;
44 44
 		}
45 45
 
46
-		$docBlockEndIndex = $this->findRelatedDocBlock($phpcsFile, $stackPtr);
47
-		if (!$docBlockEndIndex) {
46
+		$docBlockEndIndex = $this->findRelatedDocBlock( $phpcsFile, $stackPtr );
47
+		if ( ! $docBlockEndIndex ) {
48 48
 			return;
49 49
 		}
50 50
 
51
-		$docBlockStartIndex = $tokens[$docBlockEndIndex]['comment_opener'];
51
+		$docBlockStartIndex = $tokens[ $docBlockEndIndex ][ 'comment_opener' ];
52 52
 
53
-		$docBlockReturnIndex = $this->findDocBlockReturn($phpcsFile, $docBlockStartIndex, $docBlockEndIndex);
53
+		$docBlockReturnIndex = $this->findDocBlockReturn( $phpcsFile, $docBlockStartIndex, $docBlockEndIndex );
54 54
 
55
-		$hasInheritDoc = $this->hasInheritDoc($phpcsFile, $docBlockStartIndex, $docBlockEndIndex);
55
+		$hasInheritDoc = $this->hasInheritDoc( $phpcsFile, $docBlockStartIndex, $docBlockEndIndex );
56 56
 
57 57
 		// If interface we will at least report it
58
-		if (empty($tokens[$stackPtr]['scope_opener']) || empty($tokens[$stackPtr]['scope_closer'])) {
59
-			if (!$docBlockReturnIndex && !$hasInheritDoc) {
60
-				$phpcsFile->addError('Method does not have a return statement in doc block: ' . $tokens[$nextIndex]['content'], $nextIndex);
58
+		if ( empty( $tokens[ $stackPtr ][ 'scope_opener' ] ) || empty( $tokens[ $stackPtr ][ 'scope_closer' ] ) ) {
59
+			if ( ! $docBlockReturnIndex && ! $hasInheritDoc ) {
60
+				$phpcsFile->addError( 'Method does not have a return statement in doc block: ' . $tokens[ $nextIndex ][ 'content' ], $nextIndex );
61 61
 			}
62 62
 			return;
63 63
 		}
64 64
 
65 65
 		// If inheritdoc is present assume the parent contains it
66
-		if ($docBlockReturnIndex || !$docBlockReturnIndex && $hasInheritDoc) {
66
+		if ( $docBlockReturnIndex || ! $docBlockReturnIndex && $hasInheritDoc ) {
67 67
 			return;
68 68
 		}
69 69
 
70 70
 		// We only look for void methods right now
71
-		$returnType = $this->detectReturnTypeVoid($phpcsFile, $stackPtr);
72
-		if ($returnType === null) {
73
-			$phpcsFile->addError('Method does not have a return statement in doc block: ' . $tokens[$nextIndex]['content'], $nextIndex);
71
+		$returnType = $this->detectReturnTypeVoid( $phpcsFile, $stackPtr );
72
+		if ( $returnType === null ) {
73
+			$phpcsFile->addError( 'Method does not have a return statement in doc block: ' . $tokens[ $nextIndex ][ 'content' ], $nextIndex );
74 74
 			return;
75 75
 		}
76 76
 
77
-		$fix = $phpcsFile->addFixableError('Method does not have a return void statement in doc block: ' . $tokens[$nextIndex]['content'], $nextIndex);
78
-		if (!$fix) {
77
+		$fix = $phpcsFile->addFixableError( 'Method does not have a return void statement in doc block: ' . $tokens[ $nextIndex ][ 'content' ], $nextIndex );
78
+		if ( ! $fix ) {
79 79
 			return;
80 80
 		}
81 81
 
82
-		$this->addReturnAnnotation($phpcsFile, $docBlockStartIndex, $docBlockEndIndex, $returnType);
82
+		$this->addReturnAnnotation( $phpcsFile, $docBlockStartIndex, $docBlockEndIndex, $returnType );
83 83
 	}
84 84
 
85 85
 	/**
@@ -87,29 +87,29 @@  discard block
 block discarded – undo
87 87
 	 * @param int $index
88 88
 	 * @return void
89 89
 	 */
90
-	protected function checkConstructorAndDestructor(PHP_CodeSniffer_File $phpcsFile, $index) {
91
-		$docBlockEndIndex = $this->findRelatedDocBlock($phpcsFile, $index);
92
-		if (!$docBlockEndIndex) {
90
+	protected function checkConstructorAndDestructor( PHP_CodeSniffer_File $phpcsFile, $index ) {
91
+		$docBlockEndIndex = $this->findRelatedDocBlock( $phpcsFile, $index );
92
+		if ( ! $docBlockEndIndex ) {
93 93
 			return;
94 94
 		}
95 95
 
96 96
 		$tokens = $phpcsFile->getTokens();
97 97
 
98
-		$docBlockStartIndex = $tokens[$docBlockEndIndex]['comment_opener'];
98
+		$docBlockStartIndex = $tokens[ $docBlockEndIndex ][ 'comment_opener' ];
99 99
 
100
-		$docBlockReturnIndex = $this->findDocBlockReturn($phpcsFile, $docBlockStartIndex, $docBlockEndIndex);
101
-		if (!$docBlockReturnIndex) {
100
+		$docBlockReturnIndex = $this->findDocBlockReturn( $phpcsFile, $docBlockStartIndex, $docBlockEndIndex );
101
+		if ( ! $docBlockReturnIndex ) {
102 102
 			return;
103 103
 		}
104 104
 
105
-		$fix = $phpcsFile->addFixableError($tokens[$index]['content'] . ' has invalid return statement.', $docBlockReturnIndex);
106
-		if ($fix) {
107
-			$phpcsFile->fixer->replaceToken($docBlockReturnIndex, '');
105
+		$fix = $phpcsFile->addFixableError( $tokens[ $index ][ 'content' ] . ' has invalid return statement.', $docBlockReturnIndex );
106
+		if ( $fix ) {
107
+			$phpcsFile->fixer->replaceToken( $docBlockReturnIndex, '' );
108 108
 
109
-			$possibleStringToken = $tokens[$docBlockReturnIndex + 2];
110
-			if ($this->isGivenKind(T_DOC_COMMENT_STRING, $possibleStringToken)) {
111
-				$phpcsFile->fixer->replaceToken($docBlockReturnIndex + 1, '');
112
-				$phpcsFile->fixer->replaceToken($docBlockReturnIndex + 2, '');
109
+			$possibleStringToken = $tokens[ $docBlockReturnIndex + 2 ];
110
+			if ( $this->isGivenKind( T_DOC_COMMENT_STRING, $possibleStringToken ) ) {
111
+				$phpcsFile->fixer->replaceToken( $docBlockReturnIndex + 1, '' );
112
+				$phpcsFile->fixer->replaceToken( $docBlockReturnIndex + 2, '' );
113 113
 			}
114 114
 		}
115 115
 	}
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return int|null
123 123
 	 */
124
-	protected function findDocBlockReturn(PHP_CodeSniffer_File $phpcsFile, $docBlockStartIndex, $docBlockEndIndex) {
124
+	protected function findDocBlockReturn( PHP_CodeSniffer_File $phpcsFile, $docBlockStartIndex, $docBlockEndIndex ) {
125 125
 		$tokens = $phpcsFile->getTokens();
126 126
 
127
-		for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) {
128
-			if (!$this->isGivenKind(T_DOC_COMMENT_TAG, $tokens[$i])) {
127
+		for ( $i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++ ) {
128
+			if ( ! $this->isGivenKind( T_DOC_COMMENT_TAG, $tokens[ $i ] ) ) {
129 129
 				continue;
130 130
 			}
131
-			if ($tokens[$i]['content'] !== '@return') {
131
+			if ( $tokens[ $i ][ 'content' ] !== '@return' ) {
132 132
 				continue;
133 133
 			}
134 134
 
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return void
148 148
 	 */
149
-	protected function addReturnAnnotation(PHP_CodeSniffer_File $phpcsFile, $docBlockStartIndex, $docBlockEndIndex, $returnType = 'void') {
149
+	protected function addReturnAnnotation( PHP_CodeSniffer_File $phpcsFile, $docBlockStartIndex, $docBlockEndIndex, $returnType = 'void' ) {
150 150
 		$tokens = $phpcsFile->getTokens();
151 151
 
152
-		$indentation = $this->getIndentationWhitespace($phpcsFile, $docBlockEndIndex);
152
+		$indentation = $this->getIndentationWhitespace( $phpcsFile, $docBlockEndIndex );
153 153
 		//$indentation = str_repeat($indentation, $this->getIndentationColumn($phpcsFile, $docBlockEndIndex));
154 154
 
155
-		$lastLineEndIndex = $phpcsFile->findPrevious([T_DOC_COMMENT_WHITESPACE], $docBlockEndIndex - 1, null, true);
155
+		$lastLineEndIndex = $phpcsFile->findPrevious( [ T_DOC_COMMENT_WHITESPACE ], $docBlockEndIndex - 1, null, true );
156 156
 
157 157
 		$phpcsFile->fixer->beginChangeset();
158
-		$phpcsFile->fixer->addNewline($lastLineEndIndex);
159
-		$phpcsFile->fixer->addContent($lastLineEndIndex, $indentation . '* @return ' . $returnType);
158
+		$phpcsFile->fixer->addNewline( $lastLineEndIndex );
159
+		$phpcsFile->fixer->addContent( $lastLineEndIndex, $indentation . '* @return ' . $returnType );
160 160
 		$phpcsFile->fixer->endChangeset();
161 161
 		/*
162 162
 		$lastLine = $doc->getLine($count - 1);
@@ -178,27 +178,27 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return string|null
180 180
 	 */
181
-	protected function detectReturnTypeVoid(PHP_CodeSniffer_File $phpcsFile, $index) {
181
+	protected function detectReturnTypeVoid( PHP_CodeSniffer_File $phpcsFile, $index ) {
182 182
 		$tokens = $phpcsFile->getTokens();
183 183
 
184 184
 		$type = 'void';
185 185
 
186
-		$methodStartIndex = $tokens[$index]['scope_opener'];
187
-		$methodEndIndex = $tokens[$index]['scope_closer'];
186
+		$methodStartIndex = $tokens[ $index ][ 'scope_opener' ];
187
+		$methodEndIndex = $tokens[ $index ][ 'scope_closer' ];
188 188
 
189
-		for ($i = $methodStartIndex + 1; $i < $methodEndIndex; ++$i) {
190
-			if ($this->isGivenKind([T_FUNCTION], $tokens[$i])) {
191
-				$endIndex = $tokens[$i]['scope_closer'];
189
+		for ( $i = $methodStartIndex + 1; $i < $methodEndIndex; ++$i ) {
190
+			if ( $this->isGivenKind( [ T_FUNCTION ], $tokens[ $i ] ) ) {
191
+				$endIndex = $tokens[ $i ][ 'scope_closer' ];
192 192
 				$i = $endIndex;
193 193
 				continue;
194 194
 			}
195 195
 
196
-			if (!$this->isGivenKind([T_RETURN], $tokens[$i])) {
196
+			if ( ! $this->isGivenKind( [ T_RETURN ], $tokens[ $i ] ) ) {
197 197
 				continue;
198 198
 			}
199 199
 
200
-			$nextIndex = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $i + 1, null, true);
201
-			if (!$this->isGivenKind(T_SEMICOLON, $tokens[$nextIndex])) {
200
+			$nextIndex = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, $i + 1, null, true );
201
+			if ( ! $this->isGivenKind( T_SEMICOLON, $tokens[ $nextIndex ] ) ) {
202 202
 				return null;
203 203
 			}
204 204
 		}
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/Files/EndFileNewlineSniff.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -37,60 +37,60 @@
 block discarded – undo
37 37
 	 * @inheritDoc
38 38
 	 */
39 39
 	public function register() {
40
-		return [T_OPEN_TAG];
40
+		return [ T_OPEN_TAG ];
41 41
 	}
42 42
 
43 43
 	/**
44 44
 	 * @inheritDoc
45 45
 	 */
46
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
47
-		if ($phpcsFile->findNext(T_INLINE_HTML, ($stackPtr + 1)) !== false) {
46
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
47
+		if ( $phpcsFile->findNext( T_INLINE_HTML, ( $stackPtr + 1 ) ) !== false ) {
48 48
 			return $phpcsFile->numTokens + 1;
49 49
 		}
50 50
 
51 51
 		// Skip to the end of the file.
52 52
 		$tokens = $phpcsFile->getTokens();
53
-		$lastToken = ($phpcsFile->numTokens - 1);
53
+		$lastToken = ( $phpcsFile->numTokens - 1 );
54 54
 
55 55
 		// Hard-coding the expected \n in this sniff as it is PSR-2 specific and
56 56
 		// PSR-2 enforces the use of unix style newlines.
57
-		if (substr($tokens[$lastToken]['content'], -1) !== "\n") {
57
+		if ( substr( $tokens[ $lastToken ][ 'content' ], -1 ) !== "\n" ) {
58 58
 			$error = 'Expected 1 newline at end of file; 0 found';
59
-			$fix = $phpcsFile->addFixableError($error, $lastToken, 'NoneFound');
60
-			if ($fix === true) {
61
-				$phpcsFile->fixer->addNewline($lastToken);
59
+			$fix = $phpcsFile->addFixableError( $error, $lastToken, 'NoneFound' );
60
+			if ( $fix === true ) {
61
+				$phpcsFile->fixer->addNewline( $lastToken );
62 62
 			}
63 63
 
64
-			$phpcsFile->recordMetric($stackPtr, 'Number of newlines at EOF', '0');
64
+			$phpcsFile->recordMetric( $stackPtr, 'Number of newlines at EOF', '0' );
65 65
 
66 66
 			return $phpcsFile->numTokens + 1;
67 67
 		}
68 68
 
69 69
 		// Go looking for the last non-empty line.
70
-		$lastLine = $tokens[$lastToken]['line'];
71
-		if ($tokens[$lastToken]['code'] === T_WHITESPACE) {
72
-			$lastCode = $phpcsFile->findPrevious(T_WHITESPACE, ($lastToken - 1), null, true);
70
+		$lastLine = $tokens[ $lastToken ][ 'line' ];
71
+		if ( $tokens[ $lastToken ][ 'code' ] === T_WHITESPACE ) {
72
+			$lastCode = $phpcsFile->findPrevious( T_WHITESPACE, ( $lastToken - 1 ), null, true );
73 73
 		} else {
74 74
 			$lastCode = $lastToken;
75 75
 		}
76 76
 
77
-		$lastCodeLine = $tokens[$lastCode]['line'];
78
-		$blankLines = ($lastLine - $lastCodeLine + 1);
79
-		$phpcsFile->recordMetric($stackPtr, 'Number of newlines at EOF', $blankLines);
77
+		$lastCodeLine = $tokens[ $lastCode ][ 'line' ];
78
+		$blankLines = ( $lastLine - $lastCodeLine + 1 );
79
+		$phpcsFile->recordMetric( $stackPtr, 'Number of newlines at EOF', $blankLines );
80 80
 
81
-		if ($blankLines > 1) {
81
+		if ( $blankLines > 1 ) {
82 82
 			$error = 'Expected 1 blank line at end of file; %s found';
83
-			$data = [$blankLines];
84
-			$fix = $phpcsFile->addFixableError($error, $lastCode, 'TooMany', $data);
83
+			$data = [ $blankLines ];
84
+			$fix = $phpcsFile->addFixableError( $error, $lastCode, 'TooMany', $data );
85 85
 
86
-			if ($fix === true) {
86
+			if ( $fix === true ) {
87 87
 				$phpcsFile->fixer->beginChangeset();
88
-				$phpcsFile->fixer->replaceToken($lastCode, rtrim($tokens[$lastCode]['content']));
89
-				for ($i = ($lastCode + 1); $i < $lastToken; $i++) {
90
-					$phpcsFile->fixer->replaceToken($i, '');
88
+				$phpcsFile->fixer->replaceToken( $lastCode, rtrim( $tokens[ $lastCode ][ 'content' ] ) );
89
+				for ( $i = ( $lastCode + 1 ); $i < $lastToken; $i++ ) {
90
+					$phpcsFile->fixer->replaceToken( $i, '' );
91 91
 				}
92 92
 
93
-				$phpcsFile->fixer->replaceToken($lastToken, $phpcsFile->eolChar);
93
+				$phpcsFile->fixer->replaceToken( $lastToken, $phpcsFile->eolChar );
94 94
 				$phpcsFile->fixer->endChangeset();
95 95
 			}
96 96
 		}
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/Files/ClosingTagSniff.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,41 +37,41 @@
 block discarded – undo
37 37
 	 * @inheritDoc
38 38
 	 */
39 39
 	public function register() {
40
-		return [T_OPEN_TAG];
40
+		return [ T_OPEN_TAG ];
41 41
 	}
42 42
 
43 43
 	/**
44 44
 	 * @inheritDoc
45 45
 	 */
46
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
46
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
47 47
 		$tokens = $phpcsFile->getTokens();
48 48
 
49 49
 		// Make sure this file only contains PHP code.
50
-		for ($i = 0; $i < $phpcsFile->numTokens; $i++) {
51
-			if ($tokens[$i]['code'] === T_INLINE_HTML
52
-				&& trim($tokens[$i]['content']) !== ''
50
+		for ( $i = 0; $i < $phpcsFile->numTokens; $i++ ) {
51
+			if ( $tokens[ $i ][ 'code' ] === T_INLINE_HTML
52
+				&& trim( $tokens[ $i ][ 'content' ] ) !== ''
53 53
 			) {
54 54
 				return $phpcsFile->numTokens;
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Find the last non-empty token.
59
-		for ($last = ($phpcsFile->numTokens - 1); $last > 0; $last--) {
60
-			if (trim($tokens[$last]['content']) !== '') {
59
+		for ( $last = ( $phpcsFile->numTokens - 1 ); $last > 0; $last-- ) {
60
+			if ( trim( $tokens[ $last ][ 'content' ] ) !== '' ) {
61 61
 				break;
62 62
 			}
63 63
 		}
64 64
 
65
-		if ($tokens[$last]['code'] === T_CLOSE_TAG) {
65
+		if ( $tokens[ $last ][ 'code' ] === T_CLOSE_TAG ) {
66 66
 			$error = 'A closing tag is not permitted at the end of a PHP file';
67
-			$fix = $phpcsFile->addFixableError($error, $last, 'NotAllowed');
68
-			if ($fix === true) {
69
-				$phpcsFile->fixer->replaceToken($last, '');
67
+			$fix = $phpcsFile->addFixableError( $error, $last, 'NotAllowed' );
68
+			if ( $fix === true ) {
69
+				$phpcsFile->fixer->replaceToken( $last, '' );
70 70
 			}
71 71
 
72
-			$phpcsFile->recordMetric($stackPtr, 'PHP closing tag at end of PHP-only file', 'yes');
72
+			$phpcsFile->recordMetric( $stackPtr, 'PHP closing tag at end of PHP-only file', 'yes' );
73 73
 		} else {
74
-			$phpcsFile->recordMetric($stackPtr, 'PHP closing tag at end of PHP-only file', 'no');
74
+			$phpcsFile->recordMetric( $stackPtr, 'PHP closing tag at end of PHP-only file', 'no' );
75 75
 		}
76 76
 
77 77
 		// Ignore the rest of the file.
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/Classes/SelfAccessorSniff.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,41 +20,41 @@  discard block
 block discarded – undo
20 20
 	 * @inheritDoc
21 21
 	 */
22 22
 	public function register() {
23
-		return [T_SELF, T_CLASS, T_INTERFACE, T_TRAIT];
23
+		return [ T_SELF, T_CLASS, T_INTERFACE, T_TRAIT ];
24 24
 	}
25 25
 
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 31
 
32
-		if ($tokens[$stackPtr]['code'] === T_SELF) {
33
-			$this->checkSelf($phpcsFile, $stackPtr);
32
+		if ( $tokens[ $stackPtr ][ 'code' ] === T_SELF ) {
33
+			$this->checkSelf( $phpcsFile, $stackPtr );
34 34
 			return;
35 35
 		}
36 36
 
37
-		$startIndex = $tokens[$stackPtr]['scope_opener'];
38
-		if (!$startIndex || empty($tokens[$stackPtr]['scope_closer'])) {
37
+		$startIndex = $tokens[ $stackPtr ][ 'scope_opener' ];
38
+		if ( ! $startIndex || empty( $tokens[ $stackPtr ][ 'scope_closer' ] ) ) {
39 39
 			return;
40 40
 		}
41
-		$endIndex = $tokens[$stackPtr]['scope_closer'];
41
+		$endIndex = $tokens[ $stackPtr ][ 'scope_closer' ];
42 42
 
43
-		$nameIndex = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
44
-		if ($tokens[$nameIndex]['code'] !== T_STRING) {
43
+		$nameIndex = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
44
+		if ( $tokens[ $nameIndex ][ 'code' ] !== T_STRING ) {
45 45
 			return;
46 46
 		}
47 47
 
48
-		$name = $tokens[$nameIndex]['content'];
48
+		$name = $tokens[ $nameIndex ][ 'content' ];
49 49
 
50
-		for ($i = $startIndex + 1; $i < $endIndex; $i++) {
51
-			if ($tokens[$i]['code'] === T_NEW) {
52
-				$this->checkNew($phpcsFile, $i, $name);
50
+		for ( $i = $startIndex + 1; $i < $endIndex; $i++ ) {
51
+			if ( $tokens[ $i ][ 'code' ] === T_NEW ) {
52
+				$this->checkNew( $phpcsFile, $i, $name );
53 53
 				continue;
54 54
 			}
55 55
 
56
-			if ($tokens[$i]['code'] === T_DOUBLE_COLON) {
57
-				$this->checkDoubleColon($phpcsFile, $i, $name);
56
+			if ( $tokens[ $i ][ 'code' ] === T_DOUBLE_COLON ) {
57
+				$this->checkDoubleColon( $phpcsFile, $i, $name );
58 58
 				continue;
59 59
 			}
60 60
 		}
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
 	 * @param int $stackPtr
66 66
 	 * @return void
67 67
 	 */
68
-	protected function checkSelf(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
68
+	protected function checkSelf( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
69 69
 		$tokens = $phpcsFile->getTokens();
70 70
 
71
-		$content = $tokens[$stackPtr]['content'];
72
-		if ($content === 'self') {
71
+		$content = $tokens[ $stackPtr ][ 'content' ];
72
+		if ( $content === 'self' ) {
73 73
 			return;
74 74
 		}
75 75
 
76
-		$fix = $phpcsFile->addFixableError('Expected `self::`, got `' . $content . '::`', $stackPtr);
77
-		if ($fix) {
78
-			$phpcsFile->fixer->replaceToken($stackPtr, 'self');
76
+		$fix = $phpcsFile->addFixableError( 'Expected `self::`, got `' . $content . '::`', $stackPtr );
77
+		if ( $fix ) {
78
+			$phpcsFile->fixer->replaceToken( $stackPtr, 'self' );
79 79
 		}
80 80
 	}
81 81
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	 * @param string $name
86 86
 	 * @return void
87 87
 	 */
88
-	protected function checkNew(PHP_CodeSniffer_File $phpcsFile, $i, $name) {
88
+	protected function checkNew( PHP_CodeSniffer_File $phpcsFile, $i, $name ) {
89 89
 		$tokens = $phpcsFile->getTokens();
90 90
 
91
-		$nextIndex = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($i + 1), null, true);
92
-		if ($tokens[$nextIndex]['code'] !== T_STRING) {
91
+		$nextIndex = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, ( $i + 1 ), null, true );
92
+		if ( $tokens[ $nextIndex ][ 'code' ] !== T_STRING ) {
93 93
 			return;
94 94
 		}
95
-		$openingBraceIndex = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($nextIndex + 1), null, true);
96
-		if ($tokens[$openingBraceIndex]['code'] !== T_OPEN_PARENTHESIS) {
95
+		$openingBraceIndex = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, ( $nextIndex + 1 ), null, true );
96
+		if ( $tokens[ $openingBraceIndex ][ 'code' ] !== T_OPEN_PARENTHESIS ) {
97 97
 			return;
98 98
 		}
99 99
 
100
-		$this->fixNameToSelf($phpcsFile, $nextIndex, $name);
100
+		$this->fixNameToSelf( $phpcsFile, $nextIndex, $name );
101 101
 	}
102 102
 
103 103
 	/**
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
 	 * @param string $name
107 107
 	 * @return void
108 108
 	 */
109
-	protected function checkDoubleColon(PHP_CodeSniffer_File $phpcsFile, $i, $name) {
109
+	protected function checkDoubleColon( PHP_CodeSniffer_File $phpcsFile, $i, $name ) {
110 110
 		$tokens = $phpcsFile->getTokens();
111 111
 
112
-		$prevIndex = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($i - 1), null, true);
113
-		if ($tokens[$prevIndex]['code'] !== T_STRING) {
112
+		$prevIndex = $phpcsFile->findPrevious( PHP_CodeSniffer_Tokens::$emptyTokens, ( $i - 1 ), null, true );
113
+		if ( $tokens[ $prevIndex ][ 'code' ] !== T_STRING ) {
114 114
 			return;
115 115
 		}
116
-		$possibleSeparatorIndex = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($prevIndex - 1), null, true);
117
-		if ($tokens[$possibleSeparatorIndex]['code'] === T_NS_SEPARATOR) {
116
+		$possibleSeparatorIndex = $phpcsFile->findPrevious( PHP_CodeSniffer_Tokens::$emptyTokens, ( $prevIndex - 1 ), null, true );
117
+		if ( $tokens[ $possibleSeparatorIndex ][ 'code' ] === T_NS_SEPARATOR ) {
118 118
 			return;
119 119
 		}
120 120
 
121
-		$this->fixNameToSelf($phpcsFile, $prevIndex, $name);
121
+		$this->fixNameToSelf( $phpcsFile, $prevIndex, $name );
122 122
 	}
123 123
 
124 124
 	/**
@@ -127,18 +127,18 @@  discard block
 block discarded – undo
127 127
 	 * @param string $name
128 128
 	 * @return void
129 129
 	 */
130
-	protected function fixNameToSelf(PHP_CodeSniffer_File $phpcsFile, $index, $name) {
130
+	protected function fixNameToSelf( PHP_CodeSniffer_File $phpcsFile, $index, $name ) {
131 131
 		$tokens = $phpcsFile->getTokens();
132 132
 
133
-		$content = $tokens[$index]['content'];
133
+		$content = $tokens[ $index ][ 'content' ];
134 134
 
135
-		if (strtolower($content) !== strtolower($name)) {
135
+		if ( strtolower( $content ) !== strtolower( $name ) ) {
136 136
 			return;
137 137
 		}
138 138
 
139
-		$fix = $phpcsFile->addFixableError('Expected `self::`, got `' . $content . '::`', $index);
140
-		if ($fix) {
141
-			$phpcsFile->fixer->replaceToken($index, 'self');
139
+		$fix = $phpcsFile->addFixableError( 'Expected `self::`, got `' . $content . '::`', $index );
140
+		if ( $fix ) {
141
+			$phpcsFile->fixer->replaceToken( $index, 'self' );
142 142
 		}
143 143
 	}
144 144
 
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/Classes/TraitNameSniff.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@
 block discarded – undo
13 13
 	 * @inheritDoc
14 14
 	 */
15 15
 	public function register() {
16
-		return [T_TRAIT];
16
+		return [ T_TRAIT ];
17 17
 	}
18 18
 
19 19
 	/**
20 20
 	 * @inheritDoc
21 21
 	 */
22
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
22
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
23 23
 		$tokens = $phpcsFile->getTokens();
24 24
 
25
-		$nameIndex = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
26
-		$name = $tokens[$nameIndex]['content'];
27
-		if (substr($name, -5) === 'Trait') {
25
+		$nameIndex = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true );
26
+		$name = $tokens[ $nameIndex ][ 'content' ];
27
+		if ( substr( $name, -5 ) === 'Trait' ) {
28 28
 			return;
29 29
 		}
30 30
 
31 31
 		$warn = 'Trait names should always have the suffix "Trait"';
32
-		$phpcsFile->addWarning($warn, $nameIndex, 'MissingSuffix');
32
+		$phpcsFile->addWarning( $warn, $nameIndex, 'MissingSuffix' );
33 33
 	}
34 34
 
35 35
 }
Please login to merge, or discard this patch.
vendor/fig-r/psr2r-sniffer/PSR2R/Sniffs/Classes/InterfaceNameSniff.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@
 block discarded – undo
13 13
 	 * @inheritDoc
14 14
 	 */
15 15
 	public function register() {
16
-		return [T_INTERFACE];
16
+		return [ T_INTERFACE ];
17 17
 	}
18 18
 
19 19
 	/**
20 20
 	 * @inheritDoc
21 21
 	 */
22
-	public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
22
+	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
23 23
 		$tokens = $phpcsFile->getTokens();
24 24
 
25
-		$nameIndex = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
26
-		$name = $tokens[$nameIndex]['content'];
27
-		if (substr($name, -9) === 'Interface') {
25
+		$nameIndex = $phpcsFile->findNext( T_WHITESPACE, ( $stackPtr + 1 ), null, true );
26
+		$name = $tokens[ $nameIndex ][ 'content' ];
27
+		if ( substr( $name, -9 ) === 'Interface' ) {
28 28
 			return;
29 29
 		}
30 30
 
31 31
 		$warn = 'Interface names should always have the suffix "Interface"';
32
-		$phpcsFile->addWarning($warn, $nameIndex, 'MissingSuffix');
32
+		$phpcsFile->addWarning( $warn, $nameIndex, 'MissingSuffix' );
33 33
 	}
34 34
 
35 35
 }
Please login to merge, or discard this patch.