Skip to content

Commit 0021a79

Browse files
author
igor-chepurnoi
committed
fix code style
1 parent 3219ffd commit 0021a79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+272
-174
lines changed

.php_cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
$finder = Symfony\CS\Finder::create()
4+
->exclude('vendor')
5+
->in([__DIR__]);
6+
7+
$config = Symfony\CS\Config::create()
8+
->fixers([
9+
'-phpdoc_params',
10+
'-phpdoc_short_description',
11+
'-phpdoc_inline_tag',
12+
'-pre_increment',
13+
'-heredoc_to_nowdoc',
14+
'-spaces_cast',
15+
'-include',
16+
'-phpdoc_no_package',
17+
'concat_with_spaces',
18+
'ordered_use',
19+
])
20+
->finder($finder);
21+
22+
return $config;

.travis.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ php:
55
- 5.5
66
- 5.6
77
- 7.0
8-
- hhvm
9-
10-
# run build against hhvm but allow them to fail
11-
# http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail
12-
matrix:
13-
fast_finish: true
14-
allow_failures:
15-
- php: hhvm
168

179
# faster builds on new travis setup not using sudo
1810
sudo: false
@@ -21,6 +13,7 @@ sudo: false
2113
cache:
2214
directories:
2315
- $HOME/.composer/cache
16+
- vendor
2417

2518
install:
2619
- travis_retry composer self-update && composer --version
@@ -29,4 +22,5 @@ install:
2922
- travis_retry composer install --prefer-dist --no-interaction
3023

3124
script:
32-
- phpunit --verbose $PHPUNIT_FLAGS
25+
- vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run --diff
26+
- phpunit --verbose $PHPUNIT_FLAGS

ConsoleModule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class ConsoleModule extends Module
2222
{
2323
/**
24-
* @var string the namespace that controller classes are in.
24+
* @var string the namespace that controller classes are in
2525
*/
2626
public $controllerNamespace = 'yii2mod\rbac\commands';
27-
}
27+
}

Module.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@
2323
* ]
2424
* ],
2525
* ~~~
26-
*
2726
*/
2827
class Module extends \yii\base\Module
2928
{
3029
/**
31-
* @var string the default route of this module. Defaults to 'default'.
30+
* @var string the default route of this module. Defaults to 'default'
3231
*/
3332
public $defaultRoute = 'assignment';
3433

3534
/**
36-
* @var string the namespace that controller classes are in.
35+
* @var string the namespace that controller classes are in
3736
*/
3837
public $controllerNamespace = 'yii2mod\rbac\controllers';
39-
}
38+
}

RbacAsset.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* Class RbacAsset
9+
*
910
* @package yii2mod\rbac
1011
*/
1112
class RbacAsset extends AssetBundle
@@ -19,7 +20,7 @@ class RbacAsset extends AssetBundle
1920
* @var array
2021
*/
2122
public $js = [
22-
'js/rbac.js'
23+
'js/rbac.js',
2324
];
2425

2526
public $css = [
@@ -30,7 +31,7 @@ class RbacAsset extends AssetBundle
3031
* @var array
3132
*/
3233
public $depends = [
33-
'yii\web\YiiAsset'
34+
'yii\web\YiiAsset',
3435
];
3536

3637
/**
@@ -45,9 +46,9 @@ public function init()
4546
{
4647
if ($this->registerOnlyRouteScript) {
4748
$this->js = [
48-
'js/rbac-route.js'
49+
'js/rbac-route.js',
4950
];
5051
}
5152
parent::init();
5253
}
53-
}
54+
}

base/ItemController.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313

1414
/**
1515
* Class ItemController
16+
*
1617
* @package yii2mod\rbac\base
1718
*/
1819
class ItemController extends Controller
1920
{
2021
/**
21-
* @var integer Type of Auth Item
22+
* @var int Type of Auth Item
2223
*/
2324
protected $type;
2425

@@ -42,16 +43,16 @@ public function behaviors()
4243
'update' => ['get', 'post'],
4344
'delete' => ['post'],
4445
'assign' => ['post'],
45-
'remove' => ['post']
46-
]
46+
'remove' => ['post'],
47+
],
4748
],
4849
'contentNegotiator' => [
4950
'class' => 'yii\filters\ContentNegotiator',
5051
'only' => ['assign', 'remove'],
5152
'formats' => [
52-
'application/json' => Response::FORMAT_JSON
53-
]
54-
]
53+
'application/json' => Response::FORMAT_JSON,
54+
],
55+
],
5556
];
5657
}
5758

@@ -75,6 +76,7 @@ public function actionIndex()
7576
* Displays a single AuthItem model.
7677
*
7778
* @param string $id
79+
*
7880
* @return mixed
7981
*/
8082
public function actionView($id)
@@ -93,11 +95,12 @@ public function actionView($id)
9395
*/
9496
public function actionCreate()
9597
{
96-
$model = new AuthItemModel;
98+
$model = new AuthItemModel();
9799
$model->type = $this->type;
98100

99101
if ($model->load(Yii::$app->request->post()) && $model->save()) {
100102
Yii::$app->session->setFlash('success', Yii::t('yii2mod.rbac', 'Item has been saved.'));
103+
101104
return $this->redirect(['view', 'id' => $model->name]);
102105
}
103106

@@ -110,6 +113,7 @@ public function actionCreate()
110113
* If update is successful, the browser will be redirected to the 'view' page.
111114
*
112115
* @param string $id
116+
*
113117
* @return mixed
114118
*/
115119
public function actionUpdate($id)
@@ -118,6 +122,7 @@ public function actionUpdate($id)
118122

119123
if ($model->load(Yii::$app->request->post()) && $model->save()) {
120124
Yii::$app->session->setFlash('success', Yii::t('yii2mod.rbac', 'Item has been saved.'));
125+
121126
return $this->redirect(['view', 'id' => $model->name]);
122127
}
123128

@@ -130,6 +135,7 @@ public function actionUpdate($id)
130135
* If deletion is successful, the browser will be redirected to the 'index' page.
131136
*
132137
* @param string $id
138+
*
133139
* @return mixed
134140
*/
135141
public function actionDelete($id)
@@ -145,6 +151,7 @@ public function actionDelete($id)
145151
* Assign items
146152
*
147153
* @param string $id
154+
*
148155
* @return array
149156
*/
150157
public function actionAssign($id)
@@ -160,6 +167,7 @@ public function actionAssign($id)
160167
* Remove items
161168
*
162169
* @param string $id
170+
*
163171
* @return array
164172
*/
165173
public function actionRemove($id)
@@ -201,6 +209,7 @@ public function getLabels()
201209
* If the model is not found, a 404 HTTP exception will be thrown.
202210
*
203211
* @param string $id
212+
*
204213
* @return AuthItemModel the loaded model
205214
*
206215
* @throws NotFoundHttpException if the model cannot be found
@@ -216,4 +225,4 @@ protected function findModel($id)
216225
throw new NotFoundHttpException(Yii::t('yii2mod.rbac', 'The requested page does not exist.'));
217226
}
218227
}
219-
}
228+
}

commands/MigrateController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* Class MigrateController
13+
*
1314
* @package yii2mod\rbac\commands
1415
*
1516
* Below are some common usages of this command:
@@ -28,7 +29,7 @@
2829
class MigrateController extends BaseMigrateController
2930
{
3031
/**
31-
* @var Connection The database connection.
32+
* @var Connection The database connection
3233
*/
3334
public $db = 'db';
3435

@@ -128,4 +129,4 @@ protected function createMigrationHistoryTable()
128129

129130
$this->stdout("Done.\n", Console::FG_GREEN);
130131
}
131-
}
132+
}

composer.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
{
22
"name": "yii2mod/yii2-rbac",
33
"description": "RBAC management module for Yii2",
4-
"keywords": ["yii2", "yii2-rbac", "rbac management", "yii2mod", "rbac gui", "yii rbac", "rbac module"],
4+
"keywords": [
5+
"yii2",
6+
"yii2-rbac",
7+
"rbac management",
8+
"yii2mod",
9+
"rbac gui",
10+
"yii rbac",
11+
"rbac module"
12+
],
513
"type": "yii2-extension",
614
"license": "MIT",
715
"authors": [
@@ -19,6 +27,9 @@
1927
"2amigos/yii2-arrayquery-component": "*",
2028
"yiisoft/yii2-jui": "*"
2129
},
30+
"require-dev": {
31+
"friendsofphp/php-cs-fixer": "~1.7"
32+
},
2233
"autoload": {
2334
"psr-4": {
2435
"yii2mod\\rbac\\": ""

0 commit comments

Comments
 (0)