improved code styles #158 (#172)

* use php-cs-fixer instead of phpcodesniffer
* updated scrutinizer config
* adjusted code yules to all files
* updated CONTRIBUTING guidelines
This commit is contained in:
Kevin Papst
2018-06-22 21:09:10 +02:00
committed by GitHub
parent 773d27bb0e
commit cd7cbeae88
142 changed files with 775 additions and 467 deletions

View File

@@ -9,7 +9,6 @@
namespace App\Repository\Query;
use App\Entity\Customer;
use App\Entity\Project;
/**
@@ -17,7 +16,6 @@ use App\Entity\Project;
*/
class ActivityQuery extends ProjectQuery
{
/**
* @var Project
*/
@@ -38,6 +36,7 @@ class ActivityQuery extends ProjectQuery
public function setProject(Project $project = null)
{
$this->project = $project;
return $this;
}
}

View File

@@ -14,17 +14,17 @@ namespace App\Repository\Query;
*/
class BaseQuery
{
const ORDER_ASC = 'ASC';
const ORDER_DESC = 'DESC';
public const ORDER_ASC = 'ASC';
public const ORDER_DESC = 'DESC';
const DEFAULT_PAGESIZE = 25;
const DEFAULT_PAGE = 1;
public const DEFAULT_PAGESIZE = 25;
public const DEFAULT_PAGE = 1;
const RESULT_TYPE_PAGER = 'PagerFanta';
const RESULT_TYPE_QUERYBUILDER = 'QueryBuilder';
public const RESULT_TYPE_PAGER = 'PagerFanta';
public const RESULT_TYPE_QUERYBUILDER = 'QueryBuilder';
/**
* @var \stdClass
* @var object
*/
protected $hiddenEntity;
/**
@@ -62,7 +62,8 @@ class BaseQuery
*/
public function setPage($page)
{
$this->page = (int)$page;
$this->page = (int) $page;
return $this;
}
@@ -80,9 +81,10 @@ class BaseQuery
*/
public function setPageSize($pageSize)
{
if (!empty($pageSize) && (int)$pageSize > 0) {
$this->pageSize = (int)$pageSize;
if (!empty($pageSize) && (int) $pageSize > 0) {
$this->pageSize = (int) $pageSize;
}
return $this;
}
@@ -103,6 +105,7 @@ class BaseQuery
public function setOrderBy($orderBy)
{
$this->orderBy = $orderBy;
return $this;
}
@@ -123,6 +126,7 @@ class BaseQuery
if (in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
$this->order = $order;
}
return $this;
}
@@ -143,11 +147,12 @@ class BaseQuery
if (in_array($resultType, [self::RESULT_TYPE_PAGER, self::RESULT_TYPE_QUERYBUILDER])) {
$this->resultType = $resultType;
}
return $this;
}
/**
* @return \stdClass
* @return object
*/
public function getHiddenEntity()
{
@@ -155,12 +160,13 @@ class BaseQuery
}
/**
* @param \stdClass $hiddenEntity
* @param object $hiddenEntity
* @return BaseQuery
*/
public function setHiddenEntity($hiddenEntity)
{
$this->hiddenEntity = $hiddenEntity;
return $this;
}
}

View File

@@ -16,7 +16,6 @@ use App\Entity\InvoiceTemplate;
*/
class InvoiceQuery extends TimesheetQuery
{
/**
* @var InvoiceTemplate
*/
@@ -42,6 +41,7 @@ class InvoiceQuery extends TimesheetQuery
public function setTemplate($template)
{
$this->template = $template;
return $this;
}
@@ -60,6 +60,7 @@ class InvoiceQuery extends TimesheetQuery
public function setTemplates(array $templates)
{
$this->templates = $templates;
return $this;
}
}

View File

@@ -16,7 +16,6 @@ use App\Entity\Customer;
*/
class ProjectQuery extends VisibilityQuery
{
/**
* @var Customer
*/
@@ -37,6 +36,7 @@ class ProjectQuery extends VisibilityQuery
public function setCustomer(Customer $customer = null)
{
$this->customer = $customer;
return $this;
}
}

View File

@@ -10,19 +10,16 @@
namespace App\Repository\Query;
use App\Entity\User;
use App\Repository\Query\BaseQuery;
use App\Entity\Activity;
use App\Entity\Customer;
use App\Entity\Project;
/**
* Can be used for advanced timesheet repository queries.
*/
class TimesheetQuery extends ActivityQuery
{
const STATE_ALL = 1;
const STATE_RUNNING = 2;
const STATE_STOPPED = 3;
public const STATE_ALL = 1;
public const STATE_RUNNING = 2;
public const STATE_STOPPED = 3;
/**
* Overwritten for different default order
@@ -70,6 +67,7 @@ class TimesheetQuery extends ActivityQuery
public function setUser(User $user = null)
{
$this->user = $user;
return $this;
}
@@ -90,6 +88,7 @@ class TimesheetQuery extends ActivityQuery
public function setActivity(Activity $activity = null)
{
$this->activity = $activity;
return $this;
}
@@ -134,6 +133,7 @@ class TimesheetQuery extends ActivityQuery
public function setBegin($begin)
{
$this->begin = $begin;
return $this;
}
@@ -152,6 +152,7 @@ class TimesheetQuery extends ActivityQuery
public function setEnd($end)
{
$this->end = $end;
return $this;
}
}

View File

@@ -14,7 +14,6 @@ namespace App\Repository\Query;
*/
class UserQuery extends VisibilityQuery
{
/**
* @var string
*/
@@ -34,9 +33,10 @@ class UserQuery extends VisibilityQuery
*/
public function setRole($role)
{
if (strpos($role, 'ROLE_') !== false || $role === null) {
if (false !== strpos($role, 'ROLE_') || null === $role) {
$this->role = $role;
}
return $this;
}
}

View File

@@ -14,12 +14,12 @@ namespace App\Repository\Query;
*/
class VisibilityQuery extends BaseQuery
{
const SHOW_VISIBLE = 1;
const SHOW_HIDDEN = 2;
const SHOW_BOTH = 3;
public const SHOW_VISIBLE = 1;
public const SHOW_HIDDEN = 2;
public const SHOW_BOTH = 3;
/**
* @var integer
* @var int
*/
protected $visibility = self::SHOW_VISIBLE;
/**
@@ -70,6 +70,7 @@ class VisibilityQuery extends BaseQuery
public function setExclusiveVisibility($exclusiveVisibility)
{
$this->exclusiveVisibility = (bool) $exclusiveVisibility;
return $this;
}
}