Automattic\WooCommerce\Database\Migrations

TableMigrator::add_error()protectedWC 1.0

Add an error message to the errors list unless it's there already.

Method of the class: TableMigrator{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->add_error( $error ): void;
$error(string) (required)
The error message to add.

TableMigrator::add_error() code WC 8.7.0

protected function add_error( string $error ): void {
	if ( is_null( $this->errors ) ) {
		$this->errors = array();
	}

	if ( ! in_array( $error, $this->errors, true ) ) {
		$this->errors[] = $error;
	}
}