protected function validate_align_multiline_items() {
		$alignMultilineItems = $this->alignMultilineItems;

		if ( 'always' === $alignMultilineItems || 'never' === $alignMultilineItems ) {
			return;
		} else {
			// Correct for a potentially added % sign.
			$alignMultilineItems = rtrim( $alignMultilineItems, '%' );

			if ( preg_match( '`^([=<>!]{1,2})(100|[0-9]{1,2})$`', $alignMultilineItems, $matches ) > 0 ) {
				$operator = $matches[1];
				$number   = (int) $matches[2];

				if ( \in_array( $operator, array( '<', '<=', '>', '>=', '==', '=', '!=', '<>' ), true ) === true
					&& ( $number >= 0 && $number <= 100 )
				) {
					$this->alignMultilineItems = $alignMultilineItems;
					$this->number              = (string) $number;
					$this->operator            = $operator;
					return;
				}
			}
		}

		$this->phpcsFile->addError(
			'Invalid property value passed: "%s". The value for the "alignMultilineItems" property for the "WordPress.Arrays.MultipleStatementAlignment" sniff should be either "always", "never" or an comparison operator + a number between 0 and 100.',
			0,
			'InvalidPropertyPassed',
			array( $this->alignMultilineItems )
		);

		// Reset to the default if an invalid value was received.
		$this->alignMultilineItems = 'always';
	}
protected function validate_align_multiline_items() {
		$alignMultilineItems = $this->alignMultilineItems;

		if ( 'always' === $alignMultilineItems || 'never' === $alignMultilineItems ) {
			return;
		} else {
			// Correct for a potentially added % sign.
			$alignMultilineItems = rtrim( $alignMultilineItems, '%' );

			if ( preg_match( '`^([=<>!]{1,2})(100|[0-9]{1,2})$`', $alignMultilineItems, $matches ) > 0 ) {
				$operator = $matches[1];
				$number   = (int) $matches[2];

				if ( \in_array( $operator, array( '<', '<=', '>', '>=', '==', '=', '!=', '<>' ), true ) === true
					&& ( $number >= 0 && $number <= 100 )
				) {
					$this->alignMultilineItems = $alignMultilineItems;
					$this->number              = (string) $number;
					$this->operator            = $operator;
					return;
				}
			}
		}

		$this->phpcsFile->addError(
			'Invalid property value passed: "%s". The value for the "alignMultilineItems" property for the "WordPress.Arrays.MultipleStatementAlignment" sniff should be either "always", "never" or an comparison operator + a number between 0 and 100.',
			0,
			'InvalidPropertyPassed',
			array( $this->alignMultilineItems )
		);

		// Reset to the default if an invalid value was received.
		$this->alignMultilineItems = 'always';
	}
protected function validate_align_multiline_items ( ) { $ alignMultilineItems = $ this -> alignMultilineItems ; if ( 'always' === $ alignMultilineItems || 'never' === $ alignMultilineItems ) { return ; } else { // Correct for a potentially added % sign. $ alignMultilineItems = rtrim ( $ alignMultilineItems , '%' ) ; if ( preg_match ( '`^([=<>!]{1,2})(100|[0-9]{1,2})$`' , $ alignMultilineItems , $ matches ) > 0 ) { $ operator = $ matches [ 1 ] ; $ number = ( int ) $ matches [ 2 ] ; if ( \ in_array ( $ operator , array ( '<' , '<=' , '>' , '>=' , '==' , '=' , '!=' , '<>' ) , true ) === true && ( $ number >= 0 && $ number <= 100 ) ) { $ this -> alignMultilineItems = $ alignMultilineItems ; $ this -> number = ( string ) $ number ; $ this -> operator = $ operator ; return ; } } } $ this -> phpcsFile -> addError ( 'Invalid property value passed: "%s". The value for the "alignMultilineItems" property for the "WordPress.Arrays.MultipleStatementAlignment" sniff should be either "always", "never" or an comparison operator + a number between 0 and 100.' , 0 , 'InvalidPropertyPassed' , array ( $ this -> alignMultilineItems ) ) ; // Reset to the default if an invalid value was received. $ this -> alignMultilineItems = 'always' ; }
Validate that a valid value has been received for the alignMultilineItems property.

This message may be thrown more than once if the property is being changed inline in a file.

@since 0.14.0
Validate that a valid value has been received for the alignMultilineItems property .