Replace join() with implode() for compatibility with PHP 7.4

[MAILPOET-2545]
This commit is contained in:
Jan Jakeš
2019-11-26 15:33:52 +01:00
committed by Jack Kitterhing
parent 9a2dea5f37
commit a91f79263e
2 changed files with 16 additions and 16 deletions

View File

@ -1367,7 +1367,7 @@ use Serializable;
} }
} }
$query[] = "))"; $query[] = "))";
return $this->where_raw(join($query, ' '), $data); return $this->where_raw(implode(' ', $query), $data);
} }
/** /**
@ -1675,7 +1675,7 @@ use Serializable;
*/ */
protected function _build_select_start() { protected function _build_select_start() {
$fragment = 'SELECT '; $fragment = 'SELECT ';
$result_columns = join(', ', $this->_result_columns); $result_columns = implode($this->_result_columns, ', ');
if (!is_null($this->_limit) && if (!is_null($this->_limit) &&
self::$_config[$this->_connection_name]['limit_clause_style'] === ORM::LIMIT_STYLE_TOP_N) { self::$_config[$this->_connection_name]['limit_clause_style'] === ORM::LIMIT_STYLE_TOP_N) {
@ -1702,7 +1702,7 @@ use Serializable;
return ''; return '';
} }
return join(" ", $this->_join_sources); return implode($this->_join_sources, ' ');
} }
/** /**
@ -1726,7 +1726,7 @@ use Serializable;
if (count($this->_group_by) === 0) { if (count($this->_group_by) === 0) {
return ''; return '';
} }
return "GROUP BY " . join(", ", $this->_group_by); return "GROUP BY " . implode($this->_group_by, ', ');
} }
/** /**
@ -1747,7 +1747,7 @@ use Serializable;
$this->_values = array_merge($this->_values, $condition[self::CONDITION_VALUES]); $this->_values = array_merge($this->_values, $condition[self::CONDITION_VALUES]);
} }
return strtoupper($type) . " " . join(" AND ", $conditions); return strtoupper($type) . " " . implode($conditions, ' AND ');
} }
/** /**
@ -1757,7 +1757,7 @@ use Serializable;
if (count($this->_order_by) === 0) { if (count($this->_order_by) === 0) {
return ''; return '';
} }
return "ORDER BY " . join(", ", $this->_order_by); return "ORDER BY " . implode($this->_order_by, ', ');
} }
/** /**
@ -1805,7 +1805,7 @@ use Serializable;
$filtered_pieces[] = $piece; $filtered_pieces[] = $piece;
} }
} }
return join($glue, $filtered_pieces); return implode($filtered_pieces, $glue);
} }
/** /**
@ -1816,7 +1816,7 @@ use Serializable;
protected function _quote_one_identifier($identifier) { protected function _quote_one_identifier($identifier) {
$parts = explode('.', $identifier); $parts = explode('.', $identifier);
$parts = array_map(array($this, '_quote_identifier_part'), $parts); $parts = array_map(array($this, '_quote_identifier_part'), $parts);
return join('.', $parts); return implode($parts, '.');
} }
/** /**
@ -1828,7 +1828,7 @@ use Serializable;
protected function _quote_identifier($identifier) { protected function _quote_identifier($identifier) {
if (is_array($identifier)) { if (is_array($identifier)) {
$result = array_map(array($this, '_quote_one_identifier'), $identifier); $result = array_map(array($this, '_quote_one_identifier'), $identifier);
return join(', ', $result); return implode($result, ', ');
} else { } else {
return $this->_quote_one_identifier($identifier); return $this->_quote_one_identifier($identifier);
} }
@ -1860,7 +1860,7 @@ use Serializable;
if(isset(self::$_config[$connection_name]['create_cache_key']) and is_callable(self::$_config[$connection_name]['create_cache_key'])){ if(isset(self::$_config[$connection_name]['create_cache_key']) and is_callable(self::$_config[$connection_name]['create_cache_key'])){
return call_user_func_array(self::$_config[$connection_name]['create_cache_key'], array($query, $parameters, $table_name, $connection_name)); return call_user_func_array(self::$_config[$connection_name]['create_cache_key'], array($query, $parameters, $table_name, $connection_name));
} }
$parameter_string = join(',', $parameters); $parameter_string = implode($parameters, ',');
$key = $query . ':' . $parameter_string; $key = $query . ':' . $parameter_string;
return sha1($key); return sha1($key);
} }
@ -2165,9 +2165,9 @@ use Serializable;
} }
$field_list[] = "{$this->_quote_identifier($key)} = $value"; $field_list[] = "{$this->_quote_identifier($key)} = $value";
} }
$query[] = join(", ", $field_list); $query[] = implode($field_list, ', ');
$this->_add_id_column_conditions($query); $this->_add_id_column_conditions($query);
return join(" ", $query); return implode($query, ' ');
} }
/** /**
@ -2177,7 +2177,7 @@ use Serializable;
$query[] = "INSERT INTO"; $query[] = "INSERT INTO";
$query[] = $this->_quote_identifier($this->_table_name); $query[] = $this->_quote_identifier($this->_table_name);
$field_list = array_map(array($this, '_quote_identifier'), array_keys($this->_dirty_fields)); $field_list = array_map(array($this, '_quote_identifier'), array_keys($this->_dirty_fields));
$query[] = "(" . join(", ", $field_list) . ")"; $query[] = "(" . implode($field_list, ', ') . ")";
$query[] = "VALUES"; $query[] = "VALUES";
$placeholders = $this->_create_placeholders($this->_dirty_fields); $placeholders = $this->_create_placeholders($this->_dirty_fields);
@ -2187,7 +2187,7 @@ use Serializable;
$query[] = 'RETURNING ' . $this->_quote_identifier($this->_get_id_column_name()); $query[] = 'RETURNING ' . $this->_quote_identifier($this->_get_id_column_name());
} }
return join(" ", $query); return implode($query, ' ');
} }
/** /**
@ -2199,7 +2199,7 @@ use Serializable;
$this->_quote_identifier($this->_table_name) $this->_quote_identifier($this->_table_name)
); );
$this->_add_id_column_conditions($query); $this->_add_id_column_conditions($query);
return self::_execute(join(" ", $query), is_array($this->id(true)) ? array_values($this->id(true)) : array($this->id(true)), $this->_connection_name); return self::_execute(implode($query, ' '), is_array($this->id(true)) ? array_values($this->id(true)) : array($this->id(true)), $this->_connection_name);
} }
/** /**

View File

@ -504,7 +504,7 @@ use MailPoetVendor\Idiorm\ORM;
$class_names = array($base_model_name, $associated_model_name); $class_names = array($base_model_name, $associated_model_name);
sort($class_names, SORT_STRING); sort($class_names, SORT_STRING);
$join_class_name = join("", $class_names); $join_class_name = implode('', $class_names);
} }
// Get table names for each class // Get table names for each class