mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-03 06:54:34 +02:00
Improved typing and phpdoc type annotations
This commit is contained in:
parent
3817ba774d
commit
b7c8ca2a48
39 changed files with 189 additions and 129 deletions
|
@ -78,9 +78,9 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
|
|||
*********************************************************************************/
|
||||
|
||||
/**
|
||||
* Gets all attachments associated with this element.
|
||||
* Gets all attachments associated with this element.
|
||||
*
|
||||
* @return Collection<Attachment>
|
||||
* @phpstan-return Collection<int, AT>
|
||||
*/
|
||||
public function getAttachments(): Collection
|
||||
{
|
||||
|
|
|
@ -91,8 +91,9 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
/**
|
||||
* Get all attachments ("Attachment" objects) with this type.
|
||||
*
|
||||
* @return Collection|Attachment[] all attachments with this type, as a one-dimensional array of Attachments
|
||||
* @return Collection all attachments with this type, as a one-dimensional array of Attachments
|
||||
* (sorted by their names)
|
||||
* @phpstan-return Collection<int, Attachment>
|
||||
*/
|
||||
public function getAttachmentsForType(): Collection
|
||||
{
|
||||
|
|
|
@ -247,9 +247,9 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the timestamp when the event that caused this log entry happened.
|
||||
* Returns the timestamp when the event that caused this log entry happened.
|
||||
*/
|
||||
public function getTimestamp(): \DateTimeInterface
|
||||
public function getTimestamp(): \DateTimeInterface|null
|
||||
{
|
||||
return $this->timestamp;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ class Part extends AttachmentContainingDBElement
|
|||
}
|
||||
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
public function validate(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
//Ensure that the part name fullfills the regex of the category
|
||||
if ($this->category instanceof Category) {
|
||||
|
|
|
@ -322,7 +322,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
}
|
||||
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
public function validate(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
//Ensure that the owner is not the anonymous user
|
||||
if ($this->getOwner() && $this->getOwner()->isAnonymousUser()) {
|
||||
|
|
|
@ -63,8 +63,7 @@ trait InstockTrait
|
|||
|
||||
/**
|
||||
* Get all part lots where this part is stored.
|
||||
*
|
||||
* @return PartLot[]|Collection
|
||||
* @phpstan-return Collection<int, PartLot>
|
||||
*/
|
||||
public function getPartLots(): Collection
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
trait OrderTrait
|
||||
{
|
||||
/**
|
||||
* @var Orderdetail[]|Collection the details about how and where you can order this part
|
||||
* @var Collection<int, Orderdetail> the details about how and where you can order this part
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
|
@ -66,7 +66,7 @@ trait OrderTrait
|
|||
/**
|
||||
* Get the selected order orderdetails of this part.
|
||||
*
|
||||
* @return Orderdetail the selected order orderdetails
|
||||
* @return Orderdetail|null the selected order orderdetails
|
||||
*/
|
||||
public function getOrderOrderdetails(): ?Orderdetail
|
||||
{
|
||||
|
|
|
@ -29,8 +29,9 @@ trait ProjectTrait
|
|||
protected ?Project $built_project = null;
|
||||
|
||||
/**
|
||||
* Returns all ProjectBOMEntries that use this part.
|
||||
* @return Collection<int, ProjectBOMEntry>|ProjectBOMEntry[]
|
||||
* Returns all ProjectBOMEntries that use this part.
|
||||
*
|
||||
* @phpstan-return Collection<int, ProjectBOMEntry>
|
||||
*/
|
||||
public function getProjectBomEntries(): Collection
|
||||
{
|
||||
|
|
|
@ -205,8 +205,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
/**
|
||||
* Get all pricedetails.
|
||||
*
|
||||
* @return Pricedetail[]|Collection all pricedetails as a one-dimensional array of Pricedetails objects,
|
||||
* sorted by minimum discount quantity
|
||||
* @return Collection<int, Pricedetail>
|
||||
*/
|
||||
public function getPricedetails(): Collection
|
||||
{
|
||||
|
|
|
@ -183,9 +183,6 @@ class Project extends AbstractStructuralDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ProjectBOMEntry>|ProjectBOMEntry[]
|
||||
*/
|
||||
public function getBomEntries(): Collection
|
||||
{
|
||||
return $this->bom_entries;
|
||||
|
@ -265,7 +262,7 @@ class Project extends AbstractStructuralDBElement
|
|||
}
|
||||
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
public function validate(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
//If this project has subprojects, and these have builds part, they must be included in the BOM
|
||||
foreach ($this->getChildren() as $child) {
|
||||
|
|
|
@ -139,9 +139,9 @@ class U2FKey implements LegacyU2FKeyInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the user, this U2F key belongs to.
|
||||
* Gets the user, this U2F key belongs to.
|
||||
*/
|
||||
public function getUser(): User
|
||||
public function getUser(): User|null
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
|
|
@ -468,9 +468,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the datetime when the password reset token expires.
|
||||
* Gets the datetime when the password reset token expires.
|
||||
*/
|
||||
public function getPwResetExpires(): \DateTimeInterface
|
||||
public function getPwResetExpires(): \DateTimeInterface|null
|
||||
{
|
||||
return $this->pw_reset_expires;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue