mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-13 20:04:34 +02:00
Fixed some more phpstan issues
This commit is contained in:
parent
2f46fbfc7a
commit
e8771ea118
77 changed files with 192 additions and 109 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue