mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed some psalm issues.
This commit is contained in:
parent
eb9b24d5d7
commit
cb0aa7bc7a
32 changed files with 217 additions and 148 deletions
|
@ -64,6 +64,7 @@
|
|||
"phpstan/phpstan": "^0.12.8",
|
||||
"phpstan/phpstan-doctrine": "^0.12.9",
|
||||
"phpstan/phpstan-symfony": "^0.12.4",
|
||||
"psalm/plugin-symfony": "^1.1",
|
||||
"roave/security-advisories": "dev-master",
|
||||
"symfony/debug-pack": "*",
|
||||
"symfony/maker-bundle": "^1.13",
|
||||
|
|
87
composer.lock
generated
87
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "fd11975fb4135f47bdb119fec531a868",
|
||||
"content-hash": "482b6aa7bcf3371c734025dc6f151ac1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "beberlei/assert",
|
||||
|
@ -10465,6 +10465,55 @@
|
|||
"description": "Symfony Framework extensions and rules for PHPStan",
|
||||
"time": "2020-01-22T10:19:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psalm/plugin-symfony",
|
||||
"version": "v1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/psalm/psalm-plugin-symfony.git",
|
||||
"reference": "c2b2dd4ae70bf269023e22efd15b7b31f7efe51d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/psalm/psalm-plugin-symfony/zipball/c2b2dd4ae70bf269023e22efd15b7b31f7efe51d",
|
||||
"reference": "c2b2dd4ae70bf269023e22efd15b7b31f7efe51d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-simplexml": "*",
|
||||
"php": "^7.1",
|
||||
"symfony/framework-bundle": "^3.0 || ^4.0 || ^5.0",
|
||||
"vimeo/psalm": "^3.7"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/base": "^2.5",
|
||||
"phpunit/phpunit": "~7.5",
|
||||
"weirdan/codeception-psalm-module": "^0.2.2"
|
||||
},
|
||||
"type": "psalm-plugin",
|
||||
"extra": {
|
||||
"psalm": {
|
||||
"pluginClass": "Psalm\\SymfonyPsalmPlugin\\Plugin"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psalm\\SymfonyPsalmPlugin\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Farhad Safarov",
|
||||
"email": "farhad.safarov@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Psalm Plugin for Symfony",
|
||||
"time": "2020-03-15T10:38:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "roave/security-advisories",
|
||||
"version": "dev-master",
|
||||
|
@ -11353,12 +11402,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symplify/auto-bind-parameter.git",
|
||||
"reference": "8b85fc72fddc953feda56c3d06252eb1fafb21ef"
|
||||
"reference": "ac4d0fff0159becdf0044641b9eb48e89afe1480"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symplify/auto-bind-parameter/zipball/8b85fc72fddc953feda56c3d06252eb1fafb21ef",
|
||||
"reference": "8b85fc72fddc953feda56c3d06252eb1fafb21ef",
|
||||
"url": "https://api.github.com/repos/symplify/auto-bind-parameter/zipball/ac4d0fff0159becdf0044641b9eb48e89afe1480",
|
||||
"reference": "ac4d0fff0159becdf0044641b9eb48e89afe1480",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -11395,12 +11444,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symplify/autowire-array-parameter.git",
|
||||
"reference": "53ae1541e9eca16bd5bae95d627a442092933585"
|
||||
"reference": "e36a0d7e2e4b0a3764c192ac9cca1b2860255eda"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symplify/autowire-array-parameter/zipball/53ae1541e9eca16bd5bae95d627a442092933585",
|
||||
"reference": "53ae1541e9eca16bd5bae95d627a442092933585",
|
||||
"url": "https://api.github.com/repos/symplify/autowire-array-parameter/zipball/e36a0d7e2e4b0a3764c192ac9cca1b2860255eda",
|
||||
"reference": "e36a0d7e2e4b0a3764c192ac9cca1b2860255eda",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -11437,12 +11486,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symplify/coding-standard.git",
|
||||
"reference": "084c7ba3b6cc62f8a271da3a4192f663bc12ff2e"
|
||||
"reference": "3eebdd4e08ebac565461a06c29e28198996bf1c4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symplify/coding-standard/zipball/084c7ba3b6cc62f8a271da3a4192f663bc12ff2e",
|
||||
"reference": "084c7ba3b6cc62f8a271da3a4192f663bc12ff2e",
|
||||
"url": "https://api.github.com/repos/symplify/coding-standard/zipball/3eebdd4e08ebac565461a06c29e28198996bf1c4",
|
||||
"reference": "3eebdd4e08ebac565461a06c29e28198996bf1c4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -11558,12 +11607,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symplify/package-builder.git",
|
||||
"reference": "9d9b5f8f07058aaeb59ba53bfae52226b3b47236"
|
||||
"reference": "1cddbbfa94c1d78a380c6b3996d09eb7c5710560"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symplify/package-builder/zipball/9d9b5f8f07058aaeb59ba53bfae52226b3b47236",
|
||||
"reference": "9d9b5f8f07058aaeb59ba53bfae52226b3b47236",
|
||||
"url": "https://api.github.com/repos/symplify/package-builder/zipball/1cddbbfa94c1d78a380c6b3996d09eb7c5710560",
|
||||
"reference": "1cddbbfa94c1d78a380c6b3996d09eb7c5710560",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -11604,12 +11653,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symplify/set-config-resolver.git",
|
||||
"reference": "561486147349cb07b5692708748ece68c31bf041"
|
||||
"reference": "03f58a1cfcb0018c833a0b8d7210ebf652b5d3f1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symplify/set-config-resolver/zipball/561486147349cb07b5692708748ece68c31bf041",
|
||||
"reference": "561486147349cb07b5692708748ece68c31bf041",
|
||||
"url": "https://api.github.com/repos/symplify/set-config-resolver/zipball/03f58a1cfcb0018c833a0b8d7210ebf652b5d3f1",
|
||||
"reference": "03f58a1cfcb0018c833a0b8d7210ebf652b5d3f1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -11647,12 +11696,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symplify/smart-file-system.git",
|
||||
"reference": "9f6320c3b22c81e85f51aabf66c927bbf4d8c20f"
|
||||
"reference": "d81f1b5ffa083713c49e0308e0f94be7ff4b55fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symplify/smart-file-system/zipball/9f6320c3b22c81e85f51aabf66c927bbf4d8c20f",
|
||||
"reference": "9f6320c3b22c81e85f51aabf66c927bbf4d8c20f",
|
||||
"url": "https://api.github.com/repos/symplify/smart-file-system/zipball/d81f1b5ffa083713c49e0308e0f94be7ff4b55fc",
|
||||
"reference": "d81f1b5ffa083713c49e0308e0f94be7ff4b55fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
59
psalm.xml
59
psalm.xml
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="5"
|
||||
totallyTyped="false"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
|
@ -7,49 +8,49 @@
|
|||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<directory name="src"/>
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
<directory name="vendor"/>
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
|
||||
<issueHandlers>
|
||||
<LessSpecificReturnType errorLevel="info" />
|
||||
<LessSpecificReturnType errorLevel="info"/>
|
||||
|
||||
<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives -->
|
||||
|
||||
<DeprecatedMethod errorLevel="info" />
|
||||
<DeprecatedProperty errorLevel="info" />
|
||||
<DeprecatedClass errorLevel="info" />
|
||||
<DeprecatedConstant errorLevel="info" />
|
||||
<DeprecatedFunction errorLevel="info" />
|
||||
<DeprecatedInterface errorLevel="info" />
|
||||
<DeprecatedTrait errorLevel="info" />
|
||||
<DeprecatedMethod errorLevel="info"/>
|
||||
<DeprecatedProperty errorLevel="info"/>
|
||||
<DeprecatedClass errorLevel="info"/>
|
||||
<DeprecatedConstant errorLevel="info"/>
|
||||
<DeprecatedFunction errorLevel="info"/>
|
||||
<DeprecatedInterface errorLevel="info"/>
|
||||
<DeprecatedTrait errorLevel="info"/>
|
||||
|
||||
<InternalMethod errorLevel="info" />
|
||||
<InternalProperty errorLevel="info" />
|
||||
<InternalClass errorLevel="info" />
|
||||
<InternalMethod errorLevel="info"/>
|
||||
<InternalProperty errorLevel="info"/>
|
||||
<InternalClass errorLevel="info"/>
|
||||
|
||||
<MissingClosureReturnType errorLevel="info" />
|
||||
<MissingReturnType errorLevel="info" />
|
||||
<MissingPropertyType errorLevel="info" />
|
||||
<InvalidDocblock errorLevel="info" />
|
||||
<MisplacedRequiredParam errorLevel="info" />
|
||||
<MissingClosureReturnType errorLevel="info"/>
|
||||
<MissingReturnType errorLevel="info"/>
|
||||
<MissingPropertyType errorLevel="info"/>
|
||||
<InvalidDocblock errorLevel="info"/>
|
||||
<MisplacedRequiredParam errorLevel="info"/>
|
||||
|
||||
<PropertyNotSetInConstructor errorLevel="info" />
|
||||
<MissingConstructor errorLevel="info" />
|
||||
<MissingClosureParamType errorLevel="info" />
|
||||
<MissingParamType errorLevel="info" />
|
||||
<PropertyNotSetInConstructor errorLevel="info"/>
|
||||
<MissingConstructor errorLevel="info"/>
|
||||
<MissingClosureParamType errorLevel="info"/>
|
||||
<MissingParamType errorLevel="info"/>
|
||||
|
||||
<RedundantCondition errorLevel="info" />
|
||||
<RedundantCondition errorLevel="info"/>
|
||||
|
||||
<DocblockTypeContradiction errorLevel="info" />
|
||||
<RedundantConditionGivenDocblockType errorLevel="info" />
|
||||
<DocblockTypeContradiction errorLevel="info"/>
|
||||
<RedundantConditionGivenDocblockType errorLevel="info"/>
|
||||
|
||||
<UnresolvableInclude errorLevel="info" />
|
||||
<UnresolvableInclude errorLevel="info"/>
|
||||
|
||||
<RawObjectIteration errorLevel="info" />
|
||||
<RawObjectIteration errorLevel="info"/>
|
||||
|
||||
<InvalidStringClass errorLevel="info" />
|
||||
<InvalidStringClass errorLevel="info"/>
|
||||
</issueHandlers>
|
||||
</psalm>
|
||||
<plugins><pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/></plugins></psalm>
|
||||
|
|
|
@ -43,7 +43,7 @@ declare(strict_types=1);
|
|||
namespace App\DataFixtures;
|
||||
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
class AppFixtures extends Fixture
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ use App\Entity\Parts\MeasurementUnit;
|
|||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace App\DataFixtures;
|
|||
|
||||
use App\Entity\UserSystem\Group;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
class GroupFixtures extends Fixture
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace App\DataFixtures;
|
|||
|
||||
use App\Entity\UserSystem\User;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class FetchJoinORMAdapter extends ORMAdapter
|
|||
}
|
||||
}
|
||||
|
||||
public function getCount(QueryBuilder $queryBuilder, $identifier)
|
||||
public function getCount(QueryBuilder $queryBuilder, string $identifier)
|
||||
{
|
||||
$paginator = new Paginator($queryBuilder);
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ class ORMAdapter extends AbstractAdapter
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getCount(QueryBuilder $queryBuilder, $identifier)
|
||||
protected function getCount(QueryBuilder $queryBuilder, string $identifier)
|
||||
{
|
||||
$qb = clone $queryBuilder;
|
||||
|
||||
|
|
|
@ -56,13 +56,13 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
*/
|
||||
protected $filetype_filter = '';
|
||||
/**
|
||||
* @var Collection<AttachmentTypeAttachment>
|
||||
* @var Collection<int, AttachmentTypeAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<AttachmentTypeParameter>
|
||||
/** @var Collection<int, AttachmentTypeParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
@ -70,7 +70,7 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
protected $parameters;
|
||||
|
||||
/**
|
||||
* @var Collection|Attachment[]
|
||||
* @var Collection<int, Attachment>
|
||||
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachment_type")
|
||||
*/
|
||||
protected $attachments_with_type;
|
||||
|
|
|
@ -93,12 +93,12 @@ class Device extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $order_only_missing_parts = false;
|
||||
/**
|
||||
* @var Collection<DeviceAttachment>
|
||||
* @var Collection<int, DeviceAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<DeviceParameter>
|
||||
/** @var Collection<int, DeviceParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\DeviceParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
*/
|
||||
|
|
|
@ -37,11 +37,13 @@ trait ParametersTrait
|
|||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Return all associated specifications.
|
||||
* Return all associated specifications.
|
||||
*
|
||||
* @return Collection<AbstractParameter>
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*
|
||||
* @psalm-return \Doctrine\Common\Collections\Collection<int, PartParameter>
|
||||
*/
|
||||
public function getParameters(): Collection
|
||||
public function getParameters(): \Doctrine\Common\Collections\Collection
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
|
|
@ -101,13 +101,13 @@ class Category extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $default_comment = '';
|
||||
/**
|
||||
* @var Collection|CategoryAttachment[]
|
||||
* @var Collection<int, CategoryAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection|CategoryParameter[]
|
||||
/** @var Collection<int, CategoryParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -81,7 +81,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parts;
|
||||
/**
|
||||
* @var Collection<FootprintAttachment>
|
||||
* @var Collection<int, FootprintAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
@ -94,7 +94,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $footprint_3d;
|
||||
|
||||
/** @var Collection<FootprintParameter>
|
||||
/** @var Collection<int, FootprintParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})@ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -81,13 +81,13 @@ class Manufacturer extends AbstractCompany
|
|||
*/
|
||||
protected $parts;
|
||||
/**
|
||||
* @var Collection<ManufacturerAttachment>
|
||||
* @var Collection<int, ManufacturerAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<ManufacturerParameter>
|
||||
/** @var Collection<int, ManufacturerParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -98,13 +98,13 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parts;
|
||||
/**
|
||||
* @var Collection<MeasurementUnitAttachment>
|
||||
* @var Collection<int, MeasurementUnitAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<MeasurementUnitParameter>
|
||||
/** @var Collection<int, MeasurementUnitParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -92,7 +92,7 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
protected $devices = [];
|
||||
|
||||
/** @var Collection<PartParameter>
|
||||
/** @var Collection<int, PartParameter>
|
||||
* @Assert\Valid()
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
|
@ -119,7 +119,7 @@ class Part extends AttachmentContainingDBElement
|
|||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var Collection<PartAttachment>
|
||||
* @var Collection<int, PartAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ColumnSecurity(type="collection", prefix="attachments")
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -92,7 +92,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parts;
|
||||
|
||||
/** @var Collection<StorelocationParameter>
|
||||
/** @var Collection<int, StorelocationParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
@ -117,7 +117,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $limit_to_existing_parts = false;
|
||||
/**
|
||||
* @var Collection<StorelocationAttachment>
|
||||
* @var Collection<int, StorelocationAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
|
|
@ -109,13 +109,13 @@ class Supplier extends AbstractCompany
|
|||
protected $parts;
|
||||
|
||||
/**
|
||||
* @var Collection<SupplierAttachment>
|
||||
* @var Collection<int, SupplierAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<SupplierParameter>
|
||||
/** @var Collection<int, SupplierParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -88,13 +88,13 @@ class Currency extends AbstractStructuralDBElement
|
|||
protected $parent;
|
||||
|
||||
/**
|
||||
* @var Collection<CurrencyAttachment>
|
||||
* @var Collection<int, CurrencyAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
|
||||
/** @var Collection<CurrencyParameter>
|
||||
/** @var Collection<int, CurrencyParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -136,11 +136,11 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*********************************************************************************/
|
||||
|
||||
/**
|
||||
* Get the orderdetail to which this pricedetail belongs to this pricedetails.
|
||||
* Get the orderdetail to which this pricedetail belongs to this pricedetails.
|
||||
*
|
||||
* @return Orderdetail the orderdetail this price belongs to
|
||||
* @return Orderdetail|null the orderdetail this price belongs to
|
||||
*/
|
||||
public function getOrderdetail(): Orderdetail
|
||||
public function getOrderdetail(): ?Orderdetail
|
||||
{
|
||||
return $this->orderdetail;
|
||||
}
|
||||
|
@ -157,17 +157,20 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the price for a single unit in the currency associated with this price detail.
|
||||
* Get the price for a single unit in the currency associated with this price detail.
|
||||
*
|
||||
* @param float|string $multiplier The returned price (float or string) will be multiplied
|
||||
* with this multiplier.
|
||||
*
|
||||
* You will get the price for $multiplier parts. If you want the price which is stored
|
||||
* in the database, you have to pass the "price_related_quantity" count as $multiplier.
|
||||
*
|
||||
* @param float|string $multiplier The returned price (float or string) will be multiplied
|
||||
* with this multiplier.
|
||||
*
|
||||
* You will get the price for $multiplier parts. If you want the price which is stored
|
||||
* in the database, you have to pass the "price_related_quantity" count as $multiplier.
|
||||
*
|
||||
* @return string the price as a bcmath string
|
||||
* @return null|string the price as a bcmath string
|
||||
*/
|
||||
public function getPricePerUnit($multiplier = 1.0): string
|
||||
public function getPricePerUnit($multiplier = 1.0): ?string
|
||||
{
|
||||
$multiplier = (string) $multiplier;
|
||||
$tmp = bcmul($this->price, $multiplier, static::PRICE_PRECISION);
|
||||
|
|
|
@ -81,7 +81,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
*/
|
||||
protected $enforce2FA = false;
|
||||
/**
|
||||
* @var Collection<GroupAttachment>
|
||||
* @var Collection<int, GroupAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
*/
|
||||
protected $permissions;
|
||||
|
||||
/** @var Collection<GroupParameter>
|
||||
/** @var Collection<int, GroupParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
|
|
|
@ -227,7 +227,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected $settings = [];
|
||||
|
||||
/**
|
||||
* @var Collection|UserAttachment[]
|
||||
* @var Collection<int, UserAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\UserAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $attachments;
|
||||
|
@ -237,7 +237,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
protected $backupCodesGenerationDate;
|
||||
|
||||
/** @var Collection<TwoFactorKeyInterface>
|
||||
/** @var Collection<int, TwoFactorKeyInterface>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $u2fKeys;
|
||||
|
@ -862,9 +862,11 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all U2F Keys that are associated with this user.
|
||||
* Get all U2F Keys that are associated with this user.
|
||||
*
|
||||
* @return Collection<TwoFactorKeyInterface>
|
||||
* @return Collection
|
||||
*
|
||||
* @psalm-return Collection<int, TwoFactorKeyInterface>
|
||||
*/
|
||||
public function getU2FKeys(): Collection
|
||||
{
|
||||
|
|
|
@ -283,7 +283,7 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
}, ARRAY_FILTER_USE_BOTH);
|
||||
}
|
||||
|
||||
protected function saveChangeSet(AbstractDBElement $entity, AbstractLogEntry $logEntry, EntityManagerInterface $em, $element_deleted = false): void
|
||||
protected function saveChangeSet(AbstractDBElement $entity, AbstractLogEntry $logEntry, EntityManagerInterface $em, bool $element_deleted = false): void
|
||||
{
|
||||
$uow = $em->getUnitOfWork();
|
||||
|
||||
|
|
|
@ -153,37 +153,37 @@ class StructuralEntityType extends AbstractType
|
|||
}
|
||||
|
||||
/**
|
||||
* Transforms a value from the original representation to a transformed representation.
|
||||
* Transforms a value from the original representation to a transformed representation.
|
||||
*
|
||||
* This method is called when the form field is initialized with its default data, on
|
||||
* two occasions for two types of transformers:
|
||||
* This method is called when the form field is initialized with its default data, on
|
||||
* two occasions for two types of transformers:
|
||||
*
|
||||
* 1. Model transformers which normalize the model data.
|
||||
* This is mainly useful when the same form type (the same configuration)
|
||||
* has to handle different kind of underlying data, e.g The DateType can
|
||||
* deal with strings or \DateTime objects as input.
|
||||
* 1. Model transformers which normalize the model data.
|
||||
* This is mainly useful when the same form type (the same configuration)
|
||||
* has to handle different kind of underlying data, e.g The DateType can
|
||||
* deal with strings or \DateTime objects as input.
|
||||
*
|
||||
* 2. View transformers which adapt the normalized data to the view format.
|
||||
* a/ When the form is simple, the value returned by convention is used
|
||||
* directly in the view and thus can only be a string or an array. In
|
||||
* this case the data class should be null.
|
||||
* 2. View transformers which adapt the normalized data to the view format.
|
||||
* a/ When the form is simple, the value returned by convention is used
|
||||
* directly in the view and thus can only be a string or an array. In
|
||||
* this case the data class should be null.
|
||||
*
|
||||
* b/ When the form is compound the returned value should be an array or
|
||||
* an object to be mapped to the children. Each property of the compound
|
||||
* data will be used as model data by each child and will be transformed
|
||||
* too. In this case data class should be the class of the object, or null
|
||||
* when it is an array.
|
||||
* b/ When the form is compound the returned value should be an array or
|
||||
* an object to be mapped to the children. Each property of the compound
|
||||
* data will be used as model data by each child and will be transformed
|
||||
* too. In this case data class should be the class of the object, or null
|
||||
* when it is an array.
|
||||
*
|
||||
* All transformers are called in a configured order from model data to view value.
|
||||
* At the end of this chain the view data will be validated against the data class
|
||||
* setting.
|
||||
* All transformers are called in a configured order from model data to view value.
|
||||
* At the end of this chain the view data will be validated against the data class
|
||||
* setting.
|
||||
*
|
||||
* This method must be able to deal with empty values. Usually this will
|
||||
* be NULL, but depending on your implementation other empty values are
|
||||
* possible as well (such as empty strings). The reasoning behind this is
|
||||
* that data transformers must be chainable. If the transform() method
|
||||
* of the first data transformer outputs NULL, the second must be able to
|
||||
* process that value.
|
||||
* This method must be able to deal with empty values. Usually this will
|
||||
* be NULL, but depending on your implementation other empty values are
|
||||
* possible as well (such as empty strings). The reasoning behind this is
|
||||
* that data transformers must be chainable. If the transform() method
|
||||
* of the first data transformer outputs NULL, the second must be able to
|
||||
* process that value.
|
||||
*
|
||||
* @param mixed $value The value in the original representation
|
||||
*
|
||||
|
@ -191,31 +191,31 @@ class StructuralEntityType extends AbstractType
|
|||
*
|
||||
* @throws TransformationFailedException when the transformation fails
|
||||
*/
|
||||
public function transform($value, $options)
|
||||
public function transform($value, array $options)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a value from the transformed representation to its original
|
||||
* representation.
|
||||
* Transforms a value from the transformed representation to its original
|
||||
* representation.
|
||||
*
|
||||
* This method is called when {@link Form::submit()} is called to transform the requests tainted data
|
||||
* into an acceptable format.
|
||||
* This method is called when {@link Form::submit()} is called to transform the requests tainted data
|
||||
* into an acceptable format.
|
||||
*
|
||||
* The same transformers are called in the reverse order so the responsibility is to
|
||||
* return one of the types that would be expected as input of transform().
|
||||
* The same transformers are called in the reverse order so the responsibility is to
|
||||
* return one of the types that would be expected as input of transform().
|
||||
*
|
||||
* This method must be able to deal with empty values. Usually this will
|
||||
* be an empty string, but depending on your implementation other empty
|
||||
* values are possible as well (such as NULL). The reasoning behind
|
||||
* this is that value transformers must be chainable. If the
|
||||
* reverseTransform() method of the first value transformer outputs an
|
||||
* empty string, the second value transformer must be able to process that
|
||||
* value.
|
||||
* This method must be able to deal with empty values. Usually this will
|
||||
* be an empty string, but depending on your implementation other empty
|
||||
* values are possible as well (such as NULL). The reasoning behind
|
||||
* this is that value transformers must be chainable. If the
|
||||
* reverseTransform() method of the first value transformer outputs an
|
||||
* empty string, the second value transformer must be able to process that
|
||||
* value.
|
||||
*
|
||||
* By convention, reverseTransform() should return NULL if an empty string
|
||||
* is passed.
|
||||
* By convention, reverseTransform() should return NULL if an empty string
|
||||
* is passed.
|
||||
*
|
||||
* @param mixed $value The value in the transformed representation
|
||||
*
|
||||
|
@ -223,7 +223,7 @@ class StructuralEntityType extends AbstractType
|
|||
*
|
||||
* @throws TransformationFailedException when the transformation fails
|
||||
*/
|
||||
public function reverseTransform($value, $options)
|
||||
public function reverseTransform($value, array $options)
|
||||
{
|
||||
/* This step is important in combination with the caching!
|
||||
The elements deserialized from cache, are not known to Doctrinte ORM any more, so doctrine thinks,
|
||||
|
|
|
@ -50,7 +50,7 @@ class DBElementRepository extends EntityRepository
|
|||
$this->setField($element, 'id', $new_id);
|
||||
}
|
||||
|
||||
protected function setField(AbstractDBElement $element, string $field, $new_value): void
|
||||
protected function setField(AbstractDBElement $element, string $field, int $new_value): void
|
||||
{
|
||||
$reflection = new \ReflectionClass(get_class($element));
|
||||
$property = $reflection->getProperty($field);
|
||||
|
|
|
@ -60,7 +60,10 @@ class AmountFormatter
|
|||
}
|
||||
|
||||
/**
|
||||
* Formats the given value using the measurement unit and options.
|
||||
* Formats the given value using the measurement unit and options.
|
||||
*
|
||||
* @param MeasurementUnit|null $unit The measurement unit, whose unit symbol should be used for formatting.
|
||||
* If set to null, it is assumed that the part amount is measured in pieces.
|
||||
*
|
||||
* @param MeasurementUnit|null $unit The measurement unit, whose unit symbol should be used for formatting.
|
||||
* If set to null, it is assumed that the part amount is measured in pieces.
|
||||
|
@ -69,7 +72,7 @@ class AmountFormatter
|
|||
*
|
||||
* @throws InvalidArgumentException thrown if $value is not numeric
|
||||
*/
|
||||
public function format($value, ?MeasurementUnit $unit = null, array $options = [])
|
||||
public function format(float $value, ?MeasurementUnit $unit = null, array $options = [])
|
||||
{
|
||||
if (! is_numeric($value)) {
|
||||
throw new InvalidArgumentException('$value must be an numeric value!');
|
||||
|
|
|
@ -55,13 +55,15 @@ class PartPreviewGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a list of attachments that can be used for previewing the part ordered by priority.
|
||||
* The priority is: Part MasterAttachment -> Footprint MasterAttachment -> Category MasterAttachment
|
||||
* -> Storelocation Attachment -> MeasurementUnit Attachment -> ManufacturerAttachment.
|
||||
* Returns a list of attachments that can be used for previewing the part ordered by priority.
|
||||
* The priority is: Part MasterAttachment -> Footprint MasterAttachment -> Category MasterAttachment
|
||||
* -> Storelocation Attachment -> MeasurementUnit Attachment -> ManufacturerAttachment.
|
||||
*
|
||||
* @param Part $part the part for which the attachments should be determined
|
||||
*
|
||||
* @return Attachment[]
|
||||
* @return (Attachment|null)[]
|
||||
*
|
||||
* @psalm-return list<Attachment|null>
|
||||
*/
|
||||
public function getPreviewAttachments(Part $part): array
|
||||
{
|
||||
|
|
|
@ -77,9 +77,10 @@ class EntityExporter
|
|||
}
|
||||
|
||||
/**
|
||||
* Exports an Entity or an array of entities to multiple file formats.
|
||||
* Exports an Entity or an array of entities to multiple file formats.
|
||||
*
|
||||
* @param Request $request the request that should be used for option resolving
|
||||
* @param AbstractNamedDBElement|object[] $entity
|
||||
*
|
||||
* @return Response the generated response containing the exported data
|
||||
*
|
||||
|
|
|
@ -187,7 +187,7 @@ class EntityURLGenerator
|
|||
throw new EntityNotSupportedException('The given entity is not supported yet!');
|
||||
}
|
||||
|
||||
public function viewURL($entity): string
|
||||
public function viewURL(Attachment $entity): ?string
|
||||
{
|
||||
if ($entity instanceof Attachment) {
|
||||
if ($entity->isExternal()) { //For external attachments, return the link to external path
|
||||
|
@ -201,7 +201,7 @@ class EntityURLGenerator
|
|||
throw new EntityNotSupportedException('The given entity is not supported yet!');
|
||||
}
|
||||
|
||||
public function downloadURL($entity): string
|
||||
public function downloadURL($entity): ?string
|
||||
{
|
||||
if ($entity instanceof Attachment) {
|
||||
if ($entity->isExternal()) { //For external attachments, return the link to external path
|
||||
|
|
|
@ -35,10 +35,12 @@ class HistoryHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all elements that are associated with the argument.
|
||||
* The returned array contains the given element.
|
||||
* Returns an array containing all elements that are associated with the argument.
|
||||
* The returned array contains the given element.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @psalm-return array<\App\Entity\Parameters\AbstractParameter|array-key, mixed>
|
||||
*/
|
||||
public function getAssociatedElements(AbstractDBElement $element): array
|
||||
{
|
||||
|
|
|
@ -209,6 +209,9 @@ class TimeTravel
|
|||
return $property->getValue($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime|int|null $new_value
|
||||
*/
|
||||
protected function setField(AbstractDBElement $element, string $field, $new_value): void
|
||||
{
|
||||
$reflection = new \ReflectionClass(get_class($element));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue