Improved typing and phpdoc type annotations

This commit is contained in:
Jan Böhmer 2023-06-18 15:37:42 +02:00
parent 3817ba774d
commit b7c8ca2a48
39 changed files with 189 additions and 129 deletions

View file

@ -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) {

View file

@ -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()) {

View file

@ -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
{

View file

@ -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
{

View file

@ -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
{