php/commands/src/CLI_Alias_Command.php
private function validate_alias_type( $aliases, $alias, $assoc_args, $grouping ) {

		$alias_data = $aliases[ $alias ];

		$group_aliases_match = preg_grep( '/^@(\w+)/i', $alias_data );
		$arg_match           = preg_grep( '/^set-(\w+)/i', array_keys( $assoc_args ) );

		if ( ! empty( $group_aliases_match ) && ! empty( $arg_match ) ) {
			WP_CLI::error( 'Trying to update group alias with invalid arguments.' );
		} elseif ( empty( $group_aliases_match ) && ! empty( $grouping ) ) {
			WP_CLI::error( 'Trying to update simple alias with invalid --grouping argument.' );
		}
	}
private function validate_alias_type( $aliases, $alias, $assoc_args, $grouping ) {

		$alias_data = $aliases[ $alias ];

		$group_aliases_match = preg_grep( '/^@(\w+)/i', $alias_data );
		$arg_match           = preg_grep( '/^set-(\w+)/i', array_keys( $assoc_args ) );

		if ( ! empty( $group_aliases_match ) && ! empty( $arg_match ) ) {
			WP_CLI::error( 'Trying to update group alias with invalid arguments.' );
		} elseif ( empty( $group_aliases_match ) && ! empty( $grouping ) ) {
			WP_CLI::error( 'Trying to update simple alias with invalid --grouping argument.' );
		}
	}
private function validate_alias_type ( $ aliases , $ alias , $ assoc_args , $ grouping ) { $ alias_data = $ aliases [ $ alias ] ; $ group_aliases_match = preg_grep ( '/^@(\w+)/i' , $ alias_data ) ; $ arg_match = preg_grep ( '/^set-(\w+)/i' , array_keys ( $ assoc_args ) ) ; if ( ! empty ( $ group_aliases_match ) && ! empty ( $ arg_match ) ) { WP_CLI :: error ( 'Trying to update group alias with invalid arguments.' ) ; } elseif ( empty ( $ group_aliases_match ) && ! empty ( $ grouping ) ) { WP_CLI :: error ( 'Trying to update simple alias with invalid --grouping argument.' ) ; } }
Validate alias type before update.

@param array  $aliases    Existing aliases data.
@param string $alias      Alias Name.
@param array  $assoc_args Arguments array.
@param string $grouping   Grouping argument value.

@throws WP_CLI\ExitException
Validate alias type before update .