diff --git a/cs/src/YiiConfig.php b/cs/src/YiiConfig.php index 0ff0ebf..f377d0b 100644 --- a/cs/src/YiiConfig.php +++ b/cs/src/YiiConfig.php @@ -140,7 +140,7 @@ class YiiConfig extends Config // 'phpdoc_summary' => true, // needs more attention (summary should be separated by blank line from description) // 'phpdoc_to_comment' => true, // breaks phpdoc for define('CONSTANT', $value); 'phpdoc_trim' => true, -// 'phpdoc_types' => true, // conflicts with yii\base\Object typehits https://github.com/yiisoft/yii2/pull/12699 + 'phpdoc_types' => true, 'phpdoc_var_without_name' => true, 'protected_to_private' => true, 'psr4' => true, diff --git a/framework/behaviors/AttributesBehavior.php b/framework/behaviors/AttributesBehavior.php index b17e118..78aa7d2 100644 --- a/framework/behaviors/AttributesBehavior.php +++ b/framework/behaviors/AttributesBehavior.php @@ -151,8 +151,8 @@ class AttributesBehavior extends Behavior })); if (!empty($this->order[$event->name])) { $attributes = array_merge( - array_intersect((array)$this->order[$event->name], $attributes), - array_diff($attributes, (array)$this->order[$event->name])); + array_intersect((array) $this->order[$event->name], $attributes), + array_diff($attributes, (array) $this->order[$event->name])); } foreach ($attributes as $attribute) { if ($this->preserveNonEmptyValues && !empty($this->owner->$attribute)) { diff --git a/framework/filters/AjaxFilter.php b/framework/filters/AjaxFilter.php index c6c71b8..f974023 100644 --- a/framework/filters/AjaxFilter.php +++ b/framework/filters/AjaxFilter.php @@ -62,4 +62,4 @@ class AjaxFilter extends ActionFilter throw new BadRequestHttpException($this->errorMessage); } -} \ No newline at end of file +} diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index 12d3dc7..e764f4c 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -1402,8 +1402,8 @@ class Formatter extends Component /** * Formats the value as a length in human readable form for example `12 meters`. * - * @param double|int $value value to be formatted. - * @param double $baseUnit unit of value as the multiplier of the smallest unit. + * @param float|int $value value to be formatted. + * @param float $baseUnit unit of value as the multiplier of the smallest unit. * @param string $unitSystem either [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. When `null`, property [[systemOfUnits]] will be used. * @param int $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. @@ -1425,8 +1425,8 @@ class Formatter extends Component * * This is the short form of [[asLength]]. * - * @param double|int $value value to be formatted. - * @param double $baseUnit unit of value as the multiplier of the smallest unit + * @param float|int $value value to be formatted. + * @param float $baseUnit unit of value as the multiplier of the smallest unit * @param string $unitSystem either [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. When `null`, property [[systemOfUnits]] will be used. * @param int $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. @@ -1446,8 +1446,8 @@ class Formatter extends Component /** * Formats the value as a weight in human readable form for example `12 kilograms`. * - * @param double|int $value value to be formatted. - * @param double $baseUnit unit of value as the multiplier of the smallest unit + * @param float|int $value value to be formatted. + * @param float $baseUnit unit of value as the multiplier of the smallest unit * @param string $unitSystem either [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. When `null`, property [[systemOfUnits]] will be used. * @param int $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. @@ -1468,8 +1468,8 @@ class Formatter extends Component * * This is the short form of [[asWeight]]. * - * @param double|int $value value to be formatted. - * @param double $baseUnit unit of value as the multiplier of the smallest unit + * @param float|int $value value to be formatted. + * @param float $baseUnit unit of value as the multiplier of the smallest unit * @param string $unitSystem either [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. When `null`, property [[systemOfUnits]] will be used. * @param int $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. @@ -1488,8 +1488,8 @@ class Formatter extends Component /** * @param string $unitType one of [[UNIT_WEIGHT]], [[UNIT_LENGTH]] * @param string $unitFormat one of [[FORMAT_WIDTH_SHORT]], [[FORMAT_WIDTH_LONG]] - * @param double|int $value to be formatted - * @param double $baseUnit unit of value as the multiplier of the smallest unit + * @param float|int $value to be formatted + * @param float $baseUnit unit of value as the multiplier of the smallest unit * @param string $unitSystem either [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. When `null`, property [[systemOfUnits]] will be used. * @param int $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. @@ -1560,7 +1560,7 @@ class Formatter extends Component } $message[] = "$key{{$value}}"; } - return $this->_unitMessages[$unitType][$system][$position] = '{n, plural, '.implode(' ', $message).'}'; + return $this->_unitMessages[$unitType][$system][$position] = '{n, plural, ' . implode(' ', $message) . '}'; } /** diff --git a/framework/web/Request.php b/framework/web/Request.php index 1c7f77f..68bee61 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -224,7 +224,7 @@ class Request extends \yii\base\Request * @since 2.0.13 */ public $ipHeaders = [ - 'X-Forwarded-For' + 'X-Forwarded-For', ]; /** * @var array list of headers to check for determining whether the connection is made via HTTPS. @@ -1255,10 +1255,10 @@ class Request extends \yii\base\Request { if (isset($_SERVER['CONTENT_TYPE'])) { return $_SERVER['CONTENT_TYPE']; - } else { - //fix bug https://bugs.php.net/bug.php?id=66606 - return $this->headers->get('Content-Type'); } + + //fix bug https://bugs.php.net/bug.php?id=66606 + return $this->headers->get('Content-Type'); } private $_languages; diff --git a/tests/compatibility.php b/tests/compatibility.php index 7c9e259..9f881f3 100644 --- a/tests/compatibility.php +++ b/tests/compatibility.php @@ -19,7 +19,6 @@ namespace PHPUnit\Framework\Constraint { namespace PHPUnit\Framework { if (!class_exists('PHPUnit\Framework\TestCase') && class_exists('PHPUnit_Framework_TestCase')) { - echo "Applying compatibility patch for PHPUnit 6...\n"; abstract class TestCase extends \PHPUnit_Framework_TestCase diff --git a/tests/data/rbac/UserID.php b/tests/data/rbac/UserID.php index 88c21b9..e87cd01 100644 --- a/tests/data/rbac/UserID.php +++ b/tests/data/rbac/UserID.php @@ -20,4 +20,4 @@ class UserID { return (string) $this->id; } -} \ No newline at end of file +} diff --git a/tests/data/validators/models/ValidatorTestFunctionModel.php b/tests/data/validators/models/ValidatorTestFunctionModel.php index 10be83c..57463be 100644 --- a/tests/data/validators/models/ValidatorTestFunctionModel.php +++ b/tests/data/validators/models/ValidatorTestFunctionModel.php @@ -17,4 +17,4 @@ class ValidatorTestFunctionModel extends Model { return true; } -} \ No newline at end of file +} diff --git a/tests/framework/base/ApplicationTest.php b/tests/framework/base/ApplicationTest.php index 33f58fd..4ef59bc 100644 --- a/tests/framework/base/ApplicationTest.php +++ b/tests/framework/base/ApplicationTest.php @@ -41,24 +41,23 @@ class ApplicationTest extends TestCase $this->mockApplication([ 'components' => [ 'withoutBootstrapInterface' => [ - 'class' => Component::className() + 'class' => Component::className(), ], 'withBootstrapInterface' => [ - 'class' => BootstrapComponentMock::className() - ] + 'class' => BootstrapComponentMock::className(), + ], ], 'modules' => [ 'moduleX' => [ - 'class' => Module::className() - ] + 'class' => Module::className(), + ], ], 'bootstrap' => [ 'withoutBootstrapInterface', 'withBootstrapInterface', 'moduleX', function () { - } - + }, ], ]); $this->assertSame('Bootstrap with yii\base\Component', Yii::getLogger()->messages[0][0]); @@ -78,4 +77,4 @@ class BootstrapComponentMock extends Component implements BootstrapInterface public function bootstrap($app) { } -} \ No newline at end of file +} diff --git a/tests/framework/base/BCObject.php b/tests/framework/base/BCObject.php index 7f916a7..95343e1 100644 --- a/tests/framework/base/BCObject.php +++ b/tests/framework/base/BCObject.php @@ -1,8 +1,12 @@ attributesBehavior->preserveNonEmptyValues = $preserveNonEmptyValues; $model->name = $name; @@ -143,8 +142,7 @@ class AttributesBehaviorTest extends TestCase $order, $name, $alias - ) - { + ) { $model = new ActiveRecordWithAttributesBehavior(); $model->attributesBehavior->order = $order; $model->name = $name; diff --git a/tests/framework/db/ActiveRecordTest.php b/tests/framework/db/ActiveRecordTest.php index 349d223..a3f8aa2 100644 --- a/tests/framework/db/ActiveRecordTest.php +++ b/tests/framework/db/ActiveRecordTest.php @@ -1526,8 +1526,7 @@ abstract class ActiveRecordTest extends DatabaseTestCase */ public function testAmbiguousColumnIndexBy() { - switch ($this->driverName) - { + switch ($this->driverName) { case 'pgsql': case 'sqlite': $selectExpression = "(customer.name || ' in ' || p.description) AS name"; diff --git a/tests/framework/db/CommandTest.php b/tests/framework/db/CommandTest.php index 107c017..85a90ec 100644 --- a/tests/framework/db/CommandTest.php +++ b/tests/framework/db/CommandTest.php @@ -343,7 +343,7 @@ SQL; // batch insert on "type" table $db->createCommand()->batchInsert('type', $cols, $data)->execute(); - $data = $db->createCommand("SELECT int_col, char_col, float_col, bool_col FROM {{type}} WHERE [[int_col]] IN (1,2,3) ORDER BY [[int_col]];")->queryAll(); + $data = $db->createCommand('SELECT int_col, char_col, float_col, bool_col FROM {{type}} WHERE [[int_col]] IN (1,2,3) ORDER BY [[int_col]];')->queryAll(); $this->assertEquals(3, count($data)); $this->assertEquals(1, $data[0]['int_col']); $this->assertEquals(2, $data[1]['int_col']); @@ -357,7 +357,6 @@ SQL; $this->assertEquals('1', $data[0]['bool_col']); $this->assertIsOneOf($data[1]['bool_col'], ['0', false]); $this->assertIsOneOf($data[2]['bool_col'], ['0', false]); - } catch (\Exception $e) { setlocale(LC_NUMERIC, $locale); throw $e; diff --git a/tests/framework/db/ConnectionTest.php b/tests/framework/db/ConnectionTest.php index c930cb3..8376d8c 100644 --- a/tests/framework/db/ConnectionTest.php +++ b/tests/framework/db/ConnectionTest.php @@ -412,6 +412,6 @@ abstract class ConnectionTest extends DatabaseTestCase $slavePdo = $connection->getSlavePdo(false); $this->assertNotFalse($slavePdo); $this->assertNotNull($slavePdo); - $this->assertNotSame($masterPdo,$slavePdo); + $this->assertNotSame($masterPdo, $slavePdo); } } diff --git a/tests/framework/db/GetTablesAliasTestTrait.php b/tests/framework/db/GetTablesAliasTestTrait.php index 0d431cb..ece065f 100644 --- a/tests/framework/db/GetTablesAliasTestTrait.php +++ b/tests/framework/db/GetTablesAliasTestTrait.php @@ -1,4 +1,9 @@ driverName) - { + switch ($this->driverName) { case 'pgsql': case 'sqlite': $selectExpression = "(customer.name || ' in ' || p.description) AS name"; @@ -357,7 +356,7 @@ abstract class QueryTest extends DatabaseTestCase } $db = $this->getConnection(); - $result = (new Query)->select([$selectExpression])->from('customer') + $result = (new Query())->select([$selectExpression])->from('customer') ->innerJoin('profile p', '{{customer}}.[[profile_id]] = {{p}}.[[id]]') ->indexBy('id')->column($db); $this->assertEquals([ diff --git a/tests/framework/filters/AjaxFilterTest.php b/tests/framework/filters/AjaxFilterTest.php index 60ae092..e34335c 100644 --- a/tests/framework/filters/AjaxFilterTest.php +++ b/tests/framework/filters/AjaxFilterTest.php @@ -20,7 +20,7 @@ use yiiunit\TestCase; class AjaxFilterTest extends TestCase { /** - * @param boolean $isAjax + * @param bool $isAjax * @return Request */ protected function mockRequest($isAjax) @@ -48,4 +48,4 @@ class AjaxFilterTest extends TestCase $this->expectException('yii\web\BadRequestHttpException'); $filter->beforeAction($action); } -} \ No newline at end of file +} diff --git a/tests/framework/helpers/ArrayHelperTest.php b/tests/framework/helpers/ArrayHelperTest.php index 32b26f8..6093436 100644 --- a/tests/framework/helpers/ArrayHelperTest.php +++ b/tests/framework/helpers/ArrayHelperTest.php @@ -32,7 +32,7 @@ class Post2 extends BaseObject class Post3 extends BaseObject { public $id = 33; - /** @var Object */ + /** @var BaseObject */ public $subObject; public function init() @@ -493,7 +493,7 @@ class ArrayHelperTest extends TestCase ]; $b = [ 'secondValue', - 'thirdValue' + 'thirdValue', ]; $result = ArrayHelper::merge($a, $b); @@ -870,7 +870,7 @@ class ArrayHelperTest extends TestCase [ 'key' => [ 'val1', - 'in' => 'val' + 'in' => 'val', ], ], ], @@ -892,7 +892,7 @@ class ArrayHelperTest extends TestCase [ 'key1' => 'val1', 'key' => [ - 'in' => ['val'] + 'in' => ['val'], ], ], ], @@ -906,8 +906,8 @@ class ArrayHelperTest extends TestCase 'key1' => 'val1', 'key' => [ 'in' => [ - 'arr' => 'val' - ] + 'arr' => 'val', + ], ], ], ], @@ -920,15 +920,15 @@ class ArrayHelperTest extends TestCase 'key1' => 'val1', 'key' => [ 'in' => [ - 'arr' => ['val'] - ] + 'arr' => ['val'], + ], ], ], ], [ [ 'key' => [ - 'in' => ['val1'] + 'in' => ['val1'], ], ], 'key.in.arr', 'val', @@ -936,8 +936,8 @@ class ArrayHelperTest extends TestCase 'key' => [ 'in' => [ 'val1', - 'arr' => 'val' - ] + 'arr' => 'val', + ], ], ], ], @@ -951,8 +951,8 @@ class ArrayHelperTest extends TestCase 'key' => [ 'in' => [ 'val1', - 'arr' => ['val'] - ] + 'arr' => ['val'], + ], ], ], ], @@ -961,8 +961,8 @@ class ArrayHelperTest extends TestCase 'key' => [ 'in' => [ 'val1', - 'key' => 'val' - ] + 'key' => 'val', + ], ], ], 'key.in.0', ['arr' => 'val'], @@ -970,8 +970,8 @@ class ArrayHelperTest extends TestCase 'key' => [ 'in' => [ ['arr' => 'val'], - 'key' => 'val' - ] + 'key' => 'val', + ], ], ], ], @@ -980,14 +980,14 @@ class ArrayHelperTest extends TestCase 'key' => [ 'in' => [ 'val1', - 'key' => 'val' - ] + 'key' => 'val', + ], ], ], 'key.in', ['arr' => 'val'], [ 'key' => [ - 'in' => ['arr' => 'val'] + 'in' => ['arr' => 'val'], ], ], ], @@ -1000,8 +1000,8 @@ class ArrayHelperTest extends TestCase 'attr1', 'attr2', 'attr3', - ] - ] + ], + ], ], ], 'key.in.schema', 'array', @@ -1014,8 +1014,8 @@ class ArrayHelperTest extends TestCase 'attr1', 'attr2', 'attr3', - ] - ] + ], + ], ], ], ], @@ -1024,7 +1024,7 @@ class ArrayHelperTest extends TestCase 'key' => [ 'in.array' => [ 'key' => 'val', - ] + ], ], ], ['key', 'in.array', 'ok.schema'], 'array', @@ -1033,7 +1033,7 @@ class ArrayHelperTest extends TestCase 'in.array' => [ 'key' => 'val', 'ok.schema' => 'array', - ] + ], ], ], ], diff --git a/tests/framework/i18n/FormatterTest.php b/tests/framework/i18n/FormatterTest.php index 7b29660..0d186cf 100644 --- a/tests/framework/i18n/FormatterTest.php +++ b/tests/framework/i18n/FormatterTest.php @@ -230,15 +230,15 @@ class FormatterTest extends TestCase public function lengthDataProvider() { return [ - [-3, "-3 meters", '-3 m'], + [-3, '-3 meters', '-3 m'], ['NaN', '0 millimeters', '0 mm'], - [0, "0 millimeters", '0 mm'], - [0.005, "5 millimeters", '5 mm'], - [0.053, "5.3 centimeters", '5.3 cm'], - [0.1, "10 centimeters", '10 cm'], - [1.123, "1.123 meters", '1.123 m'], - [1893.12, "1.893 kilometers", '1.893 km'], - [4561549, "4561.549 kilometers", '4561.549 km'], + [0, '0 millimeters', '0 mm'], + [0.005, '5 millimeters', '5 mm'], + [0.053, '5.3 centimeters', '5.3 cm'], + [0.1, '10 centimeters', '10 cm'], + [1.123, '1.123 meters', '1.123 m'], + [1893.12, '1.893 kilometers', '1.893 km'], + [4561549, '4561.549 kilometers', '4561.549 km'], ]; } diff --git a/tests/framework/rbac/DbManagerTestCase.php b/tests/framework/rbac/DbManagerTestCase.php index c4245d9..212dbf9 100644 --- a/tests/framework/rbac/DbManagerTestCase.php +++ b/tests/framework/rbac/DbManagerTestCase.php @@ -161,7 +161,7 @@ abstract class DbManagerTestCase extends ManagerTestCase return [ [0, 0, true], [0, new UserID(0), true], - ['', '', false] + ['', '', false], ]; } diff --git a/tests/framework/rbac/ManagerTestCase.php b/tests/framework/rbac/ManagerTestCase.php index 98af546..f2e60ae 100644 --- a/tests/framework/rbac/ManagerTestCase.php +++ b/tests/framework/rbac/ManagerTestCase.php @@ -458,7 +458,7 @@ abstract class ManagerTestCase extends TestCase { return [ [Item::TYPE_ROLE], - [Item::TYPE_PERMISSION] + [Item::TYPE_PERMISSION], ]; } diff --git a/tests/framework/web/RequestTest.php b/tests/framework/web/RequestTest.php index 55c22af..07d74fa 100644 --- a/tests/framework/web/RequestTest.php +++ b/tests/framework/web/RequestTest.php @@ -307,7 +307,8 @@ class RequestTest extends TestCase $this->assertEquals(null, $request->getServerPort()); } - public function isSecureServerDataProvider() { + public function isSecureServerDataProvider() + { return [ [['HTTPS' => 1], true], [['HTTPS' => 'on'], true], @@ -318,38 +319,38 @@ class RequestTest extends TestCase [['HTTP_X_FORWARDED_PROTO' => 'http'], false], [[ 'HTTP_X_FORWARDED_PROTO' => 'https', - 'REMOTE_HOST' => 'test.com' + 'REMOTE_HOST' => 'test.com', ], true], [[ 'HTTP_X_FORWARDED_PROTO' => 'https', - 'REMOTE_HOST' => 'othertest.com' + 'REMOTE_HOST' => 'othertest.com', ], false], [[ 'HTTP_X_FORWARDED_PROTO' => 'https', - 'REMOTE_ADDR' => '192.168.0.1' + 'REMOTE_ADDR' => '192.168.0.1', ], true], [[ 'HTTP_X_FORWARDED_PROTO' => 'https', - 'REMOTE_ADDR' => '192.169.0.1' + 'REMOTE_ADDR' => '192.169.0.1', ], false], [['HTTP_FRONT_END_HTTPS' => 'on'], false], [['HTTP_FRONT_END_HTTPS' => 'off'], false], [[ 'HTTP_FRONT_END_HTTPS' => 'on', - 'REMOTE_HOST' => 'test.com' + 'REMOTE_HOST' => 'test.com', ], true], [[ 'HTTP_FRONT_END_HTTPS' => 'on', - 'REMOTE_HOST' => 'othertest.com' + 'REMOTE_HOST' => 'othertest.com', ], false], [[ 'HTTP_FRONT_END_HTTPS' => 'on', - 'REMOTE_ADDR' => '192.168.0.1' + 'REMOTE_ADDR' => '192.168.0.1', ], true], [[ 'HTTP_FRONT_END_HTTPS' => 'on', - 'REMOTE_ADDR' => '192.169.0.1' - ], false] + 'REMOTE_ADDR' => '192.169.0.1', + ], false], ]; } @@ -362,8 +363,8 @@ class RequestTest extends TestCase $request = new Request([ 'trustedHosts' => [ '/^test.com$/', - '/^192\.168/' - ] + '/^192\.168/', + ], ]); $_SERVER = $server; @@ -371,41 +372,43 @@ class RequestTest extends TestCase $_SERVER = $original; } - public function getUserIPDataProvider() { + public function getUserIPDataProvider() + { return [ [ [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_FOR' => '123.123.123.123', - 'REMOTE_ADDR' => '192.168.0.1' + 'REMOTE_ADDR' => '192.168.0.1', ], - '123.123.123.123' - ], [ + '123.123.123.123', + ], + [ [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_FOR' => '123.123.123.123', - 'REMOTE_ADDR' => '192.169.1.1' + 'REMOTE_ADDR' => '192.169.1.1', ], - '192.169.1.1' - ], [ + '192.169.1.1', + ], + [ [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_FOR' => '123.123.123.123', 'REMOTE_HOST' => 'trusted.com', - 'REMOTE_ADDR' => '192.169.1.1' - + 'REMOTE_ADDR' => '192.169.1.1', ], - '123.123.123.123' - ], [ + '123.123.123.123', + ], + [ [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_FOR' => '192.169.1.1', 'REMOTE_HOST' => 'untrusted.com', - 'REMOTE_ADDR' => '192.169.1.1' - + 'REMOTE_ADDR' => '192.169.1.1', ], - '192.169.1.1' - ] + '192.169.1.1', + ], ]; } @@ -419,30 +422,30 @@ class RequestTest extends TestCase $request = new Request([ 'trustedHosts' => [ '/^192\.168/', - '/^trusted.com$/' + '/^trusted.com$/', ], - ]); $this->assertEquals($expected, $request->getUserIP()); $_SERVER = $original; - } - public function getMethodDataProvider() { + public function getMethodDataProvider() + { return [ [ [ 'REQUEST_METHOD' => 'DEFAULT', - 'HTTP_X-HTTP-METHOD-OVERRIDE' => 'OVERRIDE' + 'HTTP_X-HTTP-METHOD-OVERRIDE' => 'OVERRIDE', ], - 'OVERRIDE' - ], [ + 'OVERRIDE', + ], + [ [ 'REQUEST_METHOD' => 'DEFAULT', ], - 'DEFAULT' - ] + 'DEFAULT', + ], ]; } @@ -459,19 +462,20 @@ class RequestTest extends TestCase $_SERVER = $original; } - public function getIsAjaxDataProvider() { + public function getIsAjaxDataProvider() + { return [ [ [ - ], - false - ], [ + false, + ], + [ [ 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest', ], - true - ] + true, + ], ]; } @@ -488,20 +492,21 @@ class RequestTest extends TestCase $_SERVER = $original; } - public function getIsPjaxDataProvider() { + public function getIsPjaxDataProvider() + { return [ [ [ - ], - false - ], [ + false, + ], + [ [ 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest', 'HTTP_X_PJAX' => 'any value', ], - true - ] + true, + ], ]; } diff --git a/tests/framework/web/UrlManagerCreateUrlTest.php b/tests/framework/web/UrlManagerCreateUrlTest.php index 6db2283..53cb90e 100644 --- a/tests/framework/web/UrlManagerCreateUrlTest.php +++ b/tests/framework/web/UrlManagerCreateUrlTest.php @@ -767,24 +767,24 @@ class UrlManagerCreateUrlTest extends TestCase { $this->mockWebApplication([ 'components' => [ - 'cache' => ArrayCache::className() - ] + 'cache' => ArrayCache::className(), + ], ]); $urlManager = $this->getUrlManager([ 'cache' => 'cache', 'rules' => [ - '/' => 'site/index' - ] + '/' => 'site/index', + ], ]); $cachedUrlManager = $this->getUrlManager([ 'cache' => 'cache', 'ruleConfig' => [ - 'class' => CachedUrlRule::className() + 'class' => CachedUrlRule::className(), ], 'rules' => [ - '/' => 'site/index' - ] + '/' => 'site/index', + ], ]); $this->assertNotEquals($urlManager->rules, $cachedUrlManager->rules); diff --git a/tests/framework/widgets/LinkPagerTest.php b/tests/framework/widgets/LinkPagerTest.php index 7a59c3e..9e25530 100644 --- a/tests/framework/widgets/LinkPagerTest.php +++ b/tests/framework/widgets/LinkPagerTest.php @@ -111,14 +111,14 @@ class LinkPagerTest extends \yiiunit\TestCase static::assertContains('
  • 6
  • ', $output); } - + public function testOptionsWithTagOption() { $output = LinkPager::widget([ 'pagination' => $this->getPagination(5), 'options' => [ 'tag' => 'div', - ] + ], ]); $this->assertTrue(StringHelper::startsWith($output, '
    ')); @@ -131,8 +131,8 @@ class LinkPagerTest extends \yiiunit\TestCase 'pagination' => $this->getPagination(1), 'linkContainerOptions' => [ 'tag' => 'div', - 'class' => 'my-class' - ] + 'class' => 'my-class', + ], ]); $this->assertContains( diff --git a/tests/framework/widgets/ListViewTest.php b/tests/framework/widgets/ListViewTest.php index da0b5ee..92f308d 100644 --- a/tests/framework/widgets/ListViewTest.php +++ b/tests/framework/widgets/ListViewTest.php @@ -244,7 +244,7 @@ HTML , $out ); } - + /** * @see https://github.com/yiisoft/yii2/pull/14596 */