Commit 6e7edfdf by Alexander Mohorev

short array syntax

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