Various fixes for PHPAnalyzer

This commit is contained in:
Frederic Guillot
2015-04-03 18:32:51 -04:00
parent 91a5ec0885
commit 5a29cccc95
30 changed files with 48 additions and 38 deletions

View File

@@ -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.'));

View File

@@ -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');
}

View File

@@ -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.'));

View File

@@ -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);
}

View File

@@ -20,7 +20,7 @@ class Comment extends Base
{
$comment = $this->comment->getById($this->request->getIntegerParam('comment_id'));
if (! $comment) {
if (empty($comment)) {
$this->notfound();
}

View File

@@ -37,7 +37,7 @@ class Link extends Base
{
$link = $this->link->getById($this->request->getIntegerParam('link_id'));
if (! $link) {
if (empty($link)) {
$this->notfound();
}

View File

@@ -22,7 +22,7 @@ class Subtask extends Base
{
$subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id'));
if (! $subtask) {
if (empty($subtask)) {
$this->notfound();
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -21,7 +21,7 @@ class Tasklink extends Base
{
$link = $this->taskLink->getById($this->request->getIntegerParam('link_id'));
if (! $link) {
if (empty($link)) {
$this->notfound();
}

View File

@@ -97,7 +97,7 @@ class User extends Base
{
$user = $this->user->getById($this->request->getIntegerParam('user_id'));
if (! $user) {
if (empty($user)) {
$this->notfound();
}