Skip to content

Commit ac7b411

Browse files
committed
Use short array syntax
1 parent 2826945 commit ac7b411

29 files changed

+521
-539
lines changed

Crypt/GPG.php

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -169,71 +169,71 @@ class Crypt_GPG extends Crypt_GPGAbstract
169169
*
170170
* The array is of the form:
171171
* <code>
172-
* array(
172+
* [
173173
* $key_id => array(
174174
* 'fingerprint' => $fingerprint,
175175
* 'passphrase' => null
176176
* )
177-
* );
177+
* ];
178178
* </code>
179179
*
180180
* @var array
181181
* @see Crypt_GPG::addEncryptKey()
182182
* @see Crypt_GPG::clearEncryptKeys()
183183
*/
184-
protected $encryptKeys = array();
184+
protected $encryptKeys = [];
185185

186186
/**
187187
* Keys used to decrypt
188188
*
189189
* The array is of the form:
190190
* <code>
191-
* array(
191+
* [
192192
* $key_id => array(
193193
* 'fingerprint' => $fingerprint,
194194
* 'passphrase' => $passphrase
195195
* )
196-
* );
196+
* ];
197197
* </code>
198198
*
199199
* @var array
200200
* @see Crypt_GPG::addSignKey()
201201
* @see Crypt_GPG::clearSignKeys()
202202
*/
203-
protected $signKeys = array();
203+
protected $signKeys = [];
204204

205205
/**
206206
* Keys used to sign
207207
*
208208
* The array is of the form:
209209
* <code>
210-
* array(
210+
* [
211211
* $key_id => array(
212212
* 'fingerprint' => $fingerprint,
213213
* 'passphrase' => $passphrase
214214
* )
215-
* );
215+
* ];
216216
* </code>
217217
*
218218
* @var array
219219
* @see Crypt_GPG::addDecryptKey()
220220
* @see Crypt_GPG::clearDecryptKeys()
221221
*/
222-
protected $decryptKeys = array();
222+
protected $decryptKeys = [];
223223

224224
/**
225225
* Passphrases used on import/export of private keys in GnuPG 2.1
226226
*
227227
* The array is of the form:
228228
* <code>
229-
* array($key_id => $passphrase);
229+
* [$key_id => $passphrase];
230230
* </code>
231231
*
232232
* @var array
233233
* @see Crypt_GPG::addPassphrase()
234234
* @see Crypt_GPG::clearPassphrases()
235235
*/
236-
protected $passphrases = array();
236+
protected $passphrases = [];
237237

238238
/**
239239
* Imports a public or private key into the keyring
@@ -428,10 +428,10 @@ public function deletePublicKey($keyId)
428428
}
429429

430430
$operation = '--delete-key -- ' . escapeshellarg($fingerprint);
431-
$arguments = array(
431+
$arguments = [
432432
'--batch',
433433
'--yes'
434-
);
434+
];
435435

436436
$this->engine->reset();
437437
$this->engine->setOperation($operation, $arguments);
@@ -475,10 +475,10 @@ public function deletePrivateKey($keyId)
475475
}
476476

477477
$operation = '--delete-secret-key -- ' . escapeshellarg($fingerprint);
478-
$arguments = array(
478+
$arguments = [
479479
'--batch',
480480
'--yes'
481-
);
481+
];
482482

483483
$this->engine->reset();
484484
$this->engine->setOperation($operation, $arguments);
@@ -547,10 +547,10 @@ public function getFingerprint($keyId, $format = self::FORMAT_NONE)
547547
{
548548
$output = '';
549549
$operation = '--list-keys -- ' . escapeshellarg($keyId);
550-
$arguments = array(
550+
$arguments = [
551551
'--with-colons',
552552
'--with-fingerprint'
553-
);
553+
];
554554

555555
$this->engine->reset();
556556
$this->engine->setOutput($output);
@@ -1196,7 +1196,7 @@ public function addPassphrase($key, $passphrase)
11961196
*/
11971197
public function clearDecryptKeys()
11981198
{
1199-
$this->decryptKeys = array();
1199+
$this->decryptKeys = [];
12001200
return $this;
12011201
}
12021202

@@ -1210,7 +1210,7 @@ public function clearDecryptKeys()
12101210
*/
12111211
public function clearEncryptKeys()
12121212
{
1213-
$this->encryptKeys = array();
1213+
$this->encryptKeys = [];
12141214
return $this;
12151215
}
12161216

@@ -1224,7 +1224,7 @@ public function clearEncryptKeys()
12241224
*/
12251225
public function clearSignKeys()
12261226
{
1227-
$this->signKeys = array();
1227+
$this->signKeys = [];
12281228
return $this;
12291229
}
12301230

@@ -1239,7 +1239,7 @@ public function clearSignKeys()
12391239
*/
12401240
public function clearPassphrases()
12411241
{
1242-
$this->passphrases = array();
1242+
$this->passphrases = [];
12431243
return $this;
12441244
}
12451245

@@ -1295,7 +1295,7 @@ public function getWarnings()
12951295
protected function _addKey(array &$array, $encrypt, $sign, $key,
12961296
$passphrase = null
12971297
) {
1298-
$subKeys = array();
1298+
$subKeys = [];
12991299

13001300
if (is_scalar($key)) {
13011301
$keys = $this->getKeys($key);
@@ -1358,10 +1358,10 @@ protected function _addKey(array &$array, $encrypt, $sign, $key,
13581358
);
13591359
}
13601360

1361-
$array[$subKey->getId()] = array(
1361+
$array[$subKey->getId()] = [
13621362
'fingerprint' => $subKey->getFingerprint(),
13631363
'passphrase' => $passphrase
1364-
);
1364+
];
13651365
}
13661366
}
13671367

@@ -1398,8 +1398,8 @@ protected function _addKey(array &$array, $encrypt, $sign, $key,
13981398
*/
13991399
protected function _importKey($key, $isFile)
14001400
{
1401-
$result = array();
1402-
$arguments = array();
1401+
$result = [];
1402+
$arguments = [];
14031403
$input = $this->_prepareInput($key, $isFile, false);
14041404
$version = $this->engine->getVersion();
14051405

@@ -1464,7 +1464,7 @@ protected function _exportKey($keyId, $armor = true, $private = false)
14641464
$keyData = '';
14651465
$operation = $private ? '--export-secret-keys' : '--export';
14661466
$operation .= ' -- ' . escapeshellarg($fingerprint);
1467-
$arguments = $armor ? array('--armor') : array();
1467+
$arguments = $armor ? ['--armor'] : [];
14681468

14691469
$this->engine->reset();
14701470
$this->engine->setPins($this->passphrases);
@@ -1509,7 +1509,7 @@ protected function _encrypt($data, $isFile, $outputFile, $armor)
15091509

15101510
$input = $this->_prepareInput($data, $isFile);
15111511
$output = $this->_prepareOutput($outputFile, $input);
1512-
$arguments = $armor ? array('--armor') : array();
1512+
$arguments = $armor ? ['--armor'] : [];
15131513

15141514
foreach ($this->encryptKeys as $key) {
15151515
$arguments[] = '--recipient ' . escapeshellarg($key['fingerprint']);
@@ -1640,7 +1640,7 @@ protected function _sign($data, $isFile, $outputFile, $mode, $armor,
16401640
break;
16411641
}
16421642

1643-
$arguments = array();
1643+
$arguments = [];
16441644

16451645
if ($armor) {
16461646
$arguments[] = '--armor';
@@ -1713,7 +1713,7 @@ protected function _encryptAndSign($data, $isFile, $outputFile, $armor)
17131713

17141714
$input = $this->_prepareInput($data, $isFile);
17151715
$output = $this->_prepareOutput($outputFile, $input);
1716-
$arguments = $armor ? array('--armor') : array();
1716+
$arguments = $armor ? ['--armor'] : [];
17171717

17181718
foreach ($this->signKeys as $key) {
17191719
$arguments[] = '--local-user ' .
@@ -1766,12 +1766,12 @@ protected function _verify($data, $isFile, $signature)
17661766
{
17671767
if ($signature == '') {
17681768
$operation = '--verify';
1769-
$arguments = array();
1769+
$arguments = [];
17701770
} else {
17711771
// Signed data goes in FD_MESSAGE, detached signature data goes in
17721772
// FD_INPUT.
17731773
$operation = '--verify - "-&' . Crypt_GPG_Engine::FD_MESSAGE. '"';
1774-
$arguments = array('--enable-special-filenames');
1774+
$arguments = ['--enable-special-filenames'];
17751775
}
17761776

17771777
$input = $this->_prepareInput($data, $isFile, false);
@@ -1847,10 +1847,10 @@ protected function _decryptAndVerify($data, $isFile, $outputFile, $ignoreVerifyE
18471847
$this->engine->setProcessData('IgnoreVerifyErrors', $ignoreVerifyErrors);
18481848
$this->engine->run();
18491849

1850-
$return = array(
1850+
$return = [
18511851
'data' => null,
18521852
'signatures' => $this->engine->getProcessData('Signatures')
1853-
);
1853+
];
18541854

18551855
if ($outputFile === null) {
18561856
$return['data'] = $output;

0 commit comments

Comments
 (0)