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

@@ -20,9 +20,8 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class Activity
{
/**
* @var integer
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
@@ -56,7 +55,7 @@ class Activity
private $comment;
/**
* @var boolean
* @var bool
*
* @ORM\Column(name="visible", type="boolean", nullable=false)
* @Assert\NotNull()
@@ -85,6 +84,7 @@ class Activity
public function setProject($project)
{
$this->project = $project;
return $this;
}
@@ -97,6 +97,7 @@ class Activity
public function setName($name)
{
$this->name = $name;
return $this;
}
@@ -119,6 +120,7 @@ class Activity
public function setComment($comment)
{
$this->comment = $comment;
return $this;
}
@@ -135,20 +137,21 @@ class Activity
/**
* Set visible
*
* @param boolean $visible
* @param bool $visible
*
* @return Activity
*/
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
/**
* Get visible
*
* @return boolean
* @return bool
*/
public function getVisible()
{
@@ -158,7 +161,7 @@ class Activity
/**
* Get activity id
*
* @return integer
* @return int
*/
public function getId()
{

View File

@@ -20,11 +20,10 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class Customer
{
const DEFAULT_CURRENCY = 'EUR';
public const DEFAULT_CURRENCY = 'EUR';
/**
* @var integer
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
@@ -63,7 +62,7 @@ class Customer
private $projects;
/**
* @var boolean
* @var bool
*
* @ORM\Column(name="visible", type="boolean", nullable=false)
* @Assert\NotNull()
@@ -167,6 +166,7 @@ class Customer
public function setName($name)
{
$this->name = $name;
return $this;
}
@@ -187,6 +187,7 @@ class Customer
public function setNumber(string $number)
{
$this->number = $number;
return $this;
}
@@ -207,6 +208,7 @@ class Customer
public function setComment($comment)
{
$this->comment = $comment;
return $this;
}
@@ -223,19 +225,20 @@ class Customer
/**
* Set visible
*
* @param boolean $visible
* @param bool $visible
* @return Customer
*/
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
/**
* Get visible
*
* @return boolean
* @return bool
*/
public function getVisible()
{
@@ -251,6 +254,7 @@ class Customer
public function setCompany($company)
{
$this->company = $company;
return $this;
}
@@ -273,6 +277,7 @@ class Customer
public function setContact($contact)
{
$this->contact = $contact;
return $this;
}
@@ -293,6 +298,7 @@ class Customer
public function setAddress($address)
{
$this->address = $address;
return $this;
}
@@ -313,6 +319,7 @@ class Customer
public function setCountry($country)
{
$this->country = $country;
return $this;
}
@@ -333,6 +340,7 @@ class Customer
public function setCurrency($currency)
{
$this->currency = $currency;
return $this;
}
@@ -353,6 +361,7 @@ class Customer
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
@@ -375,6 +384,7 @@ class Customer
public function setFax($fax)
{
$this->fax = $fax;
return $this;
}
@@ -397,6 +407,7 @@ class Customer
public function setMobile($mobile)
{
$this->mobile = $mobile;
return $this;
}
@@ -419,6 +430,7 @@ class Customer
public function setMail($mail)
{
$this->mail = $mail;
return $this;
}
@@ -441,6 +453,7 @@ class Customer
public function setHomepage($homepage)
{
$this->homepage = $homepage;
return $this;
}
@@ -463,6 +476,7 @@ class Customer
public function setTimezone($timezone)
{
$this->timezone = $timezone;
return $this;
}
@@ -483,6 +497,7 @@ class Customer
public function setProjects($projects)
{
$this->projects = $projects;
return $this;
}

View File

@@ -26,7 +26,7 @@ use Symfony\Component\Validator\Constraints as Assert;
class InvoiceTemplate
{
/**
* @var integer
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
@@ -128,6 +128,7 @@ class InvoiceTemplate
public function setName($name)
{
$this->name = $name;
return $this;
}
@@ -156,6 +157,7 @@ class InvoiceTemplate
public function setTitle(string $title)
{
$this->title = $title;
return $this;
}
@@ -174,6 +176,7 @@ class InvoiceTemplate
public function setAddress($address)
{
$this->address = $address;
return $this;
}
@@ -192,6 +195,7 @@ class InvoiceTemplate
public function setNumberGenerator(string $numberGenerator)
{
$this->numberGenerator = $numberGenerator;
return $this;
}
@@ -210,6 +214,7 @@ class InvoiceTemplate
public function setDueDays(int $dueDays)
{
$this->dueDays = $dueDays;
return $this;
}
@@ -228,6 +233,7 @@ class InvoiceTemplate
public function setVat(float $vat)
{
$this->vat = $vat;
return $this;
}
@@ -246,6 +252,7 @@ class InvoiceTemplate
public function setCompany(string $company)
{
$this->company = $company;
return $this;
}
@@ -264,6 +271,7 @@ class InvoiceTemplate
public function setRenderer(string $renderer)
{
$this->renderer = $renderer;
return $this;
}
@@ -282,6 +290,7 @@ class InvoiceTemplate
public function setCalculator(string $calculator)
{
$this->calculator = $calculator;
return $this;
}
@@ -300,6 +309,7 @@ class InvoiceTemplate
public function setPaymentTerms(string $paymentTerms)
{
$this->paymentTerms = $paymentTerms;
return $this;
}

View File

@@ -20,9 +20,8 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class Project
{
/**
* @var integer
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
@@ -64,7 +63,7 @@ class Project
private $comment;
/**
* @var boolean
* @var bool
*
* @ORM\Column(name="visible", type="boolean", nullable=false)
* @Assert\NotNull()
@@ -89,7 +88,7 @@ class Project
/**
* Get projectid
*
* @return integer
* @return int
*/
public function getId()
{
@@ -111,6 +110,7 @@ class Project
public function setCustomer($customer)
{
$this->customer = $customer;
return $this;
}
@@ -123,6 +123,7 @@ class Project
public function setName($name)
{
$this->name = $name;
return $this;
}
@@ -145,6 +146,7 @@ class Project
public function setComment($comment)
{
$this->comment = $comment;
return $this;
}
@@ -161,19 +163,20 @@ class Project
/**
* Set visible
*
* @param boolean $visible
* @param bool $visible
* @return Project
*/
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
/**
* Get visible
*
* @return boolean
* @return bool
*/
public function getVisible()
{
@@ -189,6 +192,7 @@ class Project
public function setBudget($budget)
{
$this->budget = $budget;
return $this;
}
@@ -209,6 +213,7 @@ class Project
public function setActivities($activities)
{
$this->activities = $activities;
return $this;
}
@@ -235,6 +240,7 @@ class Project
public function setOrderNumber($orderNumber)
{
$this->orderNumber = $orderNumber;
return $this;
}

View File

@@ -9,7 +9,6 @@
namespace App\Entity;
use App\Entity\User;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
@@ -29,9 +28,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
*/
class Timesheet
{
/**
* @var integer
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
@@ -55,7 +53,7 @@ class Timesheet
private $end;
/**
* @var integer
* @var int
*
* @ORM\Column(name="duration", type="integer", nullable=true)
* @Assert\GreaterThanOrEqual(0)
@@ -97,7 +95,7 @@ class Timesheet
/**
* Get entry id
*
* @return integer
* @return int
*/
public function getId()
{
@@ -119,6 +117,7 @@ class Timesheet
public function setBegin($begin)
{
$this->begin = $begin;
return $this;
}
@@ -137,7 +136,7 @@ class Timesheet
public function setEnd($end)
{
$this->end = $end;
if ($end === null) {
if (null === $end) {
$this->duration = 0;
}
@@ -147,12 +146,13 @@ class Timesheet
/**
* Set duration
*
* @param integer $duration
* @param int $duration
* @return Timesheet
*/
public function setDuration($duration)
{
$this->duration = $duration;
return $this;
}
@@ -160,7 +160,7 @@ class Timesheet
* Get duration
* Do not rely on the results of this method for active records.
*
* @return integer
* @return int
*/
public function getDuration()
{
@@ -176,6 +176,7 @@ class Timesheet
public function setUser(User $user)
{
$this->user = $user;
return $this;
}
@@ -198,6 +199,7 @@ class Timesheet
public function setActivity($activity)
{
$this->activity = $activity;
return $this;
}
@@ -220,6 +222,7 @@ class Timesheet
public function setDescription($description)
{
$this->description = $description;
return $this;
}
@@ -242,6 +245,7 @@ class Timesheet
public function setRate($rate)
{
$this->rate = $rate;
return $this;
}
@@ -263,7 +267,7 @@ class Timesheet
*/
public function validate(ExecutionContextInterface $context, $payload)
{
if ($this->getEnd() !== null && $this->getEnd()->getTimestamp() < $this->getBegin()->getTimestamp()) {
if (null !== $this->getEnd() && $this->getEnd()->getTimestamp() < $this->getBegin()->getTimestamp()) {
$context->buildViolation('End date must not be earlier then start date.')
->atPath('end')
->setTranslationDomain('validators')

View File

@@ -6,7 +6,6 @@ use App\Validator\Constraints as KimaiAssert;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@@ -27,12 +26,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
*/
class User implements UserInterface
{
const ROLE_CUSTOMER = 'ROLE_CUSTOMER';
const ROLE_USER = 'ROLE_USER';
const ROLE_TEAMLEAD = 'ROLE_TEAMLEAD';
const ROLE_ADMIN = 'ROLE_ADMIN';
const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN';
const DEFAULT_ROLE = self::ROLE_USER;
public const ROLE_CUSTOMER = 'ROLE_CUSTOMER';
public const ROLE_USER = 'ROLE_USER';
public const ROLE_TEAMLEAD = 'ROLE_TEAMLEAD';
public const ROLE_ADMIN = 'ROLE_ADMIN';
public const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN';
public const DEFAULT_ROLE = self::ROLE_USER;
/**
* @var int
@@ -85,7 +84,7 @@ class User implements UserInterface
private $alias;
/**
* @var boolean
* @var bool
*
* @ORM\Column(name="active", type="boolean", nullable=false)
* @Assert\NotNull()
@@ -184,7 +183,7 @@ class User implements UserInterface
}
/**
* @param boolean $active
* @param bool $active
* @return $this
*/
public function setActive($active)
@@ -195,7 +194,7 @@ class User implements UserInterface
}
/**
* @return boolean
* @return bool
*/
public function isActive()
{
@@ -242,6 +241,7 @@ class User implements UserInterface
public function setPlainPassword($password)
{
$this->plainPassword = $password;
return $this;
}
@@ -279,6 +279,7 @@ class User implements UserInterface
public function setEmail($email)
{
$this->email = $email;
return $this;
}
@@ -297,6 +298,7 @@ class User implements UserInterface
public function setTitle($title)
{
$this->title = $title;
return $this;
}
@@ -315,6 +317,7 @@ class User implements UserInterface
public function setAvatar($avatar)
{
$this->avatar = $avatar;
return $this;
}
@@ -342,6 +345,7 @@ class User implements UserInterface
public function setRoles(array $roles)
{
$this->roles = $roles;
return $this;
}
@@ -363,6 +367,7 @@ class User implements UserInterface
$preferences = new ArrayCollection($preferences);
}
$this->preferences = $preferences;
return $this;
}
@@ -382,16 +387,17 @@ class User implements UserInterface
}
/**
* @param $name
* @param null $default
* @param string $name
* @param mixed $default
* @return bool|int|null|string
*/
public function getPreferenceValue($name, $default = null)
{
$preference = $this->getPreference($name);
if ($preference === null) {
if (null === $preference) {
return $default;
}
return $preference->getValue();
}
@@ -402,6 +408,7 @@ class User implements UserInterface
public function addPreference(UserPreference $preference)
{
$this->preferences->add($preference);
return $this;
}

View File

@@ -21,8 +21,8 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class UserPreference
{
const HOURLY_RATE = 'hourly_rate';
const SKIN = 'skin';
public const HOURLY_RATE = 'hourly_rate';
public const SKIN = 'skin';
/**
* @var int
@@ -82,6 +82,7 @@ class UserPreference
public function setId(int $id): UserPreference
{
$this->id = $id;
return $this;
}
@@ -100,6 +101,7 @@ class UserPreference
public function setUser(User $user): UserPreference
{
$this->user = $user;
return $this;
}
@@ -118,6 +120,7 @@ class UserPreference
public function setName(string $name): UserPreference
{
$this->name = $name;
return $this;
}
@@ -143,6 +146,7 @@ class UserPreference
public function setValue($value): UserPreference
{
$this->value = $value;
return $this;
}
@@ -155,6 +159,7 @@ class UserPreference
public function setType(string $type)
{
$this->type = $type;
return $this;
}
@@ -175,6 +180,7 @@ class UserPreference
public function setConstraints(array $constraints)
{
$this->constraints = $constraints;
return $this;
}
@@ -187,6 +193,7 @@ class UserPreference
public function addConstraint(Constraint $constraint)
{
$this->constraints[] = $constraint;
return $this;
}