phpstan improvements (#3092)

This commit is contained in:
Kevin Papst
2022-01-23 15:49:38 +01:00
committed by GitHub
parent 9047e9e785
commit 9e320674c1
42 changed files with 124 additions and 118 deletions

View File

@@ -99,7 +99,7 @@ class Activity implements EntityWithMetaFields, EntityWithBudget
/**
* Description of this activity
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Activity_Entity"})

View File

@@ -51,7 +51,7 @@ trait BudgetTrait
* - null = default / full time
* - month = monthly budget
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Activity_Entity", "Project_Entity", "Customer_Entity"})

View File

@@ -20,7 +20,7 @@ trait ColorTrait
/**
* The assigned color in HTML hex format, eg. #dd1d00
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
@@ -32,9 +32,6 @@ trait ColorTrait
*/
private $color = null;
/**
* @return string
*/
public function getColor(): ?string
{
if ($this->color === Constants::DEFAULT_COLOR) {
@@ -49,9 +46,6 @@ trait ColorTrait
return null !== $this->color && $this->color !== Constants::DEFAULT_COLOR;
}
/**
* @param string $color
*/
public function setColor(?string $color = null): void
{
$this->color = $color;

View File

@@ -30,10 +30,8 @@ class Configuration
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(name="id", type="integer")
* @phpstan-ignore-next-line
*/
private $id;
/**
* @var string
*
@@ -42,9 +40,8 @@ class Configuration
* @Assert\Length(min=2, max=100, allowEmptyString=false)
*/
private $name;
/**
* @var string
* @var string|null
*
* @ORM\Column(name="value", type="string", length=1024, nullable=true)
* @Assert\Length(max=1024, allowEmptyString=true)

View File

@@ -64,7 +64,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $name;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
@@ -76,7 +76,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $number;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -99,7 +99,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $visible = true;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -111,7 +111,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $company;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -123,7 +123,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $vatId;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -135,7 +135,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $contact;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -174,7 +174,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $currency = self::DEFAULT_CURRENCY;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -186,7 +186,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $phone;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -198,7 +198,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $fax;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -214,7 +214,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*
* Limited via RFC to 254 chars
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -226,7 +226,7 @@ class Customer implements EntityWithMetaFields, EntityWithBudget
*/
private $email;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})

View File

@@ -53,7 +53,6 @@ class Invoice implements EntityWithMetaFields
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
@@ -63,9 +62,8 @@ class Invoice implements EntityWithMetaFields
* @Assert\NotNull()
*/
private $invoiceNumber;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Customer_Entity"})
@@ -75,25 +73,22 @@ class Invoice implements EntityWithMetaFields
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
/**
* @var Customer|null
* @var Customer
*
* @ORM\ManyToOne(targetEntity="App\Entity\Customer")
* @ORM\JoinColumn(onDelete="CASCADE", nullable=false)
* @Assert\NotNull()
*/
private $customer;
/**
* @var User|null
* @var User
*
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @ORM\JoinColumn(onDelete="CASCADE", nullable=false)
* @Assert\NotNull()
*/
private $user;
/**
* @var \DateTime
*
@@ -103,14 +98,12 @@ class Invoice implements EntityWithMetaFields
* @Assert\NotNull()
*/
private $createdAt;
/**
* @var string
*
* @ORM\Column(name="timezone", type="string", length=64, nullable=false)
*/
private $timezone;
/**
* @var float
*
@@ -120,7 +113,6 @@ class Invoice implements EntityWithMetaFields
* @Assert\NotNull()
*/
private $total = 0.00;
/**
* @var float
*
@@ -130,7 +122,6 @@ class Invoice implements EntityWithMetaFields
* @Assert\NotNull()
*/
private $tax = 0.00;
/**
* @var string
*
@@ -141,7 +132,6 @@ class Invoice implements EntityWithMetaFields
* @Assert\Length(max=3)
*/
private $currency;
/**
* @var int
*
@@ -152,7 +142,6 @@ class Invoice implements EntityWithMetaFields
* @Assert\Range(min = 0, max = 999)
*/
private $dueDays = 30;
/**
* @var float
*
@@ -163,7 +152,6 @@ class Invoice implements EntityWithMetaFields
* @Assert\Range(min = 0.0, max = 99.99)
*/
private $vat = 0.00;
/**
* @var string
*
@@ -173,7 +161,6 @@ class Invoice implements EntityWithMetaFields
* @Assert\NotNull()
*/
private $status = self::STATUS_NEW;
/**
* @var string
*
@@ -184,19 +171,16 @@ class Invoice implements EntityWithMetaFields
* @Assert\Length(min=1, max=150, allowEmptyString=false)
*/
private $invoiceFilename;
/**
* @var bool
*/
private $localized = false;
/**
* @var \DateTime|null
*
* @ORM\Column(name="payment_date", type="date", nullable=true)
*/
private $paymentDate;
/**
* Meta fields
*

View File

@@ -32,7 +32,6 @@ class InvoiceTemplate
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
@@ -41,7 +40,6 @@ class InvoiceTemplate
* @Assert\Length(min=1, max=60, allowEmptyString=false)
*/
private $name;
/**
* @var string
*
@@ -49,7 +47,6 @@ class InvoiceTemplate
* @Assert\NotBlank()
*/
private $title;
/**
* @var string
*
@@ -57,29 +54,25 @@ class InvoiceTemplate
* @Assert\NotBlank()
*/
private $company;
/**
* @var string
* @var string|null
*
* @ORM\Column(name="vat_id", type="string", length=50, nullable=true)
* @Assert\Length(max=50)
*/
private $vatId;
/**
* @var string
* @var string|null
*
* @ORM\Column(name="address", type="text", nullable=true)
*/
private $address;
/**
* @var string
* @var string|null
*
* @ORM\Column(name="contact", type="text", nullable=true)
*/
private $contact;
/**
* @var int
*
@@ -87,7 +80,6 @@ class InvoiceTemplate
* @Assert\Range(min = 0, max = 999)
*/
private $dueDays = 30;
/**
* @var float
*
@@ -95,7 +87,6 @@ class InvoiceTemplate
* @Assert\Range(min = 0.0, max = 99.99)
*/
private $vat = 0.00;
/**
* @var string
*
@@ -112,7 +103,6 @@ class InvoiceTemplate
* @Assert\Length(max=20)
*/
private $numberGenerator = 'default';
/**
* @var string
*
@@ -121,21 +111,18 @@ class InvoiceTemplate
* @Assert\Length(max=20)
*/
private $renderer = 'default';
/**
* @var string
* @var string|null
*
* @ORM\Column(name="payment_terms", type="text", nullable=true)
*/
private $paymentTerms;
/**
* @var string
* @var string|null
*
* @ORM\Column(name="payment_details", type="text", nullable=true)
*/
private $paymentDetails;
/**
* Used when rendering HTML templates.
*
@@ -145,11 +132,10 @@ class InvoiceTemplate
* @Assert\NotNull()
*/
private $decimalDuration = false;
/**
* Used for translations and locale dependent number and date formats.
*
* @var string
* @var string|null
*
* @ORM\Column(name="language", type="string", length=6, nullable=true)
*/

View File

@@ -45,7 +45,7 @@ trait MetaTableTypeTrait
/**
* Value of the meta (custom) field
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})

View File

@@ -104,7 +104,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget
/**
* Project order number
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Project_Entity"})
@@ -116,7 +116,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget
*/
private $orderNumber;
/**
* @var \DateTime
* @var \DateTime|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Project_Entity"})
@@ -131,7 +131,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget
*/
private $orderDate;
/**
* @var \DateTime
* @var \DateTime|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Project"})
@@ -146,7 +146,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget
*/
private $start;
/**
* @var \DateTime
* @var \DateTime|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Project"})
@@ -161,7 +161,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget
*/
private $end;
/**
* @var string
* @var string|null
* @internal used for storing the timezone for "order", "start" and "end" date
*
* @ORM\Column(name="timezone", type="string", length=64, nullable=true)
@@ -173,7 +173,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget
*/
private $localized = false;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Project_Entity"})

View File

@@ -28,7 +28,7 @@ trait Rate
*/
private $id;
/**
* @var User
* @var User|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})

View File

@@ -30,7 +30,6 @@ class Role
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/
private $id;
/**

View File

@@ -30,7 +30,6 @@ class RolePermission
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/
private $id;
/**

View File

@@ -39,7 +39,6 @@ class Tag
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/
private $id;
/**

View File

@@ -59,7 +59,7 @@ class Team
/**
* All team member (including team leads)
*
* @var TeamMember[]|Collection<TeamMember>
* @var Collection<TeamMember>
*
* @Serializer\Expose()
* @Serializer\Groups({"Team_Entity"})

View File

@@ -32,7 +32,6 @@ class TeamMember
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/
private $id;
/**

View File

@@ -134,7 +134,7 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
*/
private $begin;
/**
* @var DateTime
* @var DateTime|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
@@ -160,7 +160,7 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
*/
private $localized = false;
/**
* @var int
* @var int|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
@@ -202,7 +202,7 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
*/
private $project;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
@@ -240,7 +240,7 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
*/
private $fixedRate = null;
/**
* @var float
* @var float|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Entity"})

View File

@@ -100,7 +100,7 @@ class User implements UserInterface, EquatableInterface, \Serializable
/**
* The user alias will be displayed in the frontend instead of the username
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})
@@ -114,7 +114,7 @@ class User implements UserInterface, EquatableInterface, \Serializable
/**
* Registration date for the user
*
* @var DateTime
* @var DateTime|null
*
* @Exporter\Expose(label="profile.registration_date", type="datetime")
*
@@ -124,7 +124,7 @@ class User implements UserInterface, EquatableInterface, \Serializable
/**
* An additional title for the user, like the Job position or Department
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"User_Entity"})
@@ -136,9 +136,9 @@ class User implements UserInterface, EquatableInterface, \Serializable
*/
private $title;
/**
* URL to the users avatar, will be auto-generated if empty
* URL to the user avatar, will be auto-generated if empty
*
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"User_Entity"})
@@ -150,7 +150,7 @@ class User implements UserInterface, EquatableInterface, \Serializable
/**
* API token (password) for this user
*
* @var string
* @var string|null
*
* @ORM\Column(name="api_token", type="string", length=255, nullable=true)
*/
@@ -167,7 +167,7 @@ class User implements UserInterface, EquatableInterface, \Serializable
*
* List of preferences for this user, required ones have dedicated fields/methods
*
* @var UserPreference[]|Collection
* @var Collection<UserPreference>
*
* @ORM\OneToMany(targetEntity="App\Entity\UserPreference", mappedBy="user", cascade={"persist"})
*/
@@ -175,7 +175,7 @@ class User implements UserInterface, EquatableInterface, \Serializable
/**
* List of all team memberships.
*
* @var TeamMember[]|ArrayCollection<TeamMember>
* @var Collection<TeamMember>
*
* @Serializer\Expose()
* @Serializer\Groups({"User_Entity"})
@@ -187,9 +187,9 @@ class User implements UserInterface, EquatableInterface, \Serializable
*/
private $memberships;
/**
* The type of authentication used by the user (eg. "kimai", "ldap", "saml")
* The type of authentication used by the user (e.g. "kimai", "ldap", "saml")
*
* @var string
* @var string|null
* @internal for internal usage only
*
* @ORM\Column(name="auth", type="string", length=20, nullable=true)

View File

@@ -49,7 +49,7 @@ class UserPreference
* @var User
*
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="preferences")
* @ORM\JoinColumn(onDelete="CASCADE")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
private $user;
@@ -65,7 +65,7 @@ class UserPreference
*/
private $name;
/**
* @var string
* @var string|null
*
* @Serializer\Expose()
* @Serializer\Groups({"Default"})