diff --git a/apps/advanced/common/tests/_helpers/FixtureHelper.php b/apps/advanced/common/tests/_helpers/FixtureHelper.php index 00c3a1700f..747e886c77 100644 --- a/apps/advanced/common/tests/_helpers/FixtureHelper.php +++ b/apps/advanced/common/tests/_helpers/FixtureHelper.php @@ -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(); } diff --git a/extensions/authclient/OpenId.php b/extensions/authclient/OpenId.php index 3aba0fd676..2afad4cb22 100644 --- a/extensions/authclient/OpenId.php +++ b/extensions/authclient/OpenId.php @@ -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); diff --git a/extensions/gii/components/ActiveField.php b/extensions/gii/components/ActiveField.php index 24399fb8d1..d128aa28d4 100644 --- a/extensions/gii/components/ActiveField.php +++ b/extensions/gii/components/ActiveField.php @@ -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; diff --git a/extensions/redis/README.md b/extensions/redis/README.md index eff0a3f825..02ce11a40d 100644 --- a/extensions/redis/README.md +++ b/extensions/redis/README.md @@ -160,7 +160,7 @@ class Customer extends \yii\redis\ActiveRecord */ public static function active($query) { - $query->andWhere(array('status' => 1)); + $query->andWhere(['status' => 1]); } } ``` diff --git a/extensions/twig/ViewRendererStaticClassProxy.php b/extensions/twig/ViewRendererStaticClassProxy.php index 3823ce0a07..46a6dc2d1e 100644 --- a/extensions/twig/ViewRendererStaticClassProxy.php +++ b/extensions/twig/ViewRendererStaticClassProxy.php @@ -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 diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php index c544a911e4..2f7bb5717a 100644 --- a/framework/helpers/BaseFileHelper.php +++ b/framework/helpers/BaseFileHelper.php @@ -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)); diff --git a/framework/messages/ar/yii.php b/framework/messages/ar/yii.php index 92b219f117..c6382cdb54 100644 --- a/framework/messages/ar/yii.php +++ b/framework/messages/ar/yii.php @@ -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}}.', -); +]; diff --git a/framework/messages/fa-IR/yii.php b/framework/messages/fa-IR/yii.php index 1344ffcf85..6e82946627 100644 --- a/framework/messages/fa-IR/yii.php +++ b/framework/messages/fa-IR/yii.php @@ -18,66 +18,66 @@ * * NOTE: this file must be saved in UTF-8 encoding. */ -return array( - 'the input value' => 'مقدار ورودی', - '(not set)' => '(تنظیم نشده)', - 'An internal server error occurred.' => 'خطای داخلی سرور رخ داده است.', - 'Are you sure to delete this item?' => 'آیا اطمینان به حذف این مورد دارید؟', - 'Delete' => 'حذف', - 'Error' => 'خطا', - 'File upload failed.' => 'آپلود فایل شکست خورد.', - 'Home' => 'صفحه‌اصلی', - 'Invalid data received for parameter "{param}".' => 'برای پارامتر "{param}" اطلاعات نادرستی دریافت شده است.', - 'Login Required' => 'ورود اجباری', - 'Missing required arguments: {params}' => 'فاقد آرگومان‌های مورد نیاز: {params}', - 'Missing required parameters: {params}' => 'فاقد پارامترهای مورد نیاز: {params}', - 'No' => 'خیر', - 'No help for unknown command "{command}".' => 'فرمان ناشناخته بدون راهنما: "{command}".', - 'No help for unknown sub-command "{command}".' => 'زیرفرمان ناشناخته بدون راهنما: "{command}".', - 'No results found.' => 'نتیجه‌ای یافت نشد.', - 'Only files with these extensions are allowed: {extensions}.' => 'فقط فایل‌های با این پسوندها مجاز هستند: {extentions}.', - 'Only files with these mimeTypes are allowed: {mimeTypes}.' => 'فقط فایل‌های با این قوائد مجاز هستند: {extentions}.', - 'Page not found.' => 'صفحه‌ای یافت نشد.', - 'Please fix the following errors:' => 'لطفاً خطاهای زیر را رفع نمائید:', - 'Please upload a file.' => 'لطفاً یک فایل آپلود کنید.', - 'Showing {begin, number}-{end, number} of {totalCount, number} {totalCount, plural, one{item} other{items}}.' => 'نمایش {begin, number} تا {end, number} مورد از کل {totalCount, number} مورد.', - 'The file "{file}" is not an image.' => 'فایل "{file}" یک تصویر نیست.', - 'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'حجم فایل "{file}" بیش از حد زیاد است. مقدار آن نمی‌تواند بیشتر از {limit, number} بایت باشد.', - 'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'حجم فایل "{file}" بیش از حد کم است. مقدار آن نمی‌تواند کمتر از {limit, number} بایت باشد.', - 'The format of {attribute} is invalid.' => 'قالب {attribute} نامعتبر است.', - 'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی بزرگ است. ارتفاع نمی‌تواند بزرگتر از {limit, number} پیکسل باشد.', - 'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی بزرگ است. عرض نمی‌تواند بزرگتر از {limit, number} پیکسل باشد.', - 'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی کوچک است. ارتفاع نمی‌تواند کوچکتر از {limit, number} پیکسل باشد.', - 'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی کوچک است. عرض نمی‌تواند کوچکتر از {limit, number} پیکسل باشد.', - 'The verification code is incorrect.' => 'کد تائید اشتباه است.', - 'Total {count, number} {count, plural, one{item} other{items}}.' => 'مجموع {count, number} مورد.', - 'Unable to verify your data submission.' => 'قادر به تائید اطلاعات ارسالی شما نمی‌باشد.', - 'Unknown command "{command}".' => 'فرمان ناشناخته "{command}".', - 'Unknown option: --{name}' => 'گزینه ناشناخته: --{name}', - 'Update' => 'بروزرسانی', - 'View' => 'نما', - 'Yes' => 'بله', - 'You are not allowed to perform this action.' => 'شما دسترسی به انجام این عملیات را ندارید.', - 'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => 'شما حداکثر {limit, number} فایل را می‌توانید آپلود کنید.', - '{attribute} "{value}" has already been taken.' => '{attribute} با مقدار "{value}" در حال حاضر گرفته‌شده است.', - '{attribute} cannot be blank.' => '{attribute} نمی‌تواند خالی باشد.', - '{attribute} is invalid.' => '{attribute} معتبر نیست.', - '{attribute} is not a valid URL.' => '{attribute} یک URL معتبر نیست.', - '{attribute} is not a valid email address.' => '{attribute} یک آدرس ایمیل معتبر نیست.', - '{attribute} must be "{requiredValue}".' => '{attribute} باید "{requiredValue}" باشد.', - '{attribute} must be a number.' => '{attribute} باید یک عدد باشد.', - '{attribute} must be a string.' => '{attribute} باید یک رشته باشد.', - '{attribute} must be an integer.' => '{attribute} باید یک عدد صحیح باشد.', - '{attribute} must be either "{true}" or "{false}".' => '{attribute} باید "{true}" و یا "{false}" باشد.', - '{attribute} must be greater than "{compareValue}".' => '{attribute} باید بزرگتر از "{compareValue}" باشد.', - '{attribute} must be greater than or equal to "{compareValue}".' => '{attribute} باید بزرگتر و یا مساوی "{compareValue}" باشد.', - '{attribute} must be less than "{compareValue}".' => '{attribute} باید کوچکتر از "{compareValue}" باشد.', - '{attribute} must be less than or equal to "{compareValue}".' => '{attribute} باید کوچکتر و یا مساوی "{compareValue}" باشد.', - '{attribute} must be no greater than {max}.' => '{attribute} نباید بیشتر از "{compareValue}" باشد.', - '{attribute} must be no less than {min}.' => '{attribute} نباید کمتر از "{compareValue}" باشد.', - '{attribute} must be repeated exactly.' => '{attribute} عیناً باید تکرار شود.', - '{attribute} must not be equal to "{compareValue}".' => '{attribute} نباید برابر با "{compareValue}" باشد.', - '{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 {length, number} {length, plural, one{character} other{characters}}.' => '{attribute} باید شامل {length, number} کارکتر باشد.', -); \ No newline at end of file +return [ + 'the input value' => 'مقدار ورودی', + '(not set)' => '(تنظیم نشده)', + 'An internal server error occurred.' => 'خطای داخلی سرور رخ داده است.', + 'Are you sure to delete this item?' => 'آیا اطمینان به حذف این مورد دارید؟', + 'Delete' => 'حذف', + 'Error' => 'خطا', + 'File upload failed.' => 'آپلود فایل شکست خورد.', + 'Home' => 'صفحه‌اصلی', + 'Invalid data received for parameter "{param}".' => 'برای پارامتر "{param}" اطلاعات نادرستی دریافت شده است.', + 'Login Required' => 'ورود اجباری', + 'Missing required arguments: {params}' => 'فاقد آرگومان‌های مورد نیاز: {params}', + 'Missing required parameters: {params}' => 'فاقد پارامترهای مورد نیاز: {params}', + 'No' => 'خیر', + 'No help for unknown command "{command}".' => 'فرمان ناشناخته بدون راهنما: "{command}".', + 'No help for unknown sub-command "{command}".' => 'زیرفرمان ناشناخته بدون راهنما: "{command}".', + 'No results found.' => 'نتیجه‌ای یافت نشد.', + 'Only files with these extensions are allowed: {extensions}.' => 'فقط فایل‌های با این پسوندها مجاز هستند: {extentions}.', + 'Only files with these mimeTypes are allowed: {mimeTypes}.' => 'فقط فایل‌های با این قوائد مجاز هستند: {extentions}.', + 'Page not found.' => 'صفحه‌ای یافت نشد.', + 'Please fix the following errors:' => 'لطفاً خطاهای زیر را رفع نمائید:', + 'Please upload a file.' => 'لطفاً یک فایل آپلود کنید.', + 'Showing {begin, number}-{end, number} of {totalCount, number} {totalCount, plural, one{item} other{items}}.' => 'نمایش {begin, number} تا {end, number} مورد از کل {totalCount, number} مورد.', + 'The file "{file}" is not an image.' => 'فایل "{file}" یک تصویر نیست.', + 'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'حجم فایل "{file}" بیش از حد زیاد است. مقدار آن نمی‌تواند بیشتر از {limit, number} بایت باشد.', + 'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'حجم فایل "{file}" بیش از حد کم است. مقدار آن نمی‌تواند کمتر از {limit, number} بایت باشد.', + 'The format of {attribute} is invalid.' => 'قالب {attribute} نامعتبر است.', + 'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی بزرگ است. ارتفاع نمی‌تواند بزرگتر از {limit, number} پیکسل باشد.', + 'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی بزرگ است. عرض نمی‌تواند بزرگتر از {limit, number} پیکسل باشد.', + 'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی کوچک است. ارتفاع نمی‌تواند کوچکتر از {limit, number} پیکسل باشد.', + 'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'تصویر "{file}" خیلی کوچک است. عرض نمی‌تواند کوچکتر از {limit, number} پیکسل باشد.', + 'The verification code is incorrect.' => 'کد تائید اشتباه است.', + 'Total {count, number} {count, plural, one{item} other{items}}.' => 'مجموع {count, number} مورد.', + 'Unable to verify your data submission.' => 'قادر به تائید اطلاعات ارسالی شما نمی‌باشد.', + 'Unknown command "{command}".' => 'فرمان ناشناخته "{command}".', + 'Unknown option: --{name}' => 'گزینه ناشناخته: --{name}', + 'Update' => 'بروزرسانی', + 'View' => 'نما', + 'Yes' => 'بله', + 'You are not allowed to perform this action.' => 'شما دسترسی به انجام این عملیات را ندارید.', + 'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => 'شما حداکثر {limit, number} فایل را می‌توانید آپلود کنید.', + '{attribute} "{value}" has already been taken.' => '{attribute} با مقدار "{value}" در حال حاضر گرفته‌شده است.', + '{attribute} cannot be blank.' => '{attribute} نمی‌تواند خالی باشد.', + '{attribute} is invalid.' => '{attribute} معتبر نیست.', + '{attribute} is not a valid URL.' => '{attribute} یک URL معتبر نیست.', + '{attribute} is not a valid email address.' => '{attribute} یک آدرس ایمیل معتبر نیست.', + '{attribute} must be "{requiredValue}".' => '{attribute} باید "{requiredValue}" باشد.', + '{attribute} must be a number.' => '{attribute} باید یک عدد باشد.', + '{attribute} must be a string.' => '{attribute} باید یک رشته باشد.', + '{attribute} must be an integer.' => '{attribute} باید یک عدد صحیح باشد.', + '{attribute} must be either "{true}" or "{false}".' => '{attribute} باید "{true}" و یا "{false}" باشد.', + '{attribute} must be greater than "{compareValue}".' => '{attribute} باید بزرگتر از "{compareValue}" باشد.', + '{attribute} must be greater than or equal to "{compareValue}".' => '{attribute} باید بزرگتر و یا مساوی "{compareValue}" باشد.', + '{attribute} must be less than "{compareValue}".' => '{attribute} باید کوچکتر از "{compareValue}" باشد.', + '{attribute} must be less than or equal to "{compareValue}".' => '{attribute} باید کوچکتر و یا مساوی "{compareValue}" باشد.', + '{attribute} must be no greater than {max}.' => '{attribute} نباید بیشتر از "{compareValue}" باشد.', + '{attribute} must be no less than {min}.' => '{attribute} نباید کمتر از "{compareValue}" باشد.', + '{attribute} must be repeated exactly.' => '{attribute} عیناً باید تکرار شود.', + '{attribute} must not be equal to "{compareValue}".' => '{attribute} نباید برابر با "{compareValue}" باشد.', + '{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 {length, number} {length, plural, one{character} other{characters}}.' => '{attribute} باید شامل {length, number} کارکتر باشد.', +]; \ No newline at end of file diff --git a/tests/unit/data/ar/elasticsearch/CustomerQuery.php b/tests/unit/data/ar/elasticsearch/CustomerQuery.php index 5df080f0b1..108466fee4 100644 --- a/tests/unit/data/ar/elasticsearch/CustomerQuery.php +++ b/tests/unit/data/ar/elasticsearch/CustomerQuery.php @@ -9,7 +9,7 @@ class CustomerQuery extends ActiveQuery { public function active() { - $this->andWhere(array('status' => 1)); + $this->andWhere(['status' => 1]); return $this; } } diff --git a/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php b/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php index 974bf3e503..c74ad4b85b 100644 --- a/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php +++ b/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php @@ -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(); diff --git a/tests/unit/framework/helpers/FileHelperTest.php b/tests/unit/framework/helpers/FileHelperTest.php index 1b2a83336d..d076631208 100644 --- a/tests/unit/framework/helpers/FileHelperTest.php +++ b/tests/unit/framework/helpers/FileHelperTest.php @@ -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;