WordPress/Sniffs/Arrays/ArrayDeclarationSpacingSniff.php
protected function process_multi_line_array( $stackPtr, $opener, $closer ) {
		/*
		 * Check that the closing bracket is on a new line.
		 */
		$last_content = $this->phpcsFile->findPrevious( \T_WHITESPACE, ( $closer - 1 ), $opener, true );
		if ( false !== $last_content
			&& $this->tokens[ $last_content ]['line'] === $this->tokens[ $closer ]['line']
		) {
			$fix = $this->phpcsFile->addFixableError(
				'Closing parenthesis of array declaration must be on a new line',
				$closer,
				'CloseBraceNewLine'
			);
			if ( true === $fix ) {
				$this->phpcsFile->fixer->beginChangeset();

				if ( $last_content < ( $closer - 1 )
					&& \T_WHITESPACE === $this->tokens[ ( $closer - 1 ) ]['code']
				) {
					// Remove whitespace which would otherwise becoming trailing
					// (as it gives problems with the fixed file).
					$this->phpcsFile->fixer->replaceToken( ( $closer - 1 ), '' );
				}

				$this->phpcsFile->fixer->addNewlineBefore( $closer );
				$this->phpcsFile->fixer->endChangeset();
			}
		}

		/*
		 * Check that each array item starts on a new line.
		 */
		$array_items      = $this->get_function_call_parameters( $stackPtr );
		$end_of_last_item = $opener;

		foreach ( $array_items as $item ) {
			$end_of_this_item = ( $item['end'] + 1 );

			// Find the line on which the item starts.
			$first_content = $this->phpcsFile->findNext(
				array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE ),
				$item['start'],
				$end_of_this_item,
				true
			);

			// Ignore comments after array items if the next real content starts on a new line.
			if ( $this->tokens[ $first_content ]['line'] === $this->tokens[ $end_of_last_item ]['line']
				&& ( \T_COMMENT === $this->tokens[ $first_content ]['code']
				|| isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $first_content ]['code'] ] ) )
			) {
				$end_of_comment = $first_content;

				// Find the end of (multi-line) /* */- style trailing comments.
				if ( substr( ltrim( $this->tokens[ $end_of_comment ]['content'] ), 0, 2 ) === '/*' ) {
					while ( ( \T_COMMENT === $this->tokens[ $end_of_comment ]['code']
						|| isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $end_of_comment ]['code'] ] ) )
						&& substr( rtrim( $this->tokens[ $end_of_comment ]['content'] ), -2 ) !== '*/'
						&& ( $end_of_comment + 1 ) < $end_of_this_item
					) {
						$end_of_comment++;
					}

					if ( $this->tokens[ $end_of_comment ]['line'] !== $this->tokens[ $end_of_last_item ]['line'] ) {
						// Multi-line trailing comment.
						$end_of_last_item = $end_of_comment;
					}
				}

				$next = $this->phpcsFile->findNext(
					array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE ),
					( $end_of_comment + 1 ),
					$end_of_this_item,
					true
				);

				if ( false === $next ) {
					// Shouldn't happen, but just in case.
					$end_of_last_item = $end_of_this_item;
					continue;
				}

				if ( $this->tokens[ $next ]['line'] !== $this->tokens[ $first_content ]['line'] ) {
					$first_content = $next;
				}
			}

			if ( false === $first_content ) {
				// Shouldn't happen, but just in case.
				$end_of_last_item = $end_of_this_item;
				continue;
			}

			if ( $this->tokens[ $end_of_last_item ]['line'] === $this->tokens[ $first_content ]['line'] ) {

				$fix = $this->phpcsFile->addFixableError(
					'Each item in a multi-line array must be on a new line',
					$first_content,
					'ArrayItemNoNewLine'
				);

				if ( true === $fix ) {

					$this->phpcsFile->fixer->beginChangeset();

					if ( ( $end_of_last_item + 1 ) <= ( $first_content - 1 )
						&& \T_WHITESPACE === $this->tokens[ ( $first_content - 1 ) ]['code']
					) {
						// Remove whitespace which would otherwise becoming trailing
						// (as it gives problems with the fixed file).
						$this->phpcsFile->fixer->replaceToken( ( $first_content - 1 ), '' );
					}

					$this->phpcsFile->fixer->addNewlineBefore( $first_content );
					$this->phpcsFile->fixer->endChangeset();
				}
			}

			$end_of_last_item = $end_of_this_item;
		}
	}
protected function process_multi_line_array( $stackPtr, $opener, $closer ) {
		/*
		 * Check that the closing bracket is on a new line.
		 */
		$last_content = $this->phpcsFile->findPrevious( \T_WHITESPACE, ( $closer - 1 ), $opener, true );
		if ( false !== $last_content
			&& $this->tokens[ $last_content ]['line'] === $this->tokens[ $closer ]['line']
		) {
			$fix = $this->phpcsFile->addFixableError(
				'Closing parenthesis of array declaration must be on a new line',
				$closer,
				'CloseBraceNewLine'
			);
			if ( true === $fix ) {
				$this->phpcsFile->fixer->beginChangeset();

				if ( $last_content < ( $closer - 1 )
					&& \T_WHITESPACE === $this->tokens[ ( $closer - 1 ) ]['code']
				) {
					// Remove whitespace which would otherwise becoming trailing
					// (as it gives problems with the fixed file).
					$this->phpcsFile->fixer->replaceToken( ( $closer - 1 ), '' );
				}

				$this->phpcsFile->fixer->addNewlineBefore( $closer );
				$this->phpcsFile->fixer->endChangeset();
			}
		}

		/*
		 * Check that each array item starts on a new line.
		 */
		$array_items      = $this->get_function_call_parameters( $stackPtr );
		$end_of_last_item = $opener;

		foreach ( $array_items as $item ) {
			$end_of_this_item = ( $item['end'] + 1 );

			// Find the line on which the item starts.
			$first_content = $this->phpcsFile->findNext(
				array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE ),
				$item['start'],
				$end_of_this_item,
				true
			);

			// Ignore comments after array items if the next real content starts on a new line.
			if ( $this->tokens[ $first_content ]['line'] === $this->tokens[ $end_of_last_item ]['line']
				&& ( \T_COMMENT === $this->tokens[ $first_content ]['code']
				|| isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $first_content ]['code'] ] ) )
			) {
				$end_of_comment = $first_content;

				// Find the end of (multi-line) /* */- style trailing comments.
				if ( substr( ltrim( $this->tokens[ $end_of_comment ]['content'] ), 0, 2 ) === '/*' ) {
					while ( ( \T_COMMENT === $this->tokens[ $end_of_comment ]['code']
						|| isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $end_of_comment ]['code'] ] ) )
						&& substr( rtrim( $this->tokens[ $end_of_comment ]['content'] ), -2 ) !== '*/'
						&& ( $end_of_comment + 1 ) < $end_of_this_item
					) {
						$end_of_comment++;
					}

					if ( $this->tokens[ $end_of_comment ]['line'] !== $this->tokens[ $end_of_last_item ]['line'] ) {
						// Multi-line trailing comment.
						$end_of_last_item = $end_of_comment;
					}
				}

				$next = $this->phpcsFile->findNext(
					array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE ),
					( $end_of_comment + 1 ),
					$end_of_this_item,
					true
				);

				if ( false === $next ) {
					// Shouldn't happen, but just in case.
					$end_of_last_item = $end_of_this_item;
					continue;
				}

				if ( $this->tokens[ $next ]['line'] !== $this->tokens[ $first_content ]['line'] ) {
					$first_content = $next;
				}
			}

			if ( false === $first_content ) {
				// Shouldn't happen, but just in case.
				$end_of_last_item = $end_of_this_item;
				continue;
			}

			if ( $this->tokens[ $end_of_last_item ]['line'] === $this->tokens[ $first_content ]['line'] ) {

				$fix = $this->phpcsFile->addFixableError(
					'Each item in a multi-line array must be on a new line',
					$first_content,
					'ArrayItemNoNewLine'
				);

				if ( true === $fix ) {

					$this->phpcsFile->fixer->beginChangeset();

					if ( ( $end_of_last_item + 1 ) <= ( $first_content - 1 )
						&& \T_WHITESPACE === $this->tokens[ ( $first_content - 1 ) ]['code']
					) {
						// Remove whitespace which would otherwise becoming trailing
						// (as it gives problems with the fixed file).
						$this->phpcsFile->fixer->replaceToken( ( $first_content - 1 ), '' );
					}

					$this->phpcsFile->fixer->addNewlineBefore( $first_content );
					$this->phpcsFile->fixer->endChangeset();
				}
			}

			$end_of_last_item = $end_of_this_item;
		}
	}
Process a multi-line array.

@since 0.13.0 The actual checks contained in this method used to
be in the `ArrayDeclaration` sniff.

@param int $stackPtr The position of the current token in the stack.
@param int $opener   The position of the array opener.
@param int $closer   The position of the array closer.

@return void