Fixed some more phpstan issues

This commit is contained in:
Jan Böhmer 2023-06-18 00:00:58 +02:00
parent 2f46fbfc7a
commit e8771ea118
77 changed files with 192 additions and 109 deletions

View file

@ -242,7 +242,8 @@ abstract class Attachment extends AbstractNamedDBElement
/**
* Get the element, associated with this Attachment (for example a "Part" object).
*
* @return AttachmentContainingDBElement the associated Element
* @return AttachmentContainingDBElement|null the associated Element
* @phpstan-return T|null
*/
public function getElement(): ?AttachmentContainingDBElement
{
@ -360,7 +361,6 @@ abstract class Attachment extends AbstractNamedDBElement
/**
* Sets the element that is associated with this attachment.
*
* @return $this
*/
public function setElement(AttachmentContainingDBElement $element): self
@ -437,7 +437,7 @@ abstract class Attachment extends AbstractNamedDBElement
$tmp = explode('/', $path);
//Builtins must have a %PLACEHOLDER% construction
return in_array($tmp[0], static::BUILTIN_PLACEHOLDER, false);
return in_array($tmp[0], static::BUILTIN_PLACEHOLDER, true);
}
/**

View file

@ -28,12 +28,14 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a currency element.
* @extends Attachment<Currency>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]
class CurrencyAttachment extends Attachment
{
final public const ALLOWED_ELEMENT_CLASS = Currency::class;
/**
* @var Currency|null the element this attachment is associated with
*/

View file

@ -28,12 +28,14 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a footprint element.
* @extends Attachment<Footprint>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]
class FootprintAttachment extends Attachment
{
final public const ALLOWED_ELEMENT_CLASS = Footprint::class;
/**
* @var Footprint|null the element this attachment is associated with
*/

View file

@ -28,6 +28,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a Group element.
* @extends Attachment<Group>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -47,6 +47,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* A attachment attached to a user element.
* @extends Attachment<LabelProfile>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -28,6 +28,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a manufacturer element.
* @extends Attachment<Manufacturer>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -29,6 +29,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a measurement unit element.
* @extends Attachment<MeasurementUnit>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -28,6 +28,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* A attachment attached to a part element.
* @extends Attachment<Part>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -28,6 +28,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* A attachment attached to a device element.
* @extends Attachment<Project>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -28,6 +28,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a measurement unit element.
* @extends Attachment<Storelocation>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -28,6 +28,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* A attachment attached to a supplier element.
* @extends Attachment<Supplier>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]

View file

@ -28,6 +28,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a user element.
* @extends Attachment<User>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]