Commit 6e7edfdf by Alexander Mohorev

short array syntax

parent 90c7bf28
......@@ -32,7 +32,7 @@ class FixtureHelper extends Module
* to use in acceptance and functional tests.
* @param array $settings
*/
public function _beforeSuite($settings = array())
public function _beforeSuite($settings = [])
{
$this->loadFixtures();
}
......
......@@ -239,7 +239,7 @@ class OpenId extends BaseClient implements ClientInterface
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*'));
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Accept: application/xrds+xml, */*']);
if ($this->verifyPeer !== null) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer);
......
......@@ -64,7 +64,7 @@ class ActiveField extends \yii\widgets\ActiveField
static $counter = 0;
$this->inputOptions['class'] .= ' typeahead-' . (++$counter);
foreach ($data as &$item) {
$item = array('word' => $item);
$item = ['word' => $item];
}
$this->form->getView()->registerJs("yii.gii.autocomplete($counter, " . Json::encode($data) . ");");
return $this;
......
......@@ -160,7 +160,7 @@ class Customer extends \yii\redis\ActiveRecord
*/
public static function active($query)
{
$query->andWhere(array('status' => 1));
$query->andWhere(['status' => 1]);
}
}
```
......
......@@ -38,6 +38,6 @@ class ViewRendererStaticClassProxy
public function __call($method, $arguments)
{
return call_user_func_array(array($this->_staticClassName, $method), $arguments);
return call_user_func_array([$this->_staticClassName, $method], $arguments);
}
}
\ No newline at end of file
......@@ -508,11 +508,11 @@ class BaseFileHelper
if (!is_string($pattern)) {
throw new InvalidParamException('Exclude/include pattern must be a string.');
}
$result = array(
$result = [
'pattern' => $pattern,
'flags' => 0,
'firstWildcard' => false,
);
];
if (!isset($pattern[0]))
return $result;
......@@ -542,7 +542,7 @@ class BaseFileHelper
*/
private static function firstWildcardInPattern($pattern)
{
$wildcards = array('*','?','[','\\');
$wildcards = ['*','?','[','\\'];
$wildcardSearch = function($r, $c) use ($pattern) {
$p = strpos($pattern, $c);
return $r===false ? $p : ($p===false ? $r : min($r, $p));
......
......@@ -16,7 +16,7 @@
*
* NOTE: this file must be saved in UTF-8 encoding.
*/
return array(
return [
'the input value' => 'قيمة المُدخل',
'(not set)' => '(لم تحدد)',
'An internal server error occurred.' => '.حدث خطأ داخلي في الخادم',
......@@ -78,4 +78,4 @@ return array(
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.' => '{attribute} يجب أن يحتوي على أكثر من {min, number} {min, plural, one{character} other{characters}}.',
'{attribute} should contain at most {max, number} {max, plural, one{character} other{characters}}.' => '{attribute} يجب أن لا يحتوي على أكثر من {max, number} {max, plural, one{character} other{characters}}.',
'{attribute} should contain {length, number} {length, plural, one{character} other{characters}}.' => '{attribute} يجب أن يحتوي على {length, number} {length, plural, one{character} other{characters}}.',
);
];
......@@ -9,7 +9,7 @@ class CustomerQuery extends ActiveQuery
{
public function active()
{
$this->andWhere(array('status' => 1));
$this->andWhere(['status' => 1]);
return $this;
}
}
......@@ -41,7 +41,7 @@ class ElasticSearchTestCase extends TestCase
public function getConnection($reset = true)
{
$databases = $this->getParam('databases');
$params = isset($databases['elasticsearch']) ? $databases['elasticsearch'] : array();
$params = isset($databases['elasticsearch']) ? $databases['elasticsearch'] : [];
$db = new Connection();
if ($reset) {
$db->open();
......
......@@ -254,12 +254,12 @@ class FileHelperTest extends TestCase
public function testFindFilesExclude()
{
$basePath = $this->testFilePath . DIRECTORY_SEPARATOR;
$dirs = array('', 'one', 'one'.DIRECTORY_SEPARATOR.'two', 'three');
$dirs = ['', 'one', 'one'.DIRECTORY_SEPARATOR.'two', 'three'];
$files = array_fill_keys(array_map(function($n){return "a.$n";}, range(1,8)), 'file contents');
$tree = $files;
$root = $files;
$flat = array();
$flat = [];
foreach($dirs as $dir) {
foreach($files as $fileName=>$contents) {
$flat[] = rtrim($basePath.$dir,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$fileName;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment