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 ( ebb7bf...0a5ff4 )
by Chris
02:41 queued 11s
created

ControlStructureSpacingSniff::process()   F

Complexity

Conditions 96
Paths > 20000

Size

Total Lines 433
Code Lines 257

Duplication

Lines 145
Ratio 33.49 %

Importance

Changes 0
Metric Value
cc 96
eloc 257
nc 4294967295
nop 2
dl 145
loc 433
rs 2
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * WordPress Coding Standard.
4
 *
5
 * @package WPCS\WordPressCodingStandards
6
 * @link    https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
7
 * @license https://opensource.org/licenses/MIT MIT
8
 */
9
10
/**
11
 * Enforces spacing around logical operators and assignments, based upon Squiz code.
12
 *
13
 * @package WPCS\WordPressCodingStandards
14
 *
15
 * @since   0.1.0
16
 * @since   2013-06-11 This sniff no longer supports JS.
17
 * @since   0.3.0      This sniff now has the ability to fix most errors it flags.
18
 * @since   0.7.0      This class now extends WordPress_Sniff.
19
 *
20
 * Last synced with base class ?[unknown date]? at commit ?[unknown commit]?.
21
 * @link    https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php
22
 */
23
class WordPress_Sniffs_WhiteSpace_ControlStructureSpacingSniff extends WordPress_Sniff {
24
25
	/**
26
	 * A list of tokenizers this sniff supports.
27
	 *
28
	 * @var array
29
	 */
30
	public $supportedTokenizers = array( 'PHP' );
31
32
	/**
33
	 * Check for blank lines on start/end of control structures.
34
	 *
35
	 * @var boolean
36
	 */
37
	public $blank_line_check = false;
38
39
	/**
40
	 * Check for blank lines after control structures.
41
	 *
42
	 * @var boolean
43
	 */
44
	public $blank_line_after_check = true;
45
46
	/**
47
	 * Require for space before T_COLON when using the alternative syntax for control structures.
48
	 *
49
	 * @var string one of 'required', 'forbidden', optional'
50
	 */
51
	public $space_before_colon = 'required';
52
53
	/**
54
	 * How many spaces should be between a T_CLOSURE and T_OPEN_PARENTHESIS.
55
	 *
56
	 * `function[*]() {...}`
57
	 *
58
	 * @since 0.7.0
59
	 *
60
	 * @var int
61
	 */
62
	public $spaces_before_closure_open_paren = -1;
63
64
	/**
65
	 * Returns an array of tokens this test wants to listen for.
66
	 *
67
	 * @return array
68
	 */
69
	public function register() {
70
		return array(
71
			T_IF,
72
			T_WHILE,
73
			T_FOREACH,
74
			T_FOR,
75
			T_SWITCH,
76
			T_DO,
77
			T_ELSE,
78
			T_ELSEIF,
79
			T_FUNCTION,
80
			T_CLOSURE,
81
			T_USE,
82
		);
83
84
	}
85
86
	/**
87
	 * Processes this test, when one of its tokens is encountered.
88
	 *
89
	 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
90
	 * @param int                  $stackPtr  The position of the current token in the
91
	 *                                        stack passed in $tokens.
92
	 *
93
	 * @return void
94
	 */
95
	public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
96
		$this->blank_line_check 	  = (bool) $this->blank_line_check;
97
		$this->blank_line_after_check = (bool) $this->blank_line_after_check;
98
99
		$this->init( $phpcsFile );
100
101
		if ( isset( $this->tokens[ ( $stackPtr + 1 ) ] ) && T_WHITESPACE !== $this->tokens[ ( $stackPtr + 1 ) ]['code']
102
			&& ! ( T_ELSE === $this->tokens[ $stackPtr ]['code'] && T_COLON === $this->tokens[ ( $stackPtr + 1 ) ]['code'] )
103
			&& ! (
104
				T_CLOSURE === $this->tokens[ $stackPtr ]['code']
105
				&& (
106
					0 === (int) $this->spaces_before_closure_open_paren
107
					|| -1 === (int) $this->spaces_before_closure_open_paren
108
				)
109
			)
110
		) {
111
			$error = 'Space after opening control structure is required';
112
			if ( isset( $phpcsFile->fixer ) ) {
113
				$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceAfterStructureOpen' );
114
				if ( true === $fix ) {
115
					$phpcsFile->fixer->beginChangeset();
116
					$phpcsFile->fixer->addContent( $stackPtr, ' ' );
117
					$phpcsFile->fixer->endChangeset();
118
				}
119
			} else {
120
				$phpcsFile->addError( $error, $stackPtr, 'NoSpaceAfterStructureOpen' );
121
			}
122
		}
123
124
		if ( ! isset( $this->tokens[ $stackPtr ]['scope_closer'] ) ) {
125
126
			if ( T_USE === $this->tokens[ $stackPtr ]['code'] && 'closure' === $this->get_use_type( $stackPtr ) ) {
127
				$scopeOpener = $phpcsFile->findNext( T_OPEN_CURLY_BRACKET, ( $stackPtr + 1 ) );
128
				$scopeCloser = $this->tokens[ $scopeOpener ]['scope_closer'];
129
			} else {
130
				return;
131
			}
132
		} else {
133
			$scopeOpener = $this->tokens[ $stackPtr ]['scope_opener'];
134
			$scopeCloser = $this->tokens[ $stackPtr ]['scope_closer'];
135
		}
136
137
		// Alternative syntax.
138
		if ( T_COLON === $this->tokens[ $scopeOpener ]['code'] ) {
139
140
			if ( 'required' === $this->space_before_colon ) {
141
142
				if ( T_WHITESPACE !== $this->tokens[ ( $scopeOpener - 1 ) ]['code'] ) {
143
					$error = 'Space between opening control structure and T_COLON is required';
144
145
					if ( isset( $phpcsFile->fixer ) ) {
146
						$fix = $phpcsFile->addFixableError( $error, $scopeOpener, 'NoSpaceBetweenStructureColon' );
147
148
						if ( true === $fix ) {
149
							$phpcsFile->fixer->beginChangeset();
150
							$phpcsFile->fixer->addContentBefore( $scopeOpener, ' ' );
151
							$phpcsFile->fixer->endChangeset();
152
						}
153
					} else {
154
						$phpcsFile->addError( $error, $stackPtr, 'NoSpaceBetweenStructureColon' );
155
					}
156
				}
157
			} elseif ( 'forbidden' === $this->space_before_colon ) {
158
159
				if ( T_WHITESPACE === $this->tokens[ ( $scopeOpener - 1 ) ]['code'] ) {
160
					$error = 'Extra space between opening control structure and T_COLON found';
161
162
					if ( isset( $phpcsFile->fixer ) ) {
163
						$fix = $phpcsFile->addFixableError( $error, ( $scopeOpener - 1 ), 'SpaceBetweenStructureColon' );
164
165
						if ( true === $fix ) {
166
							$phpcsFile->fixer->beginChangeset();
167
							$phpcsFile->fixer->replaceToken( ( $scopeOpener - 1 ), '' );
168
							$phpcsFile->fixer->endChangeset();
169
						}
170
					} else {
171
						$phpcsFile->addError( $error, $stackPtr, 'SpaceBetweenStructureColon' );
172
					}
173
				}
174
			}
175
		}
176
177
		$parenthesisOpener = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
178
179
		// If this is a function declaration.
180
		if ( T_FUNCTION === $this->tokens[ $stackPtr ]['code'] ) {
181
182
			if ( T_STRING === $this->tokens[ $parenthesisOpener ]['code'] ) {
183
184
				$function_name_ptr = $parenthesisOpener;
185
186
			} elseif ( T_BITWISE_AND === $this->tokens[ $parenthesisOpener ]['code'] ) {
187
188
				// This function returns by reference (function &function_name() {}).
189
				$function_name_ptr = $parenthesisOpener = $phpcsFile->findNext(
190
					PHP_CodeSniffer_Tokens::$emptyTokens,
191
					( $parenthesisOpener + 1 ),
192
					null,
193
					true
194
				);
195
			}
196
197
			$parenthesisOpener = $phpcsFile->findNext(
198
				PHP_CodeSniffer_Tokens::$emptyTokens,
199
				( $parenthesisOpener + 1 ),
200
				null,
201
				true
202
			);
203
204
			// Checking this: function my_function[*](...) {}.
205
			if ( ( $function_name_ptr + 1 ) !== $parenthesisOpener ) {
206
207
				$error = 'Space between function name and opening parenthesis is prohibited.';
208
				$fix   = $phpcsFile->addFixableError(
209
					$error,
210
					$stackPtr,
211
					'SpaceBeforeFunctionOpenParenthesis',
212
					$this->tokens[ ( $function_name_ptr + 1 ) ]['content']
213
				);
214
215
				if ( true === $fix ) {
216
					$phpcsFile->fixer->beginChangeset();
217
					$phpcsFile->fixer->replaceToken( ( $function_name_ptr + 1 ), '' );
218
					$phpcsFile->fixer->endChangeset();
219
				}
220
			}
221
		} elseif ( T_CLOSURE === $this->tokens[ $stackPtr ]['code'] ) {
222
223
			// Check if there is a use () statement.
224
			if ( isset( $this->tokens[ $parenthesisOpener ]['parenthesis_closer'] ) ) {
225
226
				$usePtr = $phpcsFile->findNext(
227
					PHP_CodeSniffer_Tokens::$emptyTokens,
228
					( $this->tokens[ $parenthesisOpener ]['parenthesis_closer'] + 1 ),
229
					null,
230
					true,
231
					null,
232
					true
233
				);
234
235
				// If it is, we set that as the "scope opener".
236
				if ( T_USE === $this->tokens[ $usePtr ]['code'] ) {
237
					$scopeOpener = $usePtr;
238
				}
239
			}
240
		}
241
242
		if (
243
			T_COLON !== $this->tokens[ $parenthesisOpener ]['code']
244
			&& T_FUNCTION !== $this->tokens[ $stackPtr ]['code']
245
		) {
246
247
			if (
248
				T_CLOSURE === $this->tokens[ $stackPtr ]['code']
249
				&& 0 === (int) $this->spaces_before_closure_open_paren
250
			) {
251
252
				if ( ( $stackPtr + 1) !== $parenthesisOpener ) {
253
					// Checking this: function[*](...) {}.
254
					$error = 'Space before closure opening parenthesis is prohibited';
255
					$fix   = $phpcsFile->addFixableError( $error, $stackPtr, 'SpaceBeforeClosureOpenParenthesis' );
256
					if ( true === $fix ) {
257
						$phpcsFile->fixer->beginChangeset();
258
						$phpcsFile->fixer->replaceToken( ( $stackPtr + 1 ), '' );
259
						$phpcsFile->fixer->endChangeset();
260
					}
261
				}
262
			} elseif (
263
				(
264
					T_CLOSURE !== $this->tokens[ $stackPtr ]['code']
265
					|| 1 === (int) $this->spaces_before_closure_open_paren
266
				)
267
				&& ( $stackPtr + 1 ) === $parenthesisOpener
268
			) {
269
270
				// Checking this: if[*](...) {}.
271
				$error = 'No space before opening parenthesis is prohibited';
272
				if ( isset( $phpcsFile->fixer ) ) {
273
					$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceBeforeOpenParenthesis' );
274
					if ( true === $fix ) {
275
						$phpcsFile->fixer->beginChangeset();
276
						$phpcsFile->fixer->addContent( $stackPtr, ' ' );
277
						$phpcsFile->fixer->endChangeset();
278
					}
279
				} else {
280
					$phpcsFile->addError( $error, $stackPtr, 'NoSpaceBeforeOpenParenthesis' );
281
				}
282
			}
283
		}
284
285
		if (
286
			T_WHITESPACE === $this->tokens[ ( $stackPtr + 1 ) ]['code']
287
			&& ' ' !== $this->tokens[ ( $stackPtr + 1 ) ]['content']
288
		) {
289
			// Checking this: if [*](...) {}.
290
			$error = 'Expected exactly one space before opening parenthesis; "%s" found.';
291
			$fix = $phpcsFile->addFixableError(
292
				$error,
293
				$stackPtr,
294
				'ExtraSpaceBeforeOpenParenthesis',
295
				$this->tokens[ ( $stackPtr + 1 ) ]['content']
296
			);
297
298
			if ( true === $fix ) {
299
				$phpcsFile->fixer->beginChangeset();
300
				$phpcsFile->fixer->replaceToken( ( $stackPtr + 1 ), ' ' );
301
				$phpcsFile->fixer->endChangeset();
302
			}
303
		}
304
305
		if ( T_WHITESPACE !== $this->tokens[ ( $parenthesisOpener + 1) ]['code']
306
			&& T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1) ]['code']
307
		) {
308
			// Checking this: $value = my_function([*]...).
309
			$error = 'No space after opening parenthesis is prohibited';
310
			if ( isset( $phpcsFile->fixer ) ) {
311
				$fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceAfterOpenParenthesis' );
312
				if ( true === $fix ) {
313
					$phpcsFile->fixer->beginChangeset();
314
					$phpcsFile->fixer->addContent( $parenthesisOpener, ' ' );
315
					$phpcsFile->fixer->endChangeset();
316
				}
317
			} else {
318
				$phpcsFile->addError( $error, $stackPtr, 'NoSpaceAfterOpenParenthesis' );
319
			}
320
		}
321
322
		if ( isset( $this->tokens[ $parenthesisOpener ]['parenthesis_closer'] ) ) {
323
324
			$parenthesisCloser = $this->tokens[ $parenthesisOpener ]['parenthesis_closer'];
325
326
			if ( T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['code'] ) {
327
328
				if ( T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser - 1 ) ]['code'] ) {
329
					$error = 'No space before closing parenthesis is prohibited';
330
					if ( isset( $phpcsFile->fixer ) ) {
331
						$fix = $phpcsFile->addFixableError( $error, $parenthesisCloser, 'NoSpaceBeforeCloseParenthesis' );
332
						if ( true === $fix ) {
333
							$phpcsFile->fixer->beginChangeset();
334
							$phpcsFile->fixer->addContentBefore( $parenthesisCloser, ' ' );
335
							$phpcsFile->fixer->endChangeset();
336
						}
337
					} else {
338
						$phpcsFile->addError( $error, $parenthesisCloser, 'NoSpaceBeforeCloseParenthesis' );
339
					}
340
				}
341
342
				if (
343
					T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser + 1 ) ]['code']
344
					&& T_COLON !== $this->tokens[ $scopeOpener ]['code']
345
				) {
346
					$error = 'Space between opening control structure and closing parenthesis is required';
347
348
					if ( isset( $phpcsFile->fixer ) ) {
349
						$fix = $phpcsFile->addFixableError( $error, $scopeOpener, 'NoSpaceAfterCloseParenthesis' );
350
351
						if ( true === $fix ) {
352
							$phpcsFile->fixer->beginChangeset();
353
							$phpcsFile->fixer->addContentBefore( $scopeOpener, ' ' );
354
							$phpcsFile->fixer->endChangeset();
355
						}
356
					} else {
357
						$phpcsFile->addError( $error, $stackPtr, 'NoSpaceAfterCloseParenthesis' );
358
					}
359
				}
360
			}
361
362
			if ( isset( $this->tokens[ $parenthesisOpener ]['parenthesis_owner'] )
363
				&& $this->tokens[ $parenthesisCloser ]['line'] !== $this->tokens[ $scopeOpener ]['line']
364
			) {
365
				$error = 'Opening brace should be on the same line as the declaration';
366
				if ( isset( $phpcsFile->fixer ) ) {
367
					$fix = $phpcsFile->addFixableError( $error, $parenthesisOpener, 'OpenBraceNotSameLine' );
368
					if ( true === $fix ) {
369
						$phpcsFile->fixer->beginChangeset();
370
371
						for ( $i = ( $parenthesisCloser + 1 ); $i < $scopeOpener; $i++ ) {
372
							$phpcsFile->fixer->replaceToken( $i, '' );
373
						}
374
375
						$phpcsFile->fixer->addContent( $parenthesisCloser, ' ' );
376
						$phpcsFile->fixer->endChangeset();
377
					}
378
				} else {
379
					$phpcsFile->addError( $error, $parenthesisOpener, 'OpenBraceNotSameLine' );
380
				} // end if
381
				return;
382
383
			} elseif (
384
				T_WHITESPACE === $this->tokens[ ( $parenthesisCloser + 1 ) ]['code']
385
				&& ' ' !== $this->tokens[ ( $parenthesisCloser + 1 ) ]['content']
386
			) {
387
388
				// Checking this: if (...) [*]{}.
389
				$error = 'Expected exactly one space between closing parenthesis and opening control structure; "%s" found.';
390
				$fix = $phpcsFile->addFixableError(
391
					$error,
392
					$stackPtr,
393
					'ExtraSpaceAfterCloseParenthesis',
394
					$this->tokens[ ( $parenthesisCloser + 1 ) ]['content']
395
				);
396
397
				if ( true === $fix ) {
398
					$phpcsFile->fixer->beginChangeset();
399
					$phpcsFile->fixer->replaceToken( ( $parenthesisCloser + 1 ), ' ' );
400
					$phpcsFile->fixer->endChangeset();
401
				}
402
			}
403
		} // end if
404
405
		if ( true === $this->blank_line_check ) {
406
			$firstContent = $phpcsFile->findNext( T_WHITESPACE, ( $scopeOpener + 1 ), null, true );
407
			if ( $this->tokens[ $firstContent ]['line'] > ( $this->tokens[ $scopeOpener ]['line'] + 1 )
408
				&& false === in_array( $this->tokens[ $firstContent ]['code'], array( T_CLOSE_TAG, T_COMMENT ), true )
409
			) {
410
				$error = 'Blank line found at start of control structure';
411
				if ( isset( $phpcsFile->fixer ) ) {
412
					$fix = $phpcsFile->addFixableError( $error, $scopeOpener, 'BlankLineAfterStart' );
413
					if ( true === $fix ) {
414
						$phpcsFile->fixer->beginChangeset();
415
416
						for ( $i = ( $scopeOpener + 1 ); $i < $firstContent; $i++ ) {
417
							$phpcsFile->fixer->replaceToken( $i, '' );
418
						}
419
420
						$phpcsFile->fixer->addNewline( $scopeOpener );
421
						$phpcsFile->fixer->endChangeset();
422
					}
423
				} else {
424
					$phpcsFile->addError( $error, $scopeOpener, 'BlankLineAfterStart' );
425
				}
426
			}
427
428
			$lastContent = $phpcsFile->findPrevious( T_WHITESPACE, ( $scopeCloser - 1 ), null, true );
429
			if ( ( $this->tokens[ $scopeCloser ]['line'] - 1 ) !== $this->tokens[ $lastContent ]['line'] ) {
430
				$errorToken = $scopeCloser;
431
				for ( $i = ( $scopeCloser - 1 ); $i > $lastContent; $i-- ) {
432
					if ( $this->tokens[ $i ]['line'] < $this->tokens[ $scopeCloser ]['line']
433
						&& T_OPEN_TAG !== $this->tokens[ $firstContent ]['code']
434
					) {
435
						// TODO: Reporting error at empty line won't highlight it in IDE.
436
						$error = 'Blank line found at end of control structure';
437
						if ( isset( $phpcsFile->fixer ) ) {
438
							$fix = $phpcsFile->addFixableError( $error, $i, 'BlankLineBeforeEnd' );
439
							if ( true === $fix ) {
440
								$phpcsFile->fixer->beginChangeset();
441
442
								for ( $j = ( $lastContent + 1 ); $j < $scopeCloser; $j++ ) {
443
									$phpcsFile->fixer->replaceToken( $j, '' );
444
								}
445
446
								$phpcsFile->fixer->addNewlineBefore( $scopeCloser );
447
								$phpcsFile->fixer->endChangeset();
448
							}
449
						} else {
450
							$phpcsFile->addError( $error, $i, 'BlankLineBeforeEnd' );
451
						} // end if
452
						break;
453
					} // end if
454
				} // end for
455
			} // end if
456
		} // end if
457
458
		$trailingContent = $phpcsFile->findNext( T_WHITESPACE, ( $scopeCloser + 1 ), null, true );
459
		if ( T_ELSE === $this->tokens[ $trailingContent ]['code'] ) {
460
			if ( T_IF === $this->tokens[ $stackPtr ]['code'] ) {
461
				// IF with ELSE.
462
				return;
463
			}
464
		}
465
466
		if ( T_COMMENT === $this->tokens[ $trailingContent ]['code'] ) {
467
			if ( $this->tokens[ $trailingContent ]['line'] === $this->tokens[ $scopeCloser ]['line'] ) {
468
				if ( '//end' === substr( $this->tokens[ $trailingContent ]['content'], 0, 5 ) ) {
469
					// There is an end comment, so we have to get the next piece
470
					// of content.
471
					$trailingContent = $phpcsFile->findNext( T_WHITESPACE, ( $trailingContent + 1), null, true );
472
				}
473
			}
474
		}
475
476
		if ( T_BREAK === $this->tokens[ $trailingContent ]['code'] ) {
477
			// If this BREAK is closing a CASE, we don't need the
478
			// blank line after this control structure.
479
			if ( isset( $this->tokens[ $trailingContent ]['scope_condition'] ) ) {
480
				$condition = $this->tokens[ $trailingContent ]['scope_condition'];
481
				if ( T_CASE === $this->tokens[ $condition ]['code'] || T_DEFAULT === $this->tokens[ $condition ]['code'] ) {
482
					return;
483
				}
484
			}
485
		}
486
487
		if ( T_CLOSE_TAG === $this->tokens[ $trailingContent ]['code'] ) {
488
			// At the end of the script or embedded code.
489
			return;
490
		}
491
492
		if ( T_CLOSE_CURLY_BRACKET === $this->tokens[ $trailingContent ]['code'] ) {
493
			// Another control structure's closing brace.
494
			if ( isset( $this->tokens[ $trailingContent ]['scope_condition'] ) ) {
495
				$owner = $this->tokens[ $trailingContent ]['scope_condition'];
496
				if ( in_array( $this->tokens[ $owner ]['code'], array( T_FUNCTION, T_CLASS, T_INTERFACE, T_TRAIT ), true ) ) {
497
					// The next content is the closing brace of a function, class, interface or trait
498
					// so normal function/class rules apply and we can ignore it.
499
					return;
500
				}
501
			}
502
503
			if ( true === $this->blank_line_after_check
504
				&& ( $this->tokens[ $scopeCloser ]['line'] + 1 ) !== $this->tokens[ $trailingContent ]['line']
505
			) {
506
				// TODO: Won't cover following case: "} echo 'OK';".
507
				$error = 'Blank line found after control structure';
508
				if ( isset( $phpcsFile->fixer ) ) {
509
					$fix = $phpcsFile->addFixableError( $error, $scopeCloser, 'BlankLineAfterEnd' );
510
					if ( true === $fix ) {
511
						$phpcsFile->fixer->beginChangeset();
512
513
						for ( $i = ( $scopeCloser + 1 ); $i < $trailingContent; $i++ ) {
514
							$phpcsFile->fixer->replaceToken( $i, '' );
515
						}
516
517
						// TODO: Instead a separate error should be triggered when content comes right after closing brace.
518
						$phpcsFile->fixer->addNewlineBefore( $trailingContent );
519
						$phpcsFile->fixer->endChangeset();
520
					}
521
				} else {
522
					$phpcsFile->addError( $error, $scopeCloser, 'BlankLineAfterEnd' );
523
				}
524
			}
525
		} // end if
526
527
	} // end process()
528
529
} // End class.
530