From 5a29cccc959dfd0be5fdc279ac1170d2db0b3040 Mon Sep 17 00:00:00 2001
From: Frederic Guillot <fred@kanboard.net>
Date: Fri, 3 Apr 2015 18:32:51 -0400
Subject: Various fixes for PHPAnalyzer

---
 app/Controller/Action.php   | 2 +-
 app/Controller/Base.php     | 5 +++--
 app/Controller/Board.php    | 4 ++--
 app/Controller/Category.php | 2 +-
 app/Controller/Comment.php  | 2 +-
 app/Controller/Link.php     | 2 +-
 app/Controller/Subtask.php  | 2 +-
 app/Controller/Swimlane.php | 2 +-
 app/Controller/Task.php     | 4 ++--
 app/Controller/Tasklink.php | 2 +-
 app/Controller/User.php     | 2 +-
 11 files changed, 15 insertions(+), 14 deletions(-)

(limited to 'app/Controller')

diff --git a/app/Controller/Action.php b/app/Controller/Action.php
index 2b58dca1..cd24453a 100644
--- a/app/Controller/Action.php
+++ b/app/Controller/Action.php
@@ -157,7 +157,7 @@ class Action extends Base
         $project = $this->getProject();
         $action = $this->action->getById($this->request->getIntegerParam('action_id'));
 
-        if ($action && $this->action->remove($action['id'])) {
+        if (! empty($action) && $this->action->remove($action['id'])) {
             $this->session->flash(t('Action removed successfully.'));
         } else {
             $this->session->flashError(t('Unable to remove this action.'));
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index cebecaca..10bf962f 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -44,6 +44,7 @@ use Symfony\Component\EventDispatcher\Event;
  * @property \Model\ProjectActivity        $projectActivity
  * @property \Model\ProjectDailySummary    $projectDailySummary
  * @property \Model\Subtask                $subtask
+ * @property \Model\SubtaskForecast        $subtaskForecast
  * @property \Model\Swimlane               $swimlane
  * @property \Model\Task                   $task
  * @property \Model\Link                   $link
@@ -336,7 +337,7 @@ abstract class Base
     {
         $task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id'));
 
-        if (! $task) {
+        if (empty($task)) {
             $this->notfound();
         }
 
@@ -355,7 +356,7 @@ abstract class Base
         $project_id = $this->request->getIntegerParam('project_id', $project_id);
         $project = $this->project->getById($project_id);
 
-        if (! $project) {
+        if (empty($project)) {
             $this->session->flashError(t('Project not found.'));
             $this->response->redirect('?controller=project');
         }
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 17170317..fa22226e 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -117,7 +117,7 @@ class Board extends Base
         $project = $this->project->getByToken($token);
 
         // Token verification
-        if (! $project) {
+        if (empty($project)) {
             $this->forbidden(true);
         }
 
@@ -311,7 +311,7 @@ class Board extends Base
             $this->checkCSRFParam();
             $column = $this->board->getColumn($this->request->getIntegerParam('column_id'));
 
-            if ($column && $this->board->removeColumn($column['id'])) {
+            if (! empty($column) && $this->board->removeColumn($column['id'])) {
                 $this->session->flash(t('Column removed successfully.'));
             } else {
                 $this->session->flashError(t('Unable to remove this column.'));
diff --git a/app/Controller/Category.php b/app/Controller/Category.php
index 68961a0e..515cc9c8 100644
--- a/app/Controller/Category.php
+++ b/app/Controller/Category.php
@@ -21,7 +21,7 @@ class Category extends Base
     {
         $category = $this->category->getById($this->request->getIntegerParam('category_id'));
 
-        if (! $category) {
+        if (empty($category)) {
             $this->session->flashError(t('Category not found.'));
             $this->response->redirect('?controller=category&action=index&project_id='.$project_id);
         }
diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php
index 50032000..a5f6b1f8 100644
--- a/app/Controller/Comment.php
+++ b/app/Controller/Comment.php
@@ -20,7 +20,7 @@ class Comment extends Base
     {
         $comment = $this->comment->getById($this->request->getIntegerParam('comment_id'));
 
-        if (! $comment) {
+        if (empty($comment)) {
             $this->notfound();
         }
 
diff --git a/app/Controller/Link.php b/app/Controller/Link.php
index ec9c6195..4a29a3e2 100644
--- a/app/Controller/Link.php
+++ b/app/Controller/Link.php
@@ -37,7 +37,7 @@ class Link extends Base
     {
         $link = $this->link->getById($this->request->getIntegerParam('link_id'));
 
-        if (! $link) {
+        if (empty($link)) {
             $this->notfound();
         }
 
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php
index 385785a1..5eff1575 100644
--- a/app/Controller/Subtask.php
+++ b/app/Controller/Subtask.php
@@ -22,7 +22,7 @@ class Subtask extends Base
     {
         $subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id'));
 
-        if (! $subtask) {
+        if (empty($subtask)) {
             $this->notfound();
         }
 
diff --git a/app/Controller/Swimlane.php b/app/Controller/Swimlane.php
index e10d21f1..c6862d47 100644
--- a/app/Controller/Swimlane.php
+++ b/app/Controller/Swimlane.php
@@ -23,7 +23,7 @@ class Swimlane extends Base
     {
         $swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id'));
 
-        if (! $swimlane) {
+        if (empty($swimlane)) {
             $this->session->flashError(t('Swimlane not found.'));
             $this->response->redirect('?controller=swimlane&action=index&project_id='.$project_id);
         }
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 3c5b5c39..5bca4510 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -22,13 +22,13 @@ class Task extends Base
         $project = $this->project->getByToken($this->request->getStringParam('token'));
 
         // Token verification
-        if (! $project) {
+        if (empty($project)) {
             $this->forbidden(true);
         }
 
         $task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id'));
 
-        if (! $task) {
+        if (empty($task)) {
             $this->notfound(true);
         }
 
diff --git a/app/Controller/Tasklink.php b/app/Controller/Tasklink.php
index 59ce0433..8376b75b 100644
--- a/app/Controller/Tasklink.php
+++ b/app/Controller/Tasklink.php
@@ -21,7 +21,7 @@ class Tasklink extends Base
     {
         $link = $this->taskLink->getById($this->request->getIntegerParam('link_id'));
 
-        if (! $link) {
+        if (empty($link)) {
             $this->notfound();
         }
 
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 46d0214d..5dad4ef6 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -97,7 +97,7 @@ class User extends Base
     {
         $user = $this->user->getById($this->request->getIntegerParam('user_id'));
 
-        if (! $user) {
+        if (empty($user)) {
             $this->notfound();
         }
 
-- 
cgit v1.2.3