Skip to content

Commit 645500d

Browse files
authored
Merge pull request #24 from humhub-contrib/enh/php-cs-fixer
Use PHP CS Fixer
2 parents 59499a9 + 2e862ab commit 645500d

11 files changed

+33
-38
lines changed

.github/workflows/php-cs-fixer.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: PHP CS Fixer
2+
3+
on: push
4+
5+
jobs:
6+
fixers:
7+
uses: humhub/actions/.github/workflows/module-php-cs-fixer.yml@main

Assets.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212

1313
class Assets extends AssetBundle
1414
{
15-
1615
public $publishOptions = [
17-
'forceCopy' => true
16+
'forceCopy' => true,
1817
];
1918
public $css = [
2019
'mostactiveusers.css',

Module.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88

99
class Module extends \humhub\components\Module
1010
{
11-
1211
/**
1312
* On build of the dashboard sidebar widget, add the mostactiveusers widget if module is enabled.
1413
*
15-
* @param type $event
14+
* @param type $event
1615
*/
1716
public static function onSidebarInit($event)
1817
{
1918
if (Yii::$app->hasModule('mostactiveusers')) {
2019

21-
$event->sender->addWidget(widgets\Sidebar::className(), array(), array(
22-
'sortOrder' => 400
23-
));
20+
$event->sender->addWidget(widgets\Sidebar::className(), [], [
21+
'sortOrder' => 400,
22+
]);
2423
}
2524
}
2625

@@ -42,5 +41,3 @@ public function enable()
4241
}
4342

4443
}
45-
46-
?>

config.php

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@
1010
['class' => Sidebar::className(), 'event' => Sidebar::EVENT_INIT, 'callback' => ['humhub\modules\mostactiveusers\Module', 'onSidebarInit']],
1111
],
1212
];
13-
?>

controllers/ConfigController.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515
class ConfigController extends \humhub\modules\admin\components\Controller
1616
{
17-
1817
/**
1918
* Configuration Action for Super Admins
2019
*/
@@ -27,11 +26,9 @@ public function actionConfig()
2726
return $this->redirect(['/mostactiveusers/config/config']);
2827
}
2928

30-
return $this->render('config', array(
31-
'model' => $form
32-
));
29+
return $this->render('config', [
30+
'model' => $form,
31+
]);
3332
}
3433

3534
}
36-
37-
?>

controllers/ListController.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111
class ListController extends \humhub\components\Controller
1212
{
13-
1413
public $pageSize = 10;
1514

1615
/**
@@ -21,8 +20,8 @@ public function behaviors()
2120
return [
2221
'acl' => [
2322
'class' => \humhub\components\behaviors\AccessControl::className(),
24-
'guestAllowedActions' => ['list']
25-
]
23+
'guestAllowedActions' => ['list'],
24+
],
2625
];
2726
}
2827

@@ -38,11 +37,9 @@ public function actionList()
3837
$query->offset($pagination->offset)->limit($pagination->limit);
3938

4039
return $this->renderAjax('list', [
41-
'users' => $query->all(),
42-
'pagination' => $pagination
40+
'users' => $query->all(),
41+
'pagination' => $pagination,
4342
]);
4443
}
4544

4645
}
47-
48-
?>

docs/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
0.2.8 - Unreleased
5+
----------------------
6+
- Enh #24: Use PHP CS Fixer
7+
-
48
0.2.7 - April 14, 2022
59
----------------------
610
- Enh #4823: Remove CHTML/CActiveForm usages

models/ActiveUser.php

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
class ActiveUser extends \humhub\modules\user\models\User
1717
{
18-
1918
public $count_posts;
2019
public $count_likes;
2120
public $count_comments;

models/ConfigureForm.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@
66

77
class ConfigureForm extends \yii\base\Model
88
{
9-
109
public $noUsers;
1110

1211
public function rules()
1312
{
14-
return array(
15-
array('noUsers', 'required'),
16-
array('noUsers', 'integer', 'min' => 0, 'max' => 50),
17-
);
13+
return [
14+
['noUsers', 'required'],
15+
['noUsers', 'integer', 'min' => 0, 'max' => 50],
16+
];
1817
}
1918

2019
public function attributeLabels()
2120
{
22-
return array(
21+
return [
2322
'noUsers' => Yii::t('MostactiveusersModule.base', 'The number of most active users that will be shown.'),
24-
);
23+
];
2524
}
2625

2726
}

module.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Most Active Users",
44
"description": "Adds a widget to the dashboard showing the most active users",
55
"keywords": ["most", "active", "users", "widget", "dashboard"],
6-
"version": "0.2.7",
6+
"version": "0.2.8",
77
"humhub": {
88
"minVersion": "1.0"
99
},

widgets/Sidebar.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77

88
class Sidebar extends \humhub\components\Widget
99
{
10-
1110
public function run()
1211
{
1312
$users = ActiveUser::find()->limit((int) Setting::Get('noUsers', 'mostactiveusers'))->all();
1413
if (count($users) == 0) {
1514
return;
1615
}
1716

18-
return $this->render('sidebar', array(
19-
'users' => $users
20-
));
17+
return $this->render('sidebar', [
18+
'users' => $users,
19+
]);
2120
}
2221

2322
}
24-
25-
?>

0 commit comments

Comments
 (0)