Skip to content

Commit

Permalink
Short array syntax, CS fixes, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Nov 26, 2020
1 parent e8b3319 commit c98059e
Show file tree
Hide file tree
Showing 6 changed files with 338 additions and 265 deletions.
22 changes: 11 additions & 11 deletions program/lib/Roundcube/bootstrap.php
Expand Up @@ -25,24 +25,24 @@
* @subpackage Core
*/

$config = array(
$config = [
'error_reporting' => E_ALL & ~E_NOTICE & ~E_STRICT,
'display_errors' => false,
'log_errors' => true,
// Some users are not using Installer, so we'll check some
// critical PHP settings here. Only these, which doesn't provide
// an error/warning in the logs later. See (#1486307).
'mbstring.func_overload' => 0,
);
];

// check these additional ini settings if not called via CLI
if (php_sapi_name() != 'cli') {
$config += array(
$config += [
'suhosin.session.encrypt' => false,
'file_uploads' => true,
'session.auto_start' => false,
'zlib.output_compression' => false,
);
];
}

foreach ($config as $optname => $optval) {
Expand Down Expand Up @@ -109,7 +109,7 @@
* @param string $needle Needle value
* @param array $heystack Array to search in
*
* @return boolean True if found, False if not
* @return bool True if found, False if not
*/
function in_array_nocase($needle, $haystack)
{
Expand Down Expand Up @@ -279,7 +279,7 @@ function abbreviate_string($str, $maxlength, $placeholder = '...', $ending = fal
*/
function array_keys_recursive($array)
{
$keys = array();
$keys = [];

if (!empty($array) && is_array($array)) {
foreach ($array as $key => $child) {
Expand All @@ -305,7 +305,7 @@ function array_keys_recursive($array)
function asciiwords($str, $css_id = false, $replace_with = '')
{
$allowed = 'a-z0-9\_\-' . (!$css_id ? '\.' : '');
return preg_replace("/[^$allowed]/i", $replace_with, $str);
return preg_replace("/[^$allowed]+/i", $replace_with, $str);
}

/**
Expand Down Expand Up @@ -378,8 +378,8 @@ function format_email($email)
function version_parse($version)
{
return str_replace(
array('-stable', '-git'),
array('.0', '.99'),
['-stable', '-git'],
['.0', '.99'],
$version
);
}
Expand All @@ -400,7 +400,7 @@ function idn_to_utf8($domain)
static $idn, $loaded;

if (!$loaded) {
$idn = new Net_IDNA2(array('version' => '2008'));
$idn = new Net_IDNA2(['version' => '2008']);
$loaded = true;
}

Expand Down Expand Up @@ -431,7 +431,7 @@ function idn_to_ascii($domain)
static $idn, $loaded;

if (!$loaded) {
$idn = new Net_IDNA2(array('version' => '2008'));
$idn = new Net_IDNA2(['version' => '2008']);
$loaded = true;
}

Expand Down

0 comments on commit c98059e

Please sign in to comment.