Fixed inspection issues

This commit is contained in:
Jan Böhmer 2023-04-15 21:49:19 +02:00
parent 5f29ee9052
commit de96aae9a5
36 changed files with 55 additions and 53 deletions

View file

@ -106,10 +106,8 @@ class AttachmentFileController extends AbstractController
/**
* @Route("/attachment/list", name="attachment_list")
*
* @return JsonResponse|Response
*/
public function attachmentsTable(Request $request, DataTableFactory $dataTableFactory, NodesListBuilder $nodesListBuilder)
public function attachmentsTable(Request $request, DataTableFactory $dataTableFactory, NodesListBuilder $nodesListBuilder): Response
{
$this->denyAccessUnlessGranted('@attachments.list_attachments');

View file

@ -64,9 +64,9 @@ class LogController extends AbstractController
/**
* @Route("/", name="log_view")
*
* @return JsonResponse|Response
* @return Response
*/
public function showLogs(Request $request, DataTableFactory $dataTable)
public function showLogs(Request $request, DataTableFactory $dataTable): Response
{
$this->denyAccessUnlessGranted('@system.show_logs');

View file

@ -158,7 +158,7 @@ class PartListsController extends AbstractController
*
* @return JsonResponse|Response
*/
public function showCategory(Category $category, Request $request)
public function showCategory(Category $category, Request $request): Response
{
$this->denyAccessUnlessGranted('@categories.read');
@ -180,7 +180,7 @@ class PartListsController extends AbstractController
*
* @return JsonResponse|Response
*/
public function showFootprint(Footprint $footprint, Request $request)
public function showFootprint(Footprint $footprint, Request $request): Response
{
$this->denyAccessUnlessGranted('@footprints.read');
@ -202,7 +202,7 @@ class PartListsController extends AbstractController
*
* @return JsonResponse|Response
*/
public function showManufacturer(Manufacturer $manufacturer, Request $request)
public function showManufacturer(Manufacturer $manufacturer, Request $request): Response
{
$this->denyAccessUnlessGranted('@manufacturers.read');
@ -224,7 +224,7 @@ class PartListsController extends AbstractController
*
* @return JsonResponse|Response
*/
public function showStorelocation(Storelocation $storelocation, Request $request)
public function showStorelocation(Storelocation $storelocation, Request $request): Response
{
$this->denyAccessUnlessGranted('@storelocations.read');
@ -246,7 +246,7 @@ class PartListsController extends AbstractController
*
* @return JsonResponse|Response
*/
public function showSupplier(Supplier $supplier, Request $request)
public function showSupplier(Supplier $supplier, Request $request): Response
{
$this->denyAccessUnlessGranted('@suppliers.read');
@ -268,7 +268,7 @@ class PartListsController extends AbstractController
*
* @return JsonResponse|Response
*/
public function showTag(string $tag, Request $request, DataTableFactory $dataTable)
public function showTag(string $tag, Request $request): Response
{
$tag = trim($tag);
@ -310,7 +310,7 @@ class PartListsController extends AbstractController
*
* @return JsonResponse|Response
*/
public function showSearch(Request $request, DataTableFactory $dataTable)
public function showSearch(Request $request, DataTableFactory $dataTable): Response
{
$searchFilter = $this->searchRequestToFilter($request);
@ -331,9 +331,9 @@ class PartListsController extends AbstractController
/**
* @Route("/parts", name="parts_show_all")
*
* @return JsonResponse|Response
* @return Response
*/
public function showAll(Request $request, DataTableFactory $dataTable)
public function showAll(Request $request): Response
{
return $this->showListWithFilter($request,'parts/lists/all_list.html.twig');
}

View file

@ -225,7 +225,7 @@ class UserSettingsController extends AbstractController
*/
public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper)
{
/** @var User */
/** @var User $user */
$user = $this->getUser();
$page_need_reload = false;

View file

@ -42,7 +42,7 @@ class NumberConstraint extends AbstractConstraint
protected $value2;
/**
* @var string The operator to use
* @var string|null The operator to use
*/
protected ?string $operator;

View file

@ -148,9 +148,9 @@ class PartFilter implements FilterInterface
/**
* @return BooleanConstraint|false
* @return BooleanConstraint
*/
public function getFavorite()
public function getFavorite(): BooleanConstraint
{
return $this->favorite;
}

View file

@ -116,7 +116,7 @@ abstract class Attachment extends AbstractNamedDBElement
protected bool $show_in_table = false;
/**
* @var AttachmentType
* @var AttachmentType|null
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type")
* @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false)
* @Selectable()

View file

@ -35,7 +35,7 @@ class AttachmentTypeAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
/**
* @var AttachmentType the element this attachment is associated with
* @var AttachmentContainingDBElement|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -36,7 +36,7 @@ class CategoryAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Category::class;
/**
* @var Category the element this attachment is associated with
* @var AttachmentContainingDBElement|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -36,7 +36,7 @@ class CurrencyAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Currency::class;
/**
* @var Currency the element this attachment is associated with
* @var Currency|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -36,7 +36,7 @@ class FootprintAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Footprint::class;
/**
* @var Footprint the element this attachment is associated with
* @var Footprint|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
class GroupAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Group::class;
/**
* @var Group the element this attachment is associated with
* @var Group|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
class ManufacturerAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
/**
* @var Manufacturer the element this attachment is associated with
* @var Manufacturer|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -37,7 +37,7 @@ class MeasurementUnitAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
/**
* @var Manufacturer the element this attachment is associated with
* @var Manufacturer|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -36,7 +36,7 @@ class ProjectAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Project::class;
/**
* @var Project the element this attachment is associated with
* @var Project|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
class StorelocationAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
/**
* @var Storelocation the element this attachment is associated with
* @var Storelocation|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
class SupplierAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Supplier::class;
/**
* @var Supplier the element this attachment is associated with
* @var Supplier|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
class UserAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = User::class;
/**
* @var User the element this attachment is associated with
* @var User|null the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/

View file

@ -32,7 +32,7 @@ use Symfony\Component\Validator\Constraints as Assert;
trait MasterAttachmentTrait
{
/**
* @var Attachment
* @var Attachment|null
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true)
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")

View file

@ -142,7 +142,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
self::TARGET_TYPE_LABEL_PROFILE => LabelProfile::class,
];
/** @var User The user which has caused this log entry
/** @var User|null The user which has caused this log entry
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", fetch="EAGER")
* @ORM\JoinColumn(name="id_user", nullable=true, onDelete="SET NULL")
*/

View file

@ -103,13 +103,13 @@ class Part extends AttachmentContainingDBElement
protected $attachments;
/**
* @var DateTime the date when this element was modified the last time
* @var DateTime|null the date when this element was modified the last time
* @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"})
*/
protected ?DateTime $lastModified = null;
/**
* @var Attachment
* @var Attachment|null
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true)
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")

View file

@ -55,7 +55,7 @@ trait AdvancedPropertyTrait
protected ?float $mass = null;
/**
* @var string The internal part number of the part
* @var string|null The internal part number of the part
* @ORM\Column(type="string", length=100, nullable=true, unique=true)
* @Assert\Length(max="100")
* @Groups({"extended", "full", "import"})

View file

@ -59,7 +59,7 @@ trait BasicPropertyTrait
protected bool $favorite = false;
/**
* @var Category The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping.
* @var Category|null The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping.
* Every part must have a category.
* @ORM\ManyToOne(targetEntity="Category")
* @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false)

View file

@ -59,7 +59,7 @@ trait ManufacturerTrait
protected string $manufacturer_product_number = '';
/**
* @var string The production status of this part. Can be one of the specified ones.
* @var string|null The production status of this part. Can be one of the specified ones.
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
* @Groups({"extended", "full", "import"})

View file

@ -57,7 +57,7 @@ trait OrderTrait
protected bool $manual_order = false;
/**
* @var Orderdetail
* @var Orderdetail|null
* @ORM\OneToOne(targetEntity="App\Entity\PriceInformations\Orderdetail")
* @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id")
*/

View file

@ -82,7 +82,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
protected string $supplier_product_url = '';
/**
* @var Part
* @var Part|null
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
@ -90,7 +90,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
protected ?Part $part = null;
/**
* @var Supplier
* @var Supplier|null
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
* @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null")

View file

@ -68,7 +68,7 @@ class Project extends AbstractStructuralDBElement
protected int $order_quantity = 0;
/**
* @var string The current status of the project
* @var string|null The current status of the project
* @ORM\Column(type="string", length=64, nullable=true)
* @Assert\Choice({"draft","planning","in_production","finished","archived"})
* @Groups({"extended", "full"})

View file

@ -61,7 +61,7 @@ class ProjectBOMEntry extends AbstractDBElement
protected string $mountnames = '';
/**
* @var string An optional name describing this BOM entry (useful for non-part entries)
* @var string|null An optional name describing this BOM entry (useful for non-part entries)
* @ORM\Column(type="string", nullable=true)
* @Assert\Expression(
* "this.getPart() !== null or this.getName() !== null",
@ -77,7 +77,7 @@ class ProjectBOMEntry extends AbstractDBElement
protected string $comment;
/**
* @var Project
* @var Project|null
* @ORM\ManyToOne(targetEntity="Project", inversedBy="bom_entries")
* @ORM\JoinColumn(name="id_device", referencedColumnName="id")
*/
@ -91,7 +91,7 @@ class ProjectBOMEntry extends AbstractDBElement
protected ?Part $part = null;
/**
* @var BigDecimal The price of this non-part BOM entry
* @var BigDecimal|null The price of this non-part BOM entry
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
* @Assert\AtLeastOneOf({
* @BigDecimalPositive(),

View file

@ -43,7 +43,7 @@ final class PermissionData implements \JsonSerializable
public const CURRENT_SCHEMA_VERSION = 2;
/**
* @var array This array contains the permission values for each permission
* @var array|null This array contains the permission values for each permission
* This array contains the permission values for each permission, in the form of:
* permission => [
* operation => value,

View file

@ -216,7 +216,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected string $name = '';
/**
* @var array
* @var array|null
* @ORM\Column(type="json")
*/
protected ?array $settings = [];

View file

@ -27,7 +27,6 @@ use App\Services\Attachments\AttachmentManager;
use App\Services\Attachments\AttachmentPathResolver;
use App\Services\Attachments\AttachmentReverseSearch;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PostRemoveEventArgs;
use Doctrine\ORM\Event\PreRemoveEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;

View file

@ -97,7 +97,7 @@ class EventLoggerSubscriber implements EventSubscriber
public function onFlush(OnFlushEventArgs $eventArgs): void
{
$em = $eventArgs->getEntityManager();
$em = $eventArgs->getObjectManager();
$uow = $em->getUnitOfWork();
/*
@ -156,7 +156,7 @@ class EventLoggerSubscriber implements EventSubscriber
public function postFlush(PostFlushEventArgs $args): void
{
$em = $args->getEntityManager();
$em = $args->getObjectManager();
$uow = $em->getUnitOfWork();
// If the we have added any ElementCreatedLogEntries added in postPersist, we flush them here.
$uow->computeChangeSets();

View file

@ -56,7 +56,7 @@ final class BarcodeGeneratorTest extends WebTestCase
protected function setUp(): void
{
self::bootKernel();
$this->services = self::$container->get(BarcodeGenerator::class);
$this->services = self::getContainer()->get(BarcodeGenerator::class);
}
public function testGetContent(): void

View file

@ -61,7 +61,7 @@ class PartLotProviderTest extends WebTestCase
{
self::bootKernel();
\Locale::setDefault('en');
$this->service = self::$container->get(PartLotProvider::class);
$this->service = self::getContainer()->get(PartLotProvider::class);
$this->target = new PartLot();
$this->target->setDescription('Lot description');
$this->target->setComment('Lot comment');

View file

@ -59,7 +59,7 @@ class SandboxedTwigProviderTest extends WebTestCase
protected function setUp(): void
{
self::bootKernel();
$this->service = self::$container->get(SandboxedTwigProvider::class);
$this->service = self::getContainer()->get(SandboxedTwigProvider::class);
}
public function twigDataProvider(): array

View file

@ -53,7 +53,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
parent::setUp();
self::bootKernel();
$this->service = self::$container->get(PermissionSchemaUpdater::class);
$this->service = self::getContainer()->get(PermissionSchemaUpdater::class);
}
public function testIsSchemaUpdateNeeded(): void