Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PHP CS Fixer #260

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: PHP CS Fixer

on: push

jobs:
tests:
uses: humhub/actions/.github/workflows/module-php-cs-fixer.yml@main
1 change: 0 additions & 1 deletion Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class Assets extends AssetBundle
{

public $css = [
'tasks.css',
];
Expand Down
5 changes: 2 additions & 3 deletions CalendarUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
*/
class CalendarUtils
{

const DATE_FORMAT = 'Y-m-d';
public const DATE_FORMAT = 'Y-m-d';

/**
*
* @param DateTime $date1
* @param DateTime $date2
* @param type $endDateMomentAfter
* @return boolean
* @return bool
*/
public static function isFullDaySpan(DateTime $date1, DateTime $date2, $endDateMomentAfter = false)
{
Expand Down
58 changes: 28 additions & 30 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
use humhub\modules\tasks\models\user\TaskUser;
use yii\db\Expression;


/* @var $user \humhub\modules\user\models\User */

/**
Expand All @@ -37,7 +36,6 @@
*/
class Events
{

public static function onTopMenuInit($event)
{
try {
Expand Down Expand Up @@ -221,33 +219,33 @@ public static function onIntegrityCheck($event)
}
}

// // check for task responsible users without task or existing user
// foreach (TaskResponsible::find()->each() as $taskResponsible) {
// if ($taskResponsible->task === null) {
// if ($integrityController->showFix("Deleting task responsible user id " . $taskResponsible->id . " without existing task!")) {
// $taskResponsible->delete();
// }
// }
// if ($taskResponsible->user === null) {
// if ($integrityController->showFix("Deleting task responsible user id " . $taskResponsible->id . " without existing user!")) {
// $taskResponsible->delete();
// }
// }
// }

// // check for task assigned users without task or existing user
// foreach (TaskAssigned::find()->each() as $taskAssigned) {
// if ($taskAssigned->task === null) {
// if ($integrityController->showFix("Deleting task assigned user id " . $taskAssigned->id . " without existing task!")) {
// $taskAssigned->delete();
// }
// }
// if ($taskAssigned->user === null) {
// if ($integrityController->showFix("Deleting task assigned user id " . $taskAssigned->id . " without existing user!")) {
// $taskAssigned->delete();
// }
// }
// }
// // check for task responsible users without task or existing user
// foreach (TaskResponsible::find()->each() as $taskResponsible) {
// if ($taskResponsible->task === null) {
// if ($integrityController->showFix("Deleting task responsible user id " . $taskResponsible->id . " without existing task!")) {
// $taskResponsible->delete();
// }
// }
// if ($taskResponsible->user === null) {
// if ($integrityController->showFix("Deleting task responsible user id " . $taskResponsible->id . " without existing user!")) {
// $taskResponsible->delete();
// }
// }
// }

// // check for task assigned users without task or existing user
// foreach (TaskAssigned::find()->each() as $taskAssigned) {
// if ($taskAssigned->task === null) {
// if ($integrityController->showFix("Deleting task assigned user id " . $taskAssigned->id . " without existing task!")) {
// $taskAssigned->delete();
// }
// }
// if ($taskAssigned->user === null) {
// if ($integrityController->showFix("Deleting task assigned user id " . $taskAssigned->id . " without existing user!")) {
// $taskAssigned->delete();
// }
// }
// }

// check for task reminders without task
foreach (TaskReminder::find()->each() as $taskReminder) {
Expand Down Expand Up @@ -287,7 +285,7 @@ public static function onMemberRemoved($event)
}
}
}
} catch(\Throwable $e) {
} catch (\Throwable $e) {
Yii::error($e);
}
}
Expand Down
1 change: 0 additions & 1 deletion activities/Finished.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class Finished extends BaseActivity
{

public $moduleId = 'tasks';
public $viewName = "finished";

Expand Down
1 change: 0 additions & 1 deletion activities/TaskCompletedActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class TaskCompletedActivity extends BaseActivity
{

public $moduleId = 'tasks';
public $viewName = "taskCompleted";

Expand Down
1 change: 0 additions & 1 deletion activities/TaskResetActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class TaskResetActivity extends BaseActivity
{

public $moduleId = 'tasks';
public $viewName = "taskReset";

Expand Down
1 change: 0 additions & 1 deletion activities/TaskReviewedActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class TaskReviewedActivity extends BaseActivity
{

public $moduleId = 'tasks';
public $viewName = "taskReviewed";

Expand Down
1 change: 0 additions & 1 deletion activities/TaskStartActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class TaskStartActivity extends BaseActivity
{

public $moduleId = 'tasks';
public $viewName = "taskStart";

Expand Down
1 change: 0 additions & 1 deletion assets/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

class Assets extends AssetBundle
{

/**
* @inheritDoc
*/
Expand Down
1 change: 0 additions & 1 deletion components/TaskHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
class TaskHelper
{

public static function isOverdue(Task $task)
{
if (!$task->hasDeadline()) {
Expand Down
6 changes: 3 additions & 3 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use humhub\modules\space\models\Membership;
use humhub\modules\user\widgets\ProfileMenu;

return array(
return [
'id' => 'tasks',
'class' => 'humhub\modules\tasks\Module',
'namespace' => 'humhub\modules\tasks',
Expand All @@ -26,5 +26,5 @@
['class' => 'humhub\modules\calendar\interfaces\CalendarService', 'event' => 'getItemTypes', 'callback' => ['humhub\modules\tasks\Events', 'onGetCalendarItemTypes']],
['class' => 'humhub\modules\calendar\interfaces\CalendarService', 'event' => 'findItems', 'callback' => ['humhub\modules\tasks\Events', 'onFindCalendarItems']],
['class' => 'humhub\modules\rest\Module', 'event' => 'restApiAddRules', 'callback' => ['humhub\modules\tasks\Events', 'onRestApiAddRules']],
]
);
],
];
22 changes: 11 additions & 11 deletions controllers/AbstractTaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function actionExport($format)
$query = $filterModel->query();

$dataProvider = new ActiveDataProvider([
'query' => $query
'query' => $query,
]);

$exporter = new SpreadsheetExport([
Expand Down Expand Up @@ -82,20 +82,20 @@ private function collectExportColumns($query)
'description',
[
'attribute' => 'Container',
'value' => $this->getRelatedContainer()
'value' => $this->getRelatedContainer(),
],
[
'attribute' => 'ContainerType',
'value' => function ($model) {
/* @var $model \humhub\modules\tasks\models\Task */
return (new \ReflectionClass($model->content->container))->getShortName();
}
},
],
[
'attribute' => 'ContainerId',
'value' => function ($model) {
return $model->content->container->id;
}
},
],
[
'class' => DateTimeColumn::class,
Expand All @@ -121,24 +121,24 @@ private function collectExportColumns($query)
'status',
[
'attribute' => 'Checklist',
'value' => $this->getTaskItems($relationsData)
'value' => $this->getTaskItems($relationsData),
],
[
'attribute' => 'Assigned Users',
'value' => $this->getAssignedUsers($relationsData)
'value' => $this->getAssignedUsers($relationsData),
],
[
'attribute' => 'Responsible Users',
'value' => $this->getResponsibleUsers($relationsData)
'value' => $this->getResponsibleUsers($relationsData),
],
[
'attribute' => 'Comments',
'value' => $this->getComments()
'value' => $this->getComments(),
],
'color',
[
'attribute' => 'review',
'label' => 'Review required'
'label' => 'Review required',
],
'scheduling',
'all_day',
Expand All @@ -147,8 +147,8 @@ private function collectExportColumns($query)
'request_sent',
[
'attribute' => 'task_list_id',
'label' => 'Task List'
'label' => 'Task List',
],
];
}
}
}
10 changes: 4 additions & 6 deletions controllers/ChecklistController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php


namespace humhub\modules\tasks\controllers;


use humhub\modules\content\components\ContentContainerControllerAccess;
use humhub\modules\space\models\Space;
use humhub\modules\tasks\models\checklist\CheckForm;
Expand All @@ -19,21 +17,21 @@ class ChecklistController extends AbstractTaskController
protected function getAccessRules()
{
return [
[ContentContainerControllerAccess::RULE_USER_GROUP_ONLY => [Space::USERGROUP_MEMBER, User::USERGROUP_SELF]]
[ContentContainerControllerAccess::RULE_USER_GROUP_ONLY => [Space::USERGROUP_MEMBER, User::USERGROUP_SELF]],
];
}

public function actionCheckItem($id, $taskId)
{
$model = new CheckForm(['itemId' => $id, 'taskId' => $taskId]);
if($model->load(Yii::$app->request->post()) && $model->save()) {
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->asJson([
'success' => true,
'item' => [
'checked' => $model->checked,
'statusChanged' => $model->statusChanged,
'sortOrder' => $model->item->sort_order
]
'sortOrder' => $model->item->sort_order,
],
]);
}

Expand Down
4 changes: 2 additions & 2 deletions controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use yii\web\HttpException;

/**
*
*
*/
class ConfigController extends Controller
{
Expand All @@ -42,7 +42,7 @@ public function actionIndex()
}

return $this->render('snippet', [
'model' => $model
'model' => $model,
]);
}
}
6 changes: 3 additions & 3 deletions controllers/GlobalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ class GlobalController extends AbstractTaskController
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY]
[ControllerAccess::RULE_LOGGED_IN_ONLY],
];
}

public function actionIndex()
{
return $this->render('index', [
'filter' => new TaskFilter(['filters' => [TaskFilter::FILTER_ASSIGNED]])
'filter' => new TaskFilter(['filters' => [TaskFilter::FILTER_ASSIGNED]]),
]);
}

Expand All @@ -43,7 +43,7 @@ public function actionFilter()

return $this->asJson([
'success' => true,
'result' => TaskSearchList::widget(['filter' => $filter])
'result' => TaskSearchList::widget(['filter' => $filter]),
]);
}

Expand Down
Loading