Skip to content

Commit fb3695a

Browse files
committed
code style: replaced traditional syntax array literals
pushed minimum required PHP version to 7.2
1 parent 3d8140a commit fb3695a

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

app/ConfigLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class ConfigLoader
2121
public function __construct()
2222
{
2323
$globalConfig = APP_ROOT . '/config.ini';
24-
$extraConfigs = array(
24+
$extraConfigs = [
2525
APP_ROOT . '/config.local.ini',
2626
APP_ROOT . '/config.private.ini'
27-
);
27+
];
2828

2929
// load global config
3030
$config = parse_ini_file($globalConfig, true);
@@ -80,7 +80,7 @@ protected function _arrayToObject(array $arr)
8080
* Using __FUNCTION__ (Magic constant)
8181
* for recursive call
8282
*/
83-
return (object)array_map(array($this, __FUNCTION__), $arr);
83+
return (object)array_map([$this, __FUNCTION__], $arr);
8484
} else {
8585
// Return object
8686
return $arr;

app/SendmailWrapper.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ public function run()
6060

6161
// count total number of recipients
6262
$rcptCount = 0;
63-
$rcptHeaders = array('to', 'cc', 'bcc');
63+
$rcptHeaders = ['to', 'cc', 'bcc'];
6464
foreach ($rcptHeaders as $rcptHeader) {
6565
if (isset($headerArr[$rcptHeader])) {
6666
// parse recipient headers according to RFC2822 (http://www.faqs.org/rfcs/rfc2822.html)
6767
$rcptCount += count(imap_rfc822_parse_adrlist($headerArr[$rcptHeader], $defaultHost));
6868
}
6969
}
7070

71-
$messageInfo = array(
71+
$messageInfo = [
7272
'uid' => `whoami`,
7373
'msgid' => $msgId,
7474
'from' => @$headerArr['from'],
@@ -79,7 +79,7 @@ public function run()
7979
'site' => @$_SERVER["HTTP_HOST"],
8080
'client' => @$_SERVER["REMOTE_ADDR"],
8181
'script' => getenv('SCRIPT_FILENAME')
82-
);
82+
];
8383

8484
// throttling
8585
if ($throttleOn) {
@@ -92,15 +92,15 @@ public function run()
9292
// redirect STDIN data to throttle command
9393
// We're going to use the whole email message including some
9494
// extra headers.
95-
$throttleMsg = $this->buildMessage(array(
95+
$throttleMsg = $this->buildMessage([
9696
'X-Meta-MsgID' => $messageInfo['msgid'],
9797
'X-Meta-Site' => $messageInfo['site'],
9898
'X-Meta-Client' => $messageInfo['client'],
9999
'X-Meta-Script' => $messageInfo['script'],
100-
));
101-
$descriptorSpec = array(
102-
0 => array('pipe', 'r')
103-
);
100+
]);
101+
$descriptorSpec = [
102+
0 => ['pipe', 'r']
103+
];
104104
$proc = proc_open($throttleCmd, $descriptorSpec, $pipes);
105105
if (is_resource($proc)) {
106106
fwrite($pipes[0], $throttleMsg);

app/StdinMailParser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class StdinMailParser
2121
/**
2222
* @var array
2323
*/
24-
protected $_additionalHeaders = array();
24+
protected $_additionalHeaders = [];
2525

2626
/**
2727
* @var string
@@ -34,7 +34,7 @@ abstract class StdinMailParser
3434
*
3535
* @var array
3636
*/
37-
protected $_rfc5322MultiHeaders = array(
37+
protected $_rfc5322MultiHeaders = [
3838
'trace',
3939
'resent-date',
4040
'resent-from',
@@ -46,7 +46,7 @@ abstract class StdinMailParser
4646
'comments',
4747
'keywords',
4848
'optional-field'
49-
);
49+
];
5050

5151
/**
5252
* Constructor
@@ -106,7 +106,7 @@ public function setHeader($name, $value)
106106
public function getParsedHeaderArr()
107107
{
108108
$headerLines = explode(PHP_EOL, $this->_header);
109-
$headerArr = array();
109+
$headerArr = [];
110110
foreach ($headerLines as $line) {
111111
list($key, $value) = explode(":", $line);
112112
$key = strtolower(trim($key));

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"issues": "https://github.com/onlime/sendmail-wrapper/issues"
1717
},
1818
"require": {
19-
"php": ">=5.4.0",
19+
"php": ">=7.2.0",
2020
"ext-mbstring": "*",
2121
"ext-pdo": "*",
2222
"ext-imap": "*"

prepend.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22
// environment variables that should be available in child processes
3-
$envVars = array(
3+
$envVars = [
44
'HTTP_HOST',
55
'SCRIPT_NAME',
66
'SCRIPT_FILENAME',
77
'DOCUMENT_ROOT',
88
'REMOTE_ADDR'
9-
);
9+
];
1010

1111
// sanitizing environment variables for Bash ShellShock mitigation
1212
// (CVE-2014-6271, CVE-2014-7169, CVE-2014-7186, CVE-2014-7187, CVE-2014-6277)

0 commit comments

Comments
 (0)