Skip to content

Commit

Permalink
Short array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Jan 9, 2024
1 parent 68011e3 commit 9514019
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
16 changes: 8 additions & 8 deletions Sieve.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Net_Sieve
*
* @var array
*/
var $supportedAuthMethods = array(
var $supportedAuthMethods = [
'DIGEST-MD5',
'CRAM-MD5',
'EXTERNAL',
Expand All @@ -103,14 +103,14 @@ class Net_Sieve
'GSSAPI',
'XOAUTH2',
'OAUTHBEARER'
);
];

/**
* SASL authentication methods that require Auth_SASL.
*
* @var array
*/
var $supportedSASLAuthMethods = array('DIGEST-MD5', 'CRAM-MD5');
var $supportedSASLAuthMethods = ['DIGEST-MD5', 'CRAM-MD5'];

/**
* The socket handle.
Expand All @@ -131,7 +131,7 @@ class Net_Sieve
*
* @var array
*/
var $_capability = array();
var $_capability = [];

/**
* Current state of the connection.
Expand Down Expand Up @@ -1055,7 +1055,7 @@ function _cmdListScripts()
return $res;
}

$scripts = array();
$scripts = [];
$activescript = null;
$res = explode("\r\n", $res);
foreach ($res as $value) {
Expand All @@ -1068,7 +1068,7 @@ function _cmdListScripts()
}
}

return array($scripts, $activescript);
return [$scripts, $activescript];
}

/**
Expand Down Expand Up @@ -1157,7 +1157,7 @@ function _cmdCapability()
function _parseCapability($data)
{
// Clear the cached capabilities.
$this->_capability = array('sasl' => array(), 'extensions' => array());
$this->_capability = ['sasl' => [], 'extensions' => []];

$data = preg_split('/\r?\n/', $this->_toUpper($data), -1, PREG_SPLIT_NO_EMPTY);

Expand Down Expand Up @@ -1535,7 +1535,7 @@ function _debug($message)
{
if ($this->_debug) {
if ($this->_debug_handler) {
call_user_func_array($this->_debug_handler, array(&$this, $message));
call_user_func_array($this->_debug_handler, [$this, $message]);
} else {
echo "$message\n";
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
"type": "library",
"require": {
"php": ">=5.6.0",
"pear/pear-core-minimal": "~1.10",
"pear/net_socket": "~1.2"
},
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<dependencies>
<required>
<php>
<min>5.0.0</min>
<min>5.6.0</min>
</php>
<pearinstaller>
<min>1.4.0b1</min>
Expand Down
9 changes: 5 additions & 4 deletions tests/SieveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,20 @@ protected function setUp(): void
// Create a new instance of Net_Sieve.
$this->_pear = new PEAR();
$this->fixture = new Net_Sieve();
$this->scripts = array(
$this->scripts = [
'test script1' => "require \"fileinto\";\r\nif header :contains \"From\" \"@cnba.uba.ar\" \r\n{fileinto \"INBOX.Test1\";}\r\nelse \r\n{fileinto \"INBOX\";}",
'test script2' => "require \"fileinto\";\r\nif header :contains \"From\" \"@cnba.uba.ar\" \r\n{fileinto \"INBOX.Test\";}\r\nelse \r\n{fileinto \"INBOX\";}",
'test"scriptäöü3' => "require \"vacation\";\nvacation\n:days 7\n:addresses [\"[email protected]\"]\n:subject \"This is a test\"\n\"I'm on my holiday!\nsadfafs\";",
'test script4' => file_get_contents(dirname(__FILE__) . '/largescript.siv'));
'test script4' => file_get_contents(dirname(__FILE__) . '/largescript.siv'),
];
}

protected function tearDown(): void
{
// Delete the instance.
unset($this->fixture);
}

protected function login()
{
$result = $this->fixture->connect(HOST, PORT);
Expand Down

0 comments on commit 9514019

Please sign in to comment.