Fixed code style.

This commit is contained in:
Jan Böhmer 2020-08-21 21:36:22 +02:00
parent 2853e471c4
commit d0b1024d80
212 changed files with 495 additions and 1005 deletions

View file

@ -70,8 +70,6 @@ class AttachmentTypeController extends BaseAdminController
/**
* @Route("/{id}", name="attachment_type_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{
@ -81,8 +79,6 @@ class AttachmentTypeController extends BaseAdminController
/**
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="attachment_type_edit")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @return Response
*/
public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
@ -93,8 +89,6 @@ class AttachmentTypeController extends BaseAdminController
* @Route("/new", name="attachment_type_new")
* @Route("/{id}/clone", name="attachment_type_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response
{
@ -103,8 +97,6 @@ class AttachmentTypeController extends BaseAdminController
/**
* @Route("/export", name="attachment_type_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -113,8 +105,6 @@ class AttachmentTypeController extends BaseAdminController
/**
* @Route("/{id}/export", name="attachment_type_export")
*
* @return Response
*/
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
{
@ -126,9 +116,11 @@ class AttachmentTypeController extends BaseAdminController
if ($entity instanceof AttachmentType) {
if ($entity->getAttachmentsForType()->count() > 0) {
$this->addFlash('error', 'entity.delete.must_not_contain_attachments');
return false;
}
}
return true;
}
}

View file

@ -43,18 +43,13 @@ declare(strict_types=1);
namespace App\Controller\AdminPages;
use App\DataTables\LogDataTable;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Base\PartsContainingRepositoryInterface;
use App\Entity\LabelSystem\LabelProfile;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use App\Events\SecurityEvent;
use App\Events\SecurityEvents;
use App\Exceptions\AttachmentDownloadException;
use App\Form\AdminPages\ImportType;
use App\Form\AdminPages\MassCreationForm;
@ -156,12 +151,14 @@ abstract class BaseAdminController extends AbstractController
return $timeTravel_timestamp;
}
return null;
}
/**
* Perform some additional actions, when the form was valid, but before the entity is saved.
* @return bool Return true, to save entity normally, return false, to abort saving.
*
* @return bool return true, to save entity normally, return false, to abort saving
*/
protected function additionalActionEdit(FormInterface $form, AbstractNamedDBElement $entity): bool
{
@ -174,7 +171,6 @@ abstract class BaseAdminController extends AbstractController
$timeTravel_timestamp = $this->revertElementIfNeeded($entity, $timestamp);
if ($this->isGranted('show_history', $entity)) {
$table = $this->dataTableFactory->createFromType(
LogDataTable::class,
@ -264,7 +260,6 @@ abstract class BaseAdminController extends AbstractController
/** @var AbstractPartsContainingRepository $repo */
$repo = $this->entityManager->getRepository($this->entity_class);
return $this->render($this->twig_template, [
'entity' => $entity,
'form' => $form->createView(),
@ -279,7 +274,8 @@ abstract class BaseAdminController extends AbstractController
/**
* Perform some additional actions, when the form was valid, but before the entity is saved.
* @return bool Return true, to save entity normally, return false, to abort saving.
*
* @return bool return true, to save entity normally, return false, to abort saving
*/
protected function additionalActionNew(FormInterface $form, AbstractNamedDBElement $entity): bool
{
@ -308,7 +304,6 @@ abstract class BaseAdminController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
//Perform additional actions
if ($this->additionalActionNew($form, $new_entity)) {
//Upload passed files
@ -399,7 +394,6 @@ abstract class BaseAdminController extends AbstractController
$em->flush();
}
return $this->render($this->twig_template, [
'entity' => $new_entity,
'form' => $form->createView(),
@ -411,7 +405,9 @@ abstract class BaseAdminController extends AbstractController
/**
* Performs checks if the element can be deleted safely. Otherwise an flash message is added.
* @param AbstractNamedDBElement $entity The element that should be checked.
*
* @param AbstractNamedDBElement $entity the element that should be checked
*
* @return bool True if the the element can be deleted, false if not
*/
protected function deleteCheck(AbstractNamedDBElement $entity): bool
@ -421,9 +417,11 @@ abstract class BaseAdminController extends AbstractController
$repo = $this->entityManager->getRepository($this->entity_class);
if ($repo->getPartsCount($entity) > 0) {
$this->addFlash('error', 'entity.delete.must_not_contain_parts');
return false;
}
}
return true;
}
@ -474,12 +472,14 @@ abstract class BaseAdminController extends AbstractController
$entity = new $this->entity_class();
$this->denyAccessUnlessGranted('read', $entity);
$entities = $em->getRepository($this->entity_class)->findAll();
return $exporter->exportEntityFromRequest($entities, $request);
}
protected function _exportEntity(AbstractNamedDBElement $entity, EntityExporter $exporter, Request $request): \Symfony\Component\HttpFoundation\Response
{
$this->denyAccessUnlessGranted('read', $entity);
return $exporter->exportEntityFromRequest($entity, $request);
}
}

View file

@ -69,8 +69,6 @@ class CategoryController extends BaseAdminController
/**
* @Route("/{id}", name="category_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{
@ -80,8 +78,6 @@ class CategoryController extends BaseAdminController
/**
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="category_edit")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @return Response
*/
public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
@ -92,8 +88,6 @@ class CategoryController extends BaseAdminController
* @Route("/new", name="category_new")
* @Route("/{id}/clone", name="category_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Category $entity = null): Response
{
@ -102,8 +96,6 @@ class CategoryController extends BaseAdminController
/**
* @Route("/export", name="category_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -112,8 +104,6 @@ class CategoryController extends BaseAdminController
/**
* @Route("/{id}/export", name="category_export")
*
* @return Response
*/
public function exportEntity(Category $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -59,7 +59,6 @@ use App\Services\LogSystem\TimeTravel;
use App\Services\StructuralElementRecursionHelper;
use Doctrine\ORM\EntityManagerInterface;
use Exchanger\Exception\ChainException;
use Exchanger\Exception\Exception;
use Exchanger\Exception\UnsupportedCurrencyPairException;
use Omines\DataTablesBundle\DataTableFactory;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@ -100,7 +99,6 @@ class CurrencyController extends BaseAdminController
LabelGenerator $labelGenerator,
EntityManagerInterface $entityManager,
ExchangeRateUpdater $exchangeRateUpdater
) {
$this->exchangeRateUpdater = $exchangeRateUpdater;
@ -121,8 +119,6 @@ class CurrencyController extends BaseAdminController
/**
* @Route("/{id}", name="currency_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{
@ -143,7 +139,7 @@ class CurrencyController extends BaseAdminController
$this->addFlash('info', 'currency.edit.exchange_rate_updated.success');
} catch (ChainException $exception) {
$exception = $exception->getExceptions()[0];
if ($exception instanceof UnsupportedCurrencyPairException || stripos($exception->getMessage(), "supported") !== false) {
if ($exception instanceof UnsupportedCurrencyPairException || false !== stripos($exception->getMessage(), 'supported')) {
$this->addFlash('error', 'currency.edit.exchange_rate_update.unsupported_currency');
} else {
$this->addFlash('error', 'currency.edit.exchange_rate_update.generic_error');
@ -157,8 +153,6 @@ class CurrencyController extends BaseAdminController
/**
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="currency_edit")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @return Response
*/
public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
@ -169,8 +163,6 @@ class CurrencyController extends BaseAdminController
* @Route("/new", name="currency_new")
* @Route("/{id}/clone", name="currency_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Currency $entity = null): Response
{
@ -179,8 +171,6 @@ class CurrencyController extends BaseAdminController
/**
* @Route("/export", name="currency_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -189,8 +179,6 @@ class CurrencyController extends BaseAdminController
/**
* @Route("/{id}/export", name="currency_export")
*
* @return Response
*/
public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request): Response
{
@ -202,6 +190,7 @@ class CurrencyController extends BaseAdminController
if ($entity instanceof Currency) {
if ($entity->getPricedetails()->count() > 0) {
$this->addFlash('error', 'entity.delete.must_not_contain_prices');
return false;
}
}

View file

@ -69,8 +69,6 @@ class DeviceController extends BaseAdminController
/**
* @Route("/{id}", name="device_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function delete(Request $request, Device $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{
@ -80,8 +78,6 @@ class DeviceController extends BaseAdminController
/**
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @return Response
*/
public function edit(Device $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
@ -92,8 +88,6 @@ class DeviceController extends BaseAdminController
* @Route("/new", name="device_new")
* @Route("/{id}/clone", name="device_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Device $entity = null): Response
{
@ -102,8 +96,6 @@ class DeviceController extends BaseAdminController
/**
* @Route("/export", name="device_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -112,8 +104,6 @@ class DeviceController extends BaseAdminController
/**
* @Route("/{id}/export", name="device_export")
*
* @return Response
*/
public function exportEntity(Device $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -69,8 +69,6 @@ class FootprintController extends BaseAdminController
/**
* @Route("/{id}", name="footprint_delete", methods={"DELETE"})
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): \Symfony\Component\HttpFoundation\RedirectResponse
{
@ -80,8 +78,6 @@ class FootprintController extends BaseAdminController
/**
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="footprint_edit")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @return Response
*/
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
@ -92,8 +88,6 @@ class FootprintController extends BaseAdminController
* @Route("/new", name="footprint_new")
* @Route("/{id}/clone", name="footprint_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Footprint $entity = null): Response
{
@ -102,8 +96,6 @@ class FootprintController extends BaseAdminController
/**
* @Route("/export", name="footprint_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -112,8 +104,6 @@ class FootprintController extends BaseAdminController
/**
* @Route("/{id}/export", name="footprint_export")
*
* @return Response
*/
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -69,8 +69,6 @@ class LabelProfileController extends BaseAdminController
/**
* @Route("/{id}", name="label_profile_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function delete(Request $request, LabelProfile $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{
@ -80,8 +78,6 @@ class LabelProfileController extends BaseAdminController
/**
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="label_profile_edit")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @return Response
*/
public function edit(LabelProfile $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
@ -92,8 +88,6 @@ class LabelProfileController extends BaseAdminController
* @Route("/new", name="label_profile_new")
* @Route("/{id}/clone", name="label_profile_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response
{
@ -102,8 +96,6 @@ class LabelProfileController extends BaseAdminController
/**
* @Route("/export", name="label_profile_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -112,8 +104,6 @@ class LabelProfileController extends BaseAdminController
/**
* @Route("/{id}/export", name="label_profile_export")
*
* @return Response
*/
public function exportEntity(LabelProfile $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -91,8 +91,6 @@ class ManufacturerController extends BaseAdminController
* @Route("/new", name="manufacturer_new")
* @Route("/{id}/clone", name="manufacturer_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Manufacturer $entity = null): Response
{
@ -101,8 +99,6 @@ class ManufacturerController extends BaseAdminController
/**
* @Route("/export", name="manufacturer_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -111,8 +107,6 @@ class ManufacturerController extends BaseAdminController
/**
* @Route("/{id}/export", name="manufacturer_export")
*
* @return Response
*/
public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -92,8 +92,6 @@ class MeasurementUnitController extends BaseAdminController
* @Route("/new", name="measurement_unit_new")
* @Route("/{id}/clone", name="measurement_unit_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?MeasurementUnit $entity = null): Response
{
@ -102,8 +100,6 @@ class MeasurementUnitController extends BaseAdminController
/**
* @Route("/export", name="measurement_unit_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -112,8 +108,6 @@ class MeasurementUnitController extends BaseAdminController
/**
* @Route("/{id}/export", name="measurement_unit_export")
*
* @return Response
*/
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -90,8 +90,6 @@ class StorelocationController extends BaseAdminController
* @Route("/new", name="store_location_new")
* @Route("/{id}/clone", name="store_location_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response
{
@ -100,8 +98,6 @@ class StorelocationController extends BaseAdminController
/**
* @Route("/export", name="store_location_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -110,8 +106,6 @@ class StorelocationController extends BaseAdminController
/**
* @Route("/{id}/export", name="store_location_export")
*
* @return Response
*/
public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -91,8 +91,6 @@ class SupplierController extends BaseAdminController
* @Route("/new", name="supplier_new")
* @Route("/{id}/clone", name="supplier_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Supplier $entity = null): Response
{
@ -101,8 +99,6 @@ class SupplierController extends BaseAdminController
/**
* @Route("/export", name="supplier_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -111,8 +107,6 @@ class SupplierController extends BaseAdminController
/**
* @Route("/{id}/export", name="supplier_export")
*
* @return Response
*/
public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request): Response
{

View file

@ -62,8 +62,6 @@ class AttachmentFileController extends AbstractController
* Download the selected attachment.
*
* @Route("/attachment/{id}/download", name="attachment_download")
*
* @return BinaryFileResponse
*/
public function download(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
{
@ -94,8 +92,6 @@ class AttachmentFileController extends AbstractController
* View the attachment.
*
* @Route("/attachment/{id}/view", name="attachment_view")
*
* @return BinaryFileResponse
*/
public function view(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
{

View file

@ -72,8 +72,6 @@ class GroupController extends BaseAdminController
/**
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="group_edit")
* @Route("/{id}/", requirements={"id"="\d+"})
*
* @return Response
*/
public function edit(Group $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{
@ -84,8 +82,6 @@ class GroupController extends BaseAdminController
* @Route("/new", name="group_new")
* @Route("/{id}/clone", name="group_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Group $entity = null): Response
{
@ -94,8 +90,6 @@ class GroupController extends BaseAdminController
/**
* @Route("/{id}", name="group_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function delete(Request $request, Group $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
{
@ -104,8 +98,6 @@ class GroupController extends BaseAdminController
/**
* @Route("/export", name="group_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -114,8 +106,6 @@ class GroupController extends BaseAdminController
/**
* @Route("/{id}/export", name="group_export")
*
* @return Response
*/
public function exportEntity(Group $entity, EntityExporter $exporter, Request $request): Response
{
@ -127,6 +117,7 @@ class GroupController extends BaseAdminController
if ($entity instanceof Group) {
if ($entity->getUsers()->count() > 0) {
$this->addFlash('error', 'entity.delete.must_not_contain_users');
return false;
}
}

View file

@ -81,8 +81,6 @@ class HomepageController extends AbstractController
/**
* @Route("/", name="homepage")
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function homepage(Request $request, GitVersionInfo $versionInfo): Response
{

View file

@ -91,8 +91,6 @@ class PartController extends AbstractController
* @Route("/{id}/info/{timestamp}", name="part_info")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @return Response
*
* @throws \Exception
*/
public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper,
@ -144,8 +142,6 @@ class PartController extends AbstractController
/**
* @Route("/{id}/edit", name="part_edit")
*
* @return Response
*/
public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
AttachmentSubmitHandler $attachmentSubmitHandler): Response
@ -183,7 +179,7 @@ class PartController extends AbstractController
//Redirect to clone page if user wished that...
//@phpstan-ignore-next-line
if ("save_and_clone" === $form->getClickedButton()->getName()) {
if ('save_and_clone' === $form->getClickedButton()->getName()) {
return $this->redirectToRoute('part_clone', ['id' => $part->getID()]);
}
@ -202,8 +198,6 @@ class PartController extends AbstractController
/**
* @Route("/{id}/delete", name="part_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function delete(Request $request, Part $part): RedirectResponse
{
@ -229,8 +223,6 @@ class PartController extends AbstractController
/**
* @Route("/new", name="part_new")
* @Route("/{id}/clone", name="part_clone")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
AttachmentSubmitHandler $attachmentSubmitHandler, ?Part $part = null): Response
@ -310,7 +302,7 @@ class PartController extends AbstractController
//Redirect to clone page if user wished that...
//@phpstan-ignore-next-line
if ("save_and_clone" === $form->getClickedButton()->getName()) {
if ('save_and_clone' === $form->getClickedButton()->getName()) {
return $this->redirectToRoute('part_clone', ['id' => $new_part->getID()]);
}

View file

@ -78,10 +78,11 @@ class PartListsController extends AbstractController
if (!$this->isCsrfTokenValid('table_action', $request->request->get('_token'))) {
$this->addFlash('error', 'csfr_invalid');
return $this->redirect($redirect);
}
if ($action === null || $ids === null) {
if (null === $action || null === $ids) {
$this->addFlash('error', 'part.table.actions.no_params_given');
} else {
$parts = $actionHandler->idStringToArray($ids);
@ -93,7 +94,6 @@ class PartListsController extends AbstractController
$this->addFlash('success', 'part.table.actions.success');
}
return $this->redirect($redirect);
}

View file

@ -69,8 +69,6 @@ class RedirectController extends AbstractController
/**
* This function is called whenever a route was not matching the localized routes.
* The purpose is to redirect the user to the localized version of the page.
*
* @return RedirectResponse
*/
public function addLocalePart(Request $request): RedirectResponse
{
@ -100,8 +98,6 @@ class RedirectController extends AbstractController
* Check if mod_rewrite is available (URL rewriting is possible).
* If this is true, we can redirect to /en, otherwise we have to redirect to index.php/en.
* When the PHP is not used via Apache SAPI, we just assume that URL rewriting is available.
*
* @return bool
*/
public function checkIfModRewriteAvailable(): bool
{

View file

@ -77,8 +77,6 @@ class SecurityController extends AbstractController
/**
* @Route("/login", name="login", methods={"GET", "POST"})
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function login(AuthenticationUtils $authenticationUtils): \Symfony\Component\HttpFoundation\Response
{

View file

@ -20,7 +20,6 @@
namespace App\Controller;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
@ -29,13 +28,11 @@ use App\Entity\Parts\MeasurementUnit;
use App\Services\Trees\NodesListBuilder;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @Route("/select_api")
* @package App\Controller
*/
class SelectAPIController extends AbstractController
{
@ -82,7 +79,7 @@ class SelectAPIController extends AbstractController
protected function getResponseForClass(string $class, bool $include_empty = false): Response
{
$test_obj = new $class;
$test_obj = new $class();
$this->denyAccessUnlessGranted('read', $test_obj);
$nodes = $this->nodesListBuilder->typeToNodesList($class);

View file

@ -32,8 +32,6 @@ class StatisticsController extends AbstractController
{
/**
* @Route("/statistics", name="statistics_view")
*
* @return Response
*/
public function showStatistics(StatisticsHelper $helper): Response
{

View file

@ -1,28 +1,23 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/tools")
* @package App\Controller
*/
class ToolsController extends AbstractController
{
/**
* @Route("/reel_calc", name="tools_reel_calculator")
* @return Response
*/
public function reelCalculator(): Response
{
$this->denyAccessUnlessGranted('@tools.reel_calculator');
return $this->render("Tools/ReelCalculator/main.html.twig");
return $this->render('Tools/ReelCalculator/main.html.twig');
}
}

View file

@ -70,8 +70,6 @@ class TreeController extends AbstractController
/**
* @Route("/tools", name="tree_tools")
*
* @return JsonResponse
*/
public function tools(ToolsTreeBuilder $builder): JsonResponse
{
@ -83,8 +81,6 @@ class TreeController extends AbstractController
/**
* @Route("/category/{id}", name="tree_category")
* @Route("/categories")
*
* @return JsonResponse
*/
public function categoryTree(?Category $category = null): JsonResponse
{
@ -96,8 +92,6 @@ class TreeController extends AbstractController
/**
* @Route("/footprint/{id}", name="tree_footprint")
* @Route("/footprints")
*
* @return JsonResponse
*/
public function footprintTree(?Footprint $footprint = null): JsonResponse
{
@ -109,8 +103,6 @@ class TreeController extends AbstractController
/**
* @Route("/location/{id}", name="tree_location")
* @Route("/locations")
*
* @return JsonResponse
*/
public function locationTree(?Storelocation $location = null): JsonResponse
{
@ -122,8 +114,6 @@ class TreeController extends AbstractController
/**
* @Route("/manufacturer/{id}", name="tree_manufacturer")
* @Route("/manufacturers")
*
* @return JsonResponse
*/
public function manufacturerTree(?Manufacturer $manufacturer = null): JsonResponse
{
@ -135,8 +125,6 @@ class TreeController extends AbstractController
/**
* @Route("/supplier/{id}", name="tree_supplier")
* @Route("/suppliers")
*
* @return JsonResponse
*/
public function supplierTree(?Supplier $supplier = null): JsonResponse
{
@ -148,8 +136,6 @@ class TreeController extends AbstractController
/**
* @Route("/device/{id}", name="tree_device")
* @Route("/devices")
*
* @return JsonResponse
*/
public function deviceTree(?Device $device = null): JsonResponse
{

View file

@ -88,6 +88,7 @@ class UserController extends AdminPages\BaseAdminController
$event = new SecurityEvent($entity);
$this->eventDispatcher->dispatch($event, SecurityEvents::PASSWORD_CHANGED);
}
return true;
}
@ -146,8 +147,6 @@ class UserController extends AdminPages\BaseAdminController
* @Route("/new", name="user_new")
* @Route("/{id}/clone", name="user_clone")
* @Route("/")
*
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response
{
@ -159,6 +158,7 @@ class UserController extends AdminPages\BaseAdminController
if ($entity instanceof User) {
//TODO: Find a better solution
$this->addFlash('error', 'Currently it is not possible to delete a user, as this would break the log... This will be implemented later...');
return false;
}
@ -181,8 +181,6 @@ class UserController extends AdminPages\BaseAdminController
/**
* @Route("/export", name="user_export_all")
*
* @return Response
*/
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
{
@ -191,8 +189,6 @@ class UserController extends AdminPages\BaseAdminController
/**
* @Route("/{id}/export", name="user_export")
*
* @return Response
*/
public function exportEntity(User $entity, EntityExporter $exporter, Request $request): Response
{
@ -202,8 +198,6 @@ class UserController extends AdminPages\BaseAdminController
/**
* @Route("/info", name="user_info_self")
* @Route("/{id}/info", name="user_info")
*
* @return Response
*/
public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response
{

View file

@ -110,8 +110,6 @@ class UserSettingsController extends AbstractController
/**
* @Route("/u2f_delete", name="u2f_delete", methods={"DELETE"})
*
* @return RedirectResponse
*/
public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager): RedirectResponse
{

View file

@ -83,7 +83,6 @@ final class AttachmentDataTable implements DataTableTypeInterface
if ($context->isPicture()
&& !$context->isExternal()
&& $this->attachmentHelper->isFileExisting($context)) {
$title = htmlspecialchars($context->getName());
if ($context->getFilename()) {
$title .= ' ('.htmlspecialchars($context->getFilename()).')';

View file

@ -66,8 +66,6 @@ class EntityColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
*
* @return mixed
*/
public function normalize($value)
{

View file

@ -58,8 +58,6 @@ class MarkdownColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
*
* @return mixed
*/
public function normalize($value)
{

View file

@ -68,8 +68,6 @@ class PartAttachmentsColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
*
* @return mixed
*/
public function normalize($value)
{

View file

@ -58,8 +58,6 @@ class TagsColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
*
* @return mixed
*/
public function normalize($value)
{

View file

@ -49,7 +49,6 @@ use App\DataTables\Column\LocaleDateTimeColumn;
use App\DataTables\Column\MarkdownColumn;
use App\DataTables\Column\PartAttachmentsColumn;
use App\DataTables\Column\TagsColumn;
use App\Entity\LogSystem\AbstractLogEntry;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;

View file

@ -68,7 +68,7 @@ abstract class Attachment extends AbstractNamedDBElement
public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%'];
/**
* @var array Placeholders for attachments which using built in files.
* @var array placeholders for attachments which using built in files
*/
public const BUILTIN_PLACEHOLDER = ['%FOOTPRINTS%', '%FOOTPRINTS3D%'];
@ -345,7 +345,6 @@ abstract class Attachment extends AbstractNamedDBElement
return $this->attachment_type;
}
/*****************************************************************************************************
* Setters
***************************************************************************************************

View file

@ -118,5 +118,4 @@ class AttachmentType extends AbstractStructuralDBElement
return $this;
}
}

View file

@ -39,7 +39,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
use TimestampTrait;
/**
* @var string The name of this element.
* @var string the name of this element
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @Groups({"simple", "extended", "full"})
@ -92,8 +92,6 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
* Change the name of this element.
*
* @param string $new_name the new name
*
* @return self
*/
public function setName(string $new_name): self
{

View file

@ -22,9 +22,6 @@ declare(strict_types=1);
namespace App\Entity\Base;
use App\Entity\Parts\Part;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
@ -34,5 +31,4 @@ use Doctrine\ORM\Mapping as ORM;
*/
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
{
}

View file

@ -130,7 +130,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
* @param AbstractStructuralDBElement $another_element the object to compare
* IMPORTANT: both objects to compare must be from the same class (for example two "Device" objects)!
*
* @return bool True, if this element is child of $another_element.
* @return bool true, if this element is child of $another_element
*
* @throws InvalidArgumentException if there was an error
*/
@ -156,7 +156,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
/**
* Checks if this element is an root element (has no parent).
*
* @return bool True if the this element is an root element.
* @return bool true if the this element is an root element
*/
public function isRoot(): bool
{
@ -283,9 +283,6 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
return $this->children;
}
/**
* @return bool
*/
public function isNotSelectable(): bool
{
return $this->not_selectable;

View file

@ -20,24 +20,24 @@
namespace App\Entity\Base;
use App\Entity\Parts\Part;
use Doctrine\Common\Collections\Collection;
interface PartsContainingRepositoryInterface
{
/**
* Returns all parts associated with this element.
* @param object $element The element for which the parts should be determined.
*
* @param object $element the element for which the parts should be determined
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
*
* @return Part[]
*/
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array;
/**
* Gets the count of the parts associated with this element.
* @param object $element The element for which the parts should be determined.
* @return int
*
* @param object $element the element for which the parts should be determined
*/
public function getPartsCount(object $element): int;
}

View file

@ -27,16 +27,12 @@ interface LogWithCommentInterface
{
/**
* Checks if this log entry has a user provided comment.
*
* @return bool
*/
public function hasComment(): bool;
/**
* Gets the user provided comment associated with this log entry.
* Returns null if not comment was set.
*
* @return string|null
*/
public function getComment(): ?string;

View file

@ -29,15 +29,11 @@ interface LogWithEventUndoInterface
{
/**
* Checks if this element undoes another event.
*
* @return bool
*/
public function isUndoEvent(): bool;
/**
* Returns the ID of the undone event or null if no event is undone.
*
* @return int|null
*/
public function getUndoEventID(): ?int;
@ -52,8 +48,6 @@ interface LogWithEventUndoInterface
* Returns the mode how the event was undone:
* "undo" = Only a single event was applied to element
* "revert" = Element was reverted to the state it was to the timestamp of the log.
*
* @return string
*/
public function getUndoMode(): string;
}

View file

@ -29,7 +29,7 @@ interface TimeTravelInterface
/**
* Checks if this entry has informations which data has changed.
*
* @return bool True if this entry has informations about the changed data.
* @return bool true if this entry has informations about the changed data
*/
public function hasOldDataInformations(): bool;
@ -40,8 +40,6 @@ interface TimeTravelInterface
/**
* Returns the the timestamp associated with this change.
*
* @return \DateTime
*/
public function getTimestamp(): \DateTime;
}

View file

@ -73,12 +73,12 @@ class LabelOptions
protected $supported_element = 'part';
/**
* @var string Any additional CSS for the label.
* @var string any additional CSS for the label
* @ORM\Column(type="text")
*/
protected $additional_css = '';
/** @var string The mode that will be used to interpret the lines.
/** @var string The mode that will be used to interpret the lines
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
* @ORM\Column(type="string")
*/
@ -90,9 +90,6 @@ class LabelOptions
*/
protected $lines = '';
/**
* @return float
*/
public function getWidth(): float
{
return $this->width;
@ -108,9 +105,6 @@ class LabelOptions
return $this;
}
/**
* @return float
*/
public function getHeight(): float
{
return $this->height;
@ -126,9 +120,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getBarcodeType(): string
{
return $this->barcode_type;
@ -144,9 +135,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getPictureType(): string
{
return $this->picture_type;
@ -162,9 +150,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getSupportedElement(): string
{
return $this->supported_element;
@ -180,9 +165,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getLines(): string
{
return $this->lines;
@ -200,8 +182,6 @@ class LabelOptions
/**
* Gets additional CSS (it will simply be attached.
*
* @return string
*/
public function getAdditionalCss(): string
{
@ -218,9 +198,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getLinesMode(): string
{
return $this->lines_mode;

View file

@ -59,7 +59,7 @@ class LabelProfile extends AttachmentContainingDBElement
protected $comment = '';
/**
* @var bool Determines, if this label profile should be shown in the dropdown quick menu.
* @var bool determines, if this label profile should be shown in the dropdown quick menu
* @ORM\Column(type="boolean")
*/
protected $show_in_dropdown = true;
@ -101,8 +101,6 @@ class LabelProfile extends AttachmentContainingDBElement
/**
* Returns true, if this label profile should be shown in label generator quick menu.
*
* @return bool
*/
public function isShowInDropdown(): bool
{

View file

@ -162,7 +162,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
*/
protected $user;
/** @var DateTime The datetime the event associated with this log entry has occured.
/** @var DateTime The datetime the event associated with this log entry has occured
* @ORM\Column(type="datetime", name="datetime")
*/
protected $timestamp;
@ -223,8 +223,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
/**
* Returns the timestamp when the event that caused this log entry happened.
*
* @return DateTime
*/
public function getTimestamp(): DateTime
{
@ -246,8 +244,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
/**
* Get the priority level of this log entry. 0 is highest and 7 lowest level.
* See LEVEL_* consts in this class for more info.
*
* @return int
*/
public function getLevel(): int
{
@ -276,8 +272,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
/**
* Get the priority level of this log entry as PSR3 compatible string.
*
* @return string
*/
public function getLevelString(): string
{
@ -298,8 +292,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
/**
* Returns the type of the event this log entry is associated with.
*
* @return string
*/
public function getType(): string
{
@ -310,7 +302,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
* Returns the class name of the target element associated with this log entry.
* Returns null, if this log entry is not associated with an log entry.
*
* @return string|null The class name of the target class.
* @return string|null the class name of the target class
*/
public function getTargetClass(): ?string
{
@ -325,7 +317,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
* Returns the ID of the target element associated with this log entry.
* Returns null, if this log entry is not associated with an log entry.
*
* @return int|null The ID of the associated element.
* @return int|null the ID of the associated element
*/
public function getTargetID(): ?int
{
@ -339,7 +331,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
/**
* Checks if this log entry is associated with an element.
*
* @return bool True if this log entry is associated with an element, false otherwise.
* @return bool true if this log entry is associated with an element, false otherwise
*/
public function hasTarget(): bool
{
@ -349,7 +341,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
/**
* Sets the target element associated with this element.
*
* @param AbstractDBElement $element The element that should be associated with this element.
* @param AbstractDBElement $element the element that should be associated with this element
*
* @return $this
*/
@ -406,7 +398,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
*
* @param string $level the PSR3 compatible string that should be converted
*
* @return int The internal int representation.
* @return int the internal int representation
*/
final public static function levelStringToInt(string $level): int
{
@ -422,8 +414,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
* Converts an target type id to an full qualified class name.
*
* @param int $type_id The target type ID
*
* @return string
*/
final public static function targetTypeIdToClass(int $type_id): string
{
@ -439,7 +429,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
*
* @param string $class The name of the class (FQN) that should be converted to id
*
* @return int The ID of the associated target type ID.
* @return int the ID of the associated target type ID
*/
final public static function targetTypeClassToID(string $class): int
{

View file

@ -54,8 +54,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
/**
* Get the name of the collection (on target element) that was changed.
*
* @return string
*/
public function getCollectionName(): string
{
@ -65,8 +63,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
/**
* Gets the name of the element that was deleted.
* Return null, if the element did not have a name.
*
* @return string|null
*/
public function getOldName(): ?string
{
@ -75,8 +71,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
/**
* Returns the class of the deleted element.
*
* @return string
*/
public function getDeletedElementClass(): string
{
@ -85,8 +79,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
/**
* Returns the ID of the deleted element.
*
* @return int
*/
public function getDeletedElementID(): int
{

View file

@ -60,8 +60,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
/**
* Checks if the database update was successful.
*
* @return bool
*/
public function isSuccessful(): bool
{
@ -71,8 +69,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
/**
* Gets the database version before update.
*
* @return string
*/
public function getOldVersion(): string
{
@ -81,8 +77,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
/**
* Gets the (target) database version after update.
*
* @return string
*/
public function getNewVersion(): string
{

View file

@ -70,8 +70,6 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI
/**
* Gets the instock when the part was created.
*
* @return string|null
*/
public function getCreationInstockValue(): ?string
{
@ -80,8 +78,6 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI
/**
* Checks if a creation instock value was saved with this entry.
*
* @return bool
*/
public function hasCreationInstockValue(): bool
{

View file

@ -65,8 +65,6 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
/**
* Checks if this log contains infos about which fields has changed.
*
* @return bool
*/
public function hasChangedFieldsInfo(): bool
{

View file

@ -61,8 +61,6 @@ class ExceptionLogEntry extends AbstractLogEntry
/**
* The class name of the exception that caused this log entry.
*
* @return string
*/
public function getExceptionClass(): string
{
@ -71,8 +69,6 @@ class ExceptionLogEntry extends AbstractLogEntry
/**
* Returns the file where the exception happened.
*
* @return string
*/
public function getFile(): string
{
@ -81,8 +77,6 @@ class ExceptionLogEntry extends AbstractLogEntry
/**
* Returns the line where the exception happened.
*
* @return int
*/
public function getLine(): int
{
@ -91,8 +85,6 @@ class ExceptionLogEntry extends AbstractLogEntry
/**
* Return the message of the exception.
*
* @return string
*/
public function getMessage(): string
{

View file

@ -53,8 +53,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
/**
* Get the old instock.
*
* @return int
*/
public function getOldInstock(): int
{
@ -63,8 +61,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
/**
* Get the new instock.
*
* @return int
*/
public function getNewInstock(): int
{
@ -73,8 +69,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
/**
* Gets the comment associated with the instock change.
*
* @return string
*/
public function getComment(): string
{
@ -85,8 +79,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
* Returns the price that has to be payed for the change (in the base currency).
*
* @param bool $absolute Set this to true, if you want only get the absolute value of the price (without minus)
*
* @return float
*/
public function getPrice(bool $absolute = false): float
{
@ -100,9 +92,9 @@ class InstockChangedLogEntry extends AbstractLogEntry
/**
* Returns the difference value of the change ($new_instock - $old_instock).
*
* @param bool $absolute Set this to true if you want only the absolute value of the difference.
* @param bool $absolute set this to true if you want only the absolute value of the difference
*
* @return int Difference is positive if instock has increased, negative if decreased.
* @return int difference is positive if instock has increased, negative if decreased
*/
public function getDifference(bool $absolute = false): int
{
@ -122,7 +114,7 @@ class InstockChangedLogEntry extends AbstractLogEntry
/**
* Checks if the Change was an withdrawal of parts.
*
* @return bool True if the change was an withdrawal, false if not.
* @return bool true if the change was an withdrawal, false if not
*/
public function isWithdrawal(): bool
{

View file

@ -89,8 +89,6 @@ class SecurityEventLogEntry extends AbstractLogEntry
/**
* Return what event this log entry represents (e.g. password_reset).
*
* @return string
*/
public function getEventType(): string
{
@ -104,8 +102,6 @@ class SecurityEventLogEntry extends AbstractLogEntry
/**
* Return the (anonymized) IP address used to login the user.
*
* @return string
*/
public function getIPAddress(): string
{
@ -115,7 +111,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
/**
* Sets the IP address used to login the user.
*
* @param string $ip The IP address used to login the user.
* @param string $ip the IP address used to login the user
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
*
* @return $this

View file

@ -63,8 +63,6 @@ class UserLoginLogEntry extends AbstractLogEntry
/**
* Return the (anonymized) IP address used to login the user.
*
* @return string
*/
public function getIPAddress(): string
{
@ -74,7 +72,7 @@ class UserLoginLogEntry extends AbstractLogEntry
/**
* Sets the IP address used to login the user.
*
* @param string $ip The IP address used to login the user.
* @param string $ip the IP address used to login the user
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
*
* @return $this

View file

@ -61,8 +61,6 @@ class UserLogoutLogEntry extends AbstractLogEntry
/**
* Return the (anonymized) IP address used to login the user.
*
* @return string
*/
public function getIPAddress(): string
{
@ -72,7 +70,7 @@ class UserLogoutLogEntry extends AbstractLogEntry
/**
* Sets the IP address used to login the user.
*
* @param string $ip The IP address used to login the user.
* @param string $ip the IP address used to login the user
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
*
* @return $this

View file

@ -61,8 +61,6 @@ class UserNotAllowedLogEntry extends AbstractLogEntry
/**
* Returns the path the user tried to accessed and what was denied.
*
* @return string
*/
public function getPath(): string
{

View file

@ -64,7 +64,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
protected $symbol = '';
/**
* @var float|null The guaranteed minimum value of this property.
* @var float|null the guaranteed minimum value of this property
* @Assert\Type({"float","null"})
* @Assert\LessThanOrEqual(propertyPath="value_typical", message="parameters.validator.min_lesser_typical")
* @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max")
@ -73,14 +73,14 @@ abstract class AbstractParameter extends AbstractNamedDBElement
protected $value_min;
/**
* @var float|null The typical value of this property.
* @var float|null the typical value of this property
* @Assert\Type({"null", "float"})
* @ORM\Column(type="float", nullable=true)
*/
protected $value_typical;
/**
* @var float|null The maximum value of this property.
* @var float|null the maximum value of this property
* @Assert\Type({"float", "null"})
* @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical")
* @ORM\Column(type="float", nullable=true)
@ -95,13 +95,13 @@ abstract class AbstractParameter extends AbstractNamedDBElement
protected $unit = '';
/**
* @var string A text value for the given property.
* @var string a text value for the given property
* @ORM\Column(type="string", nullable=false)
*/
protected $value_text = '';
/**
* @var string The group this parameter belongs to.
* @var string the group this parameter belongs to
* @ORM\Column(type="string", nullable=false, name="param_group")
*/
protected $group = '';
@ -109,7 +109,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Mapping is done in sub classes.
*
* @var AbstractDBElement|null The element to which this parameter belongs to.
* @var AbstractDBElement|null the element to which this parameter belongs to
*/
protected $element;
@ -130,8 +130,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns the element this parameter belongs to.
*
* @return AbstractDBElement|null
*/
public function getElement(): ?AbstractDBElement
{
@ -141,8 +139,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Return a formatted string version of the values of the string.
* Based on the set values it can return something like this: 34 V (12 V ... 50 V) [Text].
*
* @return string
*/
public function getFormattedValue(): string
{
@ -211,8 +207,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns the name of the group this parameter is associated to (e.g. Technical Parameters).
*
* @return string
*/
public function getGroup(): string
{
@ -233,8 +227,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns the mathematical symbol for this specification (e.g. "V_CB").
*
* @return string
*/
public function getSymbol(): string
{
@ -255,8 +247,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns The guaranteed minimum value of this property.
*
* @return float|null
*/
public function getValueMin(): ?float
{
@ -277,8 +267,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns the typical value of this property.
*
* @return float|null
*/
public function getValueTypical(): ?float
{
@ -287,8 +275,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Return a formatted version with the minimum value with the unit of this parameter.
*
* @return string
*/
public function getValueTypicalWithUnit(): string
{
@ -297,8 +283,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Return a formatted version with the maximum value with the unit of this parameter.
*
* @return string
*/
public function getValueMaxWithUnit(): string
{
@ -307,8 +291,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Return a formatted version with the typical value with the unit of this parameter.
*
* @return string
*/
public function getValueMinWithUnit(): string
{
@ -331,8 +313,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns the guaranteed maximum value.
*
* @return float|null
*/
public function getValueMax(): ?float
{
@ -353,8 +333,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns the unit used by the value (e.g. "V").
*
* @return string
*/
public function getUnit(): string
{
@ -375,8 +353,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Returns the text value.
*
* @return string
*/
public function getValueText(): string
{
@ -397,8 +373,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* Return a string representation and (if possible) with its unit.
*
* @return string
*/
protected function formatWithUnit(float $value, string $format = '%g'): string
{

View file

@ -39,8 +39,6 @@ trait ParametersTrait
/**
* Return all associated specifications.
*
* @return Collection
*
* @psalm-return Collection<int, PartParameter>
*/
public function getParameters(): \Doctrine\Common\Collections\Collection

View file

@ -111,7 +111,6 @@ class Category extends AbstractPartsContainingDBElement
*/
protected $parameters;
public function getPartnameHint(): string
{
return $this->partname_hint;

View file

@ -99,7 +99,6 @@ class Footprint extends AbstractPartsContainingDBElement
*/
protected $parameters;
/****************************************
* Getters
****************************************/

View file

@ -109,7 +109,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
*/
protected $parameters;
/**
* @return string
*/

View file

@ -176,7 +176,6 @@ class Part extends AttachmentContainingDBElement
parent::__clone();
}
/**
* Get all devices which uses this part.
*

View file

@ -73,7 +73,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
protected $description = '';
/**
* @var string A comment stored with this lot.
* @var string a comment stored with this lot
* @ORM\Column(type="text")
*/
protected $comment = '';
@ -107,7 +107,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
protected $amount = 0;
/**
* @var bool Determines if this lot was manually marked for refilling.
* @var bool determines if this lot was manually marked for refilling
* @ORM\Column(type="boolean")
*/
protected $needs_refill = false;
@ -128,7 +128,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
parent::__clone();
}
/**
* Check if the current part lot is expired.
* This is the case, if the expiration date is greater the the current date.
@ -149,8 +148,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Gets the description of the part lot. Similar to a "name" of the part lot.
*
* @return string
*/
public function getDescription(): string
{
@ -171,8 +168,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Gets the comment for this part lot.
*
* @return string
*/
public function getComment(): string
{
@ -193,8 +188,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Gets the expiration date for the part lot. Returns null, if no expiration date was set.
*
* @return DateTime|null
*/
public function getExpirationDate(): ?DateTime
{
@ -239,8 +232,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Return the part that is stored in this part lot.
*
* @return Part
*/
public function getPart(): Part
{
@ -261,8 +252,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Checks if the instock value in the part lot is unknown.
*
* @return bool
*/
public function isInstockUnknown(): bool
{
@ -281,9 +270,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
return $this;
}
/**
* @return float
*/
public function getAmount(): float
{
if ($this->part instanceof Part && !$this->part->useFloatAmount()) {
@ -312,9 +298,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
return $this;
}
/**
* @return bool
*/
public function isNeedsRefill(): bool
{
return $this->needs_refill;

View file

@ -136,8 +136,6 @@ class Storelocation extends AbstractPartsContainingDBElement
/**
* When this property is set, only one part (but many instock) is allowed to be stored in this store location.
*
* @return bool
*/
public function isOnlySinglePart(): bool
{
@ -156,8 +154,6 @@ class Storelocation extends AbstractPartsContainingDBElement
/**
* When this property is set, it is only possible to increase the instock of parts, that are already stored here.
*
* @return bool
*/
public function isLimitToExistingParts(): bool
{
@ -174,9 +170,6 @@ class Storelocation extends AbstractPartsContainingDBElement
return $this;
}
/**
* @return MeasurementUnit|null
*/
public function getStorageType(): ?MeasurementUnit
{
return $this->storage_type;

View file

@ -57,7 +57,6 @@ use App\Entity\PriceInformations\Currency;
use App\Validator\Constraints\BigDecimal\BigDecimalPositiveOrZero;
use App\Validator\Constraints\Selectable;
use Brick\Math\BigDecimal;
use Brick\Math\BigNumber;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
@ -120,8 +119,6 @@ class Supplier extends AbstractCompany
/**
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
*
* @return Currency|null
*/
public function getDefaultCurrency(): ?Currency
{
@ -159,7 +156,7 @@ class Supplier extends AbstractCompany
*/
public function setShippingCosts(?BigDecimal $shipping_costs): self
{
if ($shipping_costs === null) {
if (null === $shipping_costs) {
$this->shipping_costs = null;
}

View file

@ -51,7 +51,6 @@ use Brick\Math\RoundingMode;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use DoctrineExtensions\Query\Mysql\Round;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
@ -119,9 +118,6 @@ class Currency extends AbstractStructuralDBElement
parent::__construct();
}
/**
* @return Collection
*/
public function getPricedetails(): Collection
{
return $this->pricedetails;
@ -182,7 +178,7 @@ class Currency extends AbstractStructuralDBElement
*/
public function setExchangeRate(?BigDecimal $exchange_rate): self
{
if ($exchange_rate === null) {
if (null === $exchange_rate) {
$this->exchange_rate = null;
}
$tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP);

View file

@ -299,6 +299,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
if ((string) $tmp !== (string) $this->price) {
$this->price = $tmp;
}
return $this;
}

View file

@ -103,7 +103,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
*/
protected $parameters;
public function __construct()
{
parent::__construct();
@ -113,8 +112,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
/**
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
*
* @return bool
*/
public function isEnforce2FA(): bool
{
@ -124,7 +121,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
/**
* Sets if the user of this group are enforced to have two factor authentification enabled.
*
* @param bool $enforce2FA True, if the users of this group are enforced to have 2FA enabled.
* @param bool $enforce2FA true, if the users of this group are enforced to have 2FA enabled
*
* @return $this
*/

View file

@ -493,6 +493,7 @@ class PermissionsEmbed
}
$mask = 0b11 << $n; //Create a mask for the data
return ($data & $mask) >> $n; //Apply mask and shift back
}

View file

@ -180,8 +180,6 @@ class U2FKey implements TwoFactorKeyInterface
/**
* Gets the user, this U2F key belongs to.
*
* @return User
*/
public function getUser(): User
{
@ -190,8 +188,6 @@ class U2FKey implements TwoFactorKeyInterface
/**
* The primary key ID of this key.
*
* @return int
*/
public function getID(): int
{

View file

@ -110,7 +110,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected $theme = '';
/**
* @var string|null The hash of a token the user must provide when he wants to reset his password.
* @var string|null the hash of a token the user must provide when he wants to reset his password
* @ORM\Column(type="string", nullable=true)
*/
protected $pw_reset_token;
@ -261,7 +261,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected $permissions;
/**
* @var DateTime The time until the password reset token is valid.
* @var DateTime the time until the password reset token is valid
* @ORM\Column(type="datetime", nullable=true)
*/
protected $pw_reset_expires;
@ -367,7 +367,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the currency the user prefers when showing him prices.
*
* @return Currency|null The currency the user prefers, or null if the global currency should be used.
* @return Currency|null the currency the user prefers, or null if the global currency should be used
*/
public function getCurrency(): ?Currency
{
@ -389,7 +389,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Checks if this user is disabled (user cannot login any more).
*
* @return bool True, if the user is disabled.
* @return bool true, if the user is disabled
*/
public function isDisabled(): bool
{
@ -399,7 +399,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Sets the status if a user is disabled.
*
* @param bool $disabled True if the user should be disabled.
* @param bool $disabled true if the user should be disabled
*
* @return User
*/
@ -410,7 +410,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
return $this;
}
public function getPermissions(): PermissionsEmbed
{
return $this->permissions;
@ -418,8 +417,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Check if the user needs a password change.
*
* @return bool
*/
public function isNeedPwChange(): bool
{
@ -440,8 +437,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Returns the encrypted password reset token.
*
* @return string|null
*/
public function getPwResetToken(): ?string
{
@ -462,8 +457,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the datetime when the password reset token expires.
*
* @return DateTime
*/
public function getPwResetExpires(): DateTime
{
@ -513,7 +506,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Change the username of this user.
*
* @param string $new_name The new username.
* @param string $new_name the new username
*
* @return $this
*/
@ -529,8 +522,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get the first name of the user.
*
* @return string|null
*/
public function getFirstName(): ?string
{
@ -553,8 +544,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get the last name of the user.
*
* @return string|null
*/
public function getLastName(): ?string
{
@ -675,7 +664,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the theme the users wants to see. See self::AVAILABLE_THEMES for valid values.
*
* @return string|null The name of the theme the user wants to see, or null if the system wide should be used.
* @return string|null the name of the theme the user wants to see, or null if the system wide should be used
*/
public function getTheme(): ?string
{
@ -723,8 +712,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return true if the user should do two-factor authentication.
*
* @return bool
*/
public function isGoogleAuthenticatorEnabled(): bool
{
@ -733,8 +720,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return the user name that should be shown in Google Authenticator.
*
* @return string
*/
public function getGoogleAuthenticatorUsername(): string
{
@ -744,8 +729,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return the Google Authenticator secret
* When an empty string is returned, the Google authentication is disabled.
*
* @return string|null
*/
public function getGoogleAuthenticatorSecret(): ?string
{
@ -767,9 +750,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Check if the given code is a valid backup code.
*
* @param string $code The code that should be checked.
* @param string $code the code that should be checked
*
* @return bool True if the backup code is valid.
* @return bool true if the backup code is valid
*/
public function isBackupCode(string $code): bool
{
@ -822,8 +805,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return the date when the backup codes were generated.
*
* @return DateTime|null
*/
public function getBackupCodesGenerationDate(): ?DateTime
{
@ -851,8 +832,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Check if U2F is enabled.
*
* @return bool
*/
public function isU2FAuthEnabled(): bool
{
@ -862,8 +841,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get all U2F Keys that are associated with this user.
*
* @return Collection
*
* @psalm-return Collection<int, TwoFactorKeyInterface>
*/
public function getU2FKeys(): Collection

View file

@ -99,6 +99,7 @@ class AttachmentDeleteListener
/**
* Ensure that attachments are not used in preview, so that they can be deleted (without integrity violation).
*
* @ORM\PreRemove()
*/
public function preRemoveHandler(Attachment $attachment, LifecycleEventArgs $event): void
@ -106,7 +107,7 @@ class AttachmentDeleteListener
//Ensure that the attachment that will be deleted, is not used as preview picture anymore...
$attachment_holder = $attachment->getElement();
if ($attachment_holder === null) {
if (null === $attachment_holder) {
return;
}

View file

@ -200,8 +200,6 @@ class EventLoggerSubscriber implements EventSubscriber
/**
* Checks if the field of the given element should be saved (if it is not blacklisted).
*
* @return bool
*/
public function shouldFieldBeSaved(AbstractDBElement $element, string $field_name): bool
{
@ -297,8 +295,6 @@ class EventLoggerSubscriber implements EventSubscriber
/**
* Filter out every forbidden field and return the cleaned array.
*
* @return array
*/
protected function filterFieldRestrictions(AbstractDBElement $element, array $fields): array
{
@ -349,7 +345,7 @@ class EventLoggerSubscriber implements EventSubscriber
/**
* Check if the given entity can be logged.
*
* @return bool True, if the given entity can be logged.
* @return bool true, if the given entity can be logged
*/
protected function validEntity(object $entity): bool
{

View file

@ -48,7 +48,6 @@ use Doctrine\Common\EventSubscriber;
use Doctrine\Migrations\DependencyFactory;
use Doctrine\Migrations\Event\MigrationsEventArgs;
use Doctrine\Migrations\Events;
use Doctrine\Migrations\Version\AliasResolver;
/**
* This subscriber logs databaseMigrations to Event log.

View file

@ -45,11 +45,7 @@ namespace App\EventSubscriber\LogSystem;
use App\Entity\LogSystem\UserLogoutLogEntry;
use App\Entity\UserSystem\User;
use App\Services\LogSystem\EventLogger;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Http\Event\LogoutEvent;
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
/**
* This handler logs to event log, if a user logs out.
@ -65,13 +61,12 @@ class LogoutLoggerListener
$this->gpdr_compliance = $gpdr_compliance;
}
public function __invoke(LogoutEvent $event)
{
$request = $event->getRequest();
$token = $event->getToken();
if ($token === null) {
if (null === $token) {
return;
}

View file

@ -44,7 +44,6 @@ namespace App\EventSubscriber\UserSystem;
use App\Entity\UserSystem\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
@ -140,9 +139,9 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
* That is the case if the group of the user enforces 2FA, but the user has neither Google Authenticator nor an
* U2F key setup.
*
* @param User $user The user for which should be checked if it needs to be redirected.
* @param User $user the user for which should be checked if it needs to be redirected
*
* @return bool True if the user needs to be redirected.
* @return bool true if the user needs to be redirected
*/
public static function TFARedirectNeeded(User $user): bool
{

View file

@ -51,7 +51,6 @@ use R\U2FTwoFactorBundle\Event\RegisterEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

View file

@ -45,7 +45,6 @@ namespace App\Form\AdminPages;
use App\Entity\Base\AbstractNamedDBElement;
use App\Form\Type\BigDecimalMoneyType;
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Security;
@ -90,7 +89,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm
SubmitType::class,
[
'label' => 'currency.edit.update_rate',
'disabled' => ! $this->security->isGranted('edit', $entity)
'disabled' => !$this->security->isGranted('edit', $entity),
]
);
}

View file

@ -46,7 +46,6 @@ use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\PriceInformations\Currency;
use App\Form\Type\BigDecimalMoneyType;
use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Security;

View file

@ -179,7 +179,7 @@ class AttachmentFormType extends AbstractType
if ($attachment instanceof Attachment && $file instanceof UploadedFile && $attachment->getAttachmentType()) {
if (!$this->submitHandler->isValidFileExtension($attachment->getAttachmentType(), $file)) {
$event->getForm()->get('file')->addError(
new FormError($this->translator->trans("validator.file_ext_not_allowed"))
new FormError($this->translator->trans('validator.file_ext_not_allowed'))
);
}
}

View file

@ -50,7 +50,6 @@ use App\Form\Type\StructuralEntityType;
use App\Form\WorkaroundCollectionType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;

View file

@ -133,8 +133,7 @@ class PartBaseType extends AbstractType
'disable_not_selectable' => true,
'disabled' => !$this->security->isGranted('category.edit', $part),
'constraints' => [
]
],
])
->add('footprint', StructuralEntityType::class, [
'class' => Footprint::class,
@ -298,7 +297,7 @@ class PartBaseType extends AbstractType
//Buttons
->add('save', SubmitType::class, ['label' => 'part.edit.save'])
->add('save_and_clone', SubmitType::class, [
'label' => 'part.edit.save_and_clone'
'label' => 'part.edit.save_and_clone',
])
->add('reset', ResetType::class, ['label' => 'part.edit.reset']);
}

View file

@ -44,7 +44,6 @@ namespace App\Form\Part;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\PriceInformations\Pricedetail;
use App\Form\Type\BigDecimalMoneyType;
use App\Form\Type\BigDecimalNumberType;
use App\Form\Type\CurrencyEntityType;
use App\Form\Type\SIUnitType;

View file

@ -20,12 +20,9 @@
namespace App\Form\Type;
use Brick\Math\BigDecimal;
use Brick\Math\BigNumber;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\FormBuilderInterface;
@ -43,7 +40,7 @@ class BigDecimalMoneyType extends AbstractType implements DataTransformerInterfa
public function transform($value)
{
if ($value === null) {
if (null === $value) {
return null;
}
@ -56,7 +53,7 @@ class BigDecimalMoneyType extends AbstractType implements DataTransformerInterfa
public function reverseTransform($value)
{
if ($value === null) {
if (null === $value) {
return null;
}

View file

@ -20,7 +20,6 @@
namespace App\Form\Type;
use Brick\Math\BigDecimal;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataTransformerInterface;
@ -41,7 +40,7 @@ class BigDecimalNumberType extends AbstractType implements DataTransformerInterf
public function transform($value)
{
if ($value === null) {
if (null === $value) {
return null;
}
@ -54,7 +53,7 @@ class BigDecimalNumberType extends AbstractType implements DataTransformerInterf
public function reverseTransform($value)
{
if ($value === null) {
if (null === $value) {
return null;
}

View file

@ -134,8 +134,6 @@ class StructuralEntityType extends AbstractType
/**
* Gets the entries from database and return an array of them.
*
* @return array
*/
public function getEntries(Options $options): array
{

View file

@ -1,26 +1,18 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
/**
* This a workaround for the issue #37024.
* @package App\Form
*/
class WorkaroundCollectionType extends CollectionType
{
/**
* Use the original implementation for finishView() instead of the one, the one that cause the bug.
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{

View file

@ -20,7 +20,6 @@
namespace App\Helpers;
use Brick\Math\BigDecimal;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
@ -36,12 +35,12 @@ class BigDecimalType extends Type
/**
* @param string $value
* @param AbstractPlatform $platform
*
* @return BigDecimal|\Brick\Math\BigNumber|mixed
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
if (null === $value) {
return null;
}
@ -50,12 +49,10 @@ class BigDecimalType extends Type
/**
* @param BigDecimal $value
* @param AbstractPlatform $platform
* @return mixed
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value === null) {
if (null === $value) {
return null;
}

View file

@ -81,8 +81,6 @@ final class TreeViewNode implements JsonSerializable
/**
* Return the ID of the entity associated with this node.
* Null if this node is not connected with an entity.
*
* @return int|null
*/
public function getId(): ?int
{
@ -104,8 +102,6 @@ final class TreeViewNode implements JsonSerializable
/**
* Returns the node text.
*
* @return string
*/
public function getText(): string
{
@ -115,7 +111,7 @@ final class TreeViewNode implements JsonSerializable
/**
* Sets the node text.
*
* @param string $text The new node text.
* @param string $text the new node text
*
* @return TreeViewNode
*/
@ -128,8 +124,6 @@ final class TreeViewNode implements JsonSerializable
/**
* Returns the href link.
*
* @return string|null
*/
public function getHref(): ?string
{
@ -139,7 +133,7 @@ final class TreeViewNode implements JsonSerializable
/**
* Sets the href link.
*
* @param string|null $href The new href link.
* @param string|null $href the new href link
*
* @return TreeViewNode
*/

View file

@ -61,9 +61,6 @@ final class TreeViewNodeState implements JsonSerializable
*/
private $selected = null;
/**
* @return bool|null
*/
public function getDisabled(): ?bool
{
return $this->disabled;
@ -74,9 +71,6 @@ final class TreeViewNodeState implements JsonSerializable
$this->disabled = $disabled;
}
/**
* @return bool|null
*/
public function getExpanded(): ?bool
{
return $this->expanded;
@ -87,9 +81,6 @@ final class TreeViewNodeState implements JsonSerializable
$this->expanded = $expanded;
}
/**
* @return bool|null
*/
public function getSelected(): ?bool
{
return $this->selected;

View file

@ -1,9 +1,7 @@
<?php
namespace App\Migration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\Schema;
@ -15,7 +13,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
public const ADMIN_PW_LENGTH = 10;
protected $permissions_updated = false;
protected $admin_pw = "";
protected $admin_pw = '';
protected $logger;
@ -61,11 +59,10 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
/**
* Gets the legacy Part-DB version number. Returns 0, if target database is not an legacy Part-DB database.
* @return int
*/
public function getOldDBVersion(): int
{
if ($this->connection->getDatabasePlatform()->getName() !== "mysql") {
if ('mysql' !== $this->connection->getDatabasePlatform()->getName()) {
//Old Part-DB version only supported MySQL therefore only
return 0;
}
@ -81,7 +78,6 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
/**
* Returns the hash of a new random password, created for the initial admin user, which can be written to DB.
* The plaintext version of the password will be outputed to user after this migration.
* @return string
*/
public function getInitalAdminPW(): string
{

View file

@ -20,28 +20,26 @@
namespace App\Repository;
use App\Entity\Base\AbstractPartsContainingDBElement;
use App\Entity\Base\PartsContainingRepositoryInterface;
use App\Entity\Parts\Part;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
abstract class AbstractPartsContainingRepository extends StructuralDBElementRepository
implements PartsContainingRepositoryInterface
abstract class AbstractPartsContainingRepository extends StructuralDBElementRepository implements PartsContainingRepositoryInterface
{
/**
* Returns all parts associated with this element.
* @param AbstractPartsContainingDBElement $element The element for which the parts should be determined.
*
* @param AbstractPartsContainingDBElement $element the element for which the parts should be determined
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
*
* @return Part[]
*/
abstract public function getParts(object $element, array $order_by = ['name' => 'ASC']): array;
/**
* Gets the count of the parts associated with this element.
* @param AbstractPartsContainingDBElement $element The element for which the parts should be determined.
* @return int
*
* @param AbstractPartsContainingDBElement $element the element for which the parts should be determined
*/
abstract public function getPartsCount(object $element): int;
@ -66,5 +64,4 @@ abstract class AbstractPartsContainingRepository extends StructuralDBElementRepo
return $repo->count([$field_name => $element]);
}
}

View file

@ -27,8 +27,6 @@ class AttachmentRepository extends DBElementRepository
{
/**
* Gets the count of all private/secure attachments.
*
* @return int
*/
public function getPrivateAttachmentsCount(): int
{
@ -44,8 +42,6 @@ class AttachmentRepository extends DBElementRepository
/**
* Gets the count of all external attachments (attachments only containing an URL).
*
* @return int
*
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
@ -65,8 +61,6 @@ class AttachmentRepository extends DBElementRepository
/**
* Gets the count of all attachments where an user uploaded an file.
*
* @return int
*
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/

View file

@ -32,8 +32,6 @@ class LabelProfileRepository extends NamedDBElementRepository
/**
* Find the profiles that are shown in the dropdown for the given type.
* You should maybe use the cached version of this in LabelProfileDropdownHelper.
*
* @return array
*/
public function getDropdownProfiles(string $type): array
{
@ -78,10 +76,8 @@ class LabelProfileRepository extends NamedDBElementRepository
/**
* Find all LabelProfiles that can be used with the given type.
*
* @param string $type See LabelOptions::SUPPORTED_ELEMENTS for valid values.
* @param string $type see LabelOptions::SUPPORTED_ELEMENTS for valid values
* @param array $order_by The way the results should be sorted. By default ordered by
*
* @return array
*/
public function findForSupportedElement(string $type, array $order_by = ['name' => 'ASC']): array
{

View file

@ -86,8 +86,6 @@ class LogEntryRepository extends DBElementRepository
*
* @param string $class The class of the element that should be undeleted
* @param int $id The ID of the element that should be deleted
*
* @return ElementDeletedLogEntry
*/
public function getUndeleteDataForElement(string $class, int $id): ElementDeletedLogEntry
{
@ -180,8 +178,6 @@ class LogEntryRepository extends DBElementRepository
* @param string $order
* @param null $limit
* @param null $offset
*
* @return array
*/
public function getLogsOrderedByTimestamp($order = 'DESC', $limit = null, $offset = null): array
{
@ -191,8 +187,8 @@ class LogEntryRepository extends DBElementRepository
/**
* Gets the target element associated with the logentry.
*
* @return AbstractDBElement|null Returns the associated DBElement or null if the log either has no target or the element
* was deleted from DB.
* @return AbstractDBElement|null returns the associated DBElement or null if the log either has no target or the element
* was deleted from DB
*
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
@ -213,7 +209,7 @@ class LogEntryRepository extends DBElementRepository
/**
* Returns the last user that has edited the given element.
*
* @return User|null A user object, or null if no user could be determined.
* @return User|null a user object, or null if no user could be determined
*/
public function getLastEditingUser(AbstractDBElement $element): ?User
{
@ -223,7 +219,7 @@ class LogEntryRepository extends DBElementRepository
/**
* Returns the user that has created the given element.
*
* @return User|null A user object, or null if no user could be determined.
* @return User|null a user object, or null if no user could be determined
*/
public function getCreatingUser(AbstractDBElement $element): ?User
{

View file

@ -50,8 +50,6 @@ class PartRepository extends NamedDBElementRepository
/**
* Gets the summed up instock of all parts (only parts without an measurent unit).
*
* @return float
*
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
@ -71,8 +69,6 @@ class PartRepository extends NamedDBElementRepository
/**
* Gets the number of parts that has price informations.
*
* @return int
*
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/

View file

@ -21,12 +21,10 @@
namespace App\Repository\Parts;
use App\Entity\Parts\Category;
use App\Entity\Parts\Storelocation;
use App\Repository\AbstractPartsContainingRepository;
class CategoryRepository extends AbstractPartsContainingRepository
{
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{
if (!$element instanceof Category) {

View file

@ -21,7 +21,6 @@
namespace App\Repository\Parts;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Storelocation;
use App\Repository\AbstractPartsContainingRepository;
class FootprintRepository extends AbstractPartsContainingRepository

View file

@ -20,13 +20,11 @@
namespace App\Repository\Parts;
use App\Entity\Parts\Category;
use App\Entity\Parts\Manufacturer;
use App\Repository\AbstractPartsContainingRepository;
class ManufacturerRepository extends AbstractPartsContainingRepository
{
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{
if (!$element instanceof Manufacturer) {

View file

@ -20,13 +20,11 @@
namespace App\Repository\Parts;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Repository\AbstractPartsContainingRepository;
class MeasurementUnitRepository extends AbstractPartsContainingRepository
{
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{
if (!$element instanceof MeasurementUnit) {

View file

@ -21,11 +21,9 @@
namespace App\Repository\Parts;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use App\Repository\AbstractPartsContainingRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\HttpKernel\HttpCache\Store;
class StorelocationRepository extends AbstractPartsContainingRepository
{
@ -67,7 +65,6 @@ class StorelocationRepository extends AbstractPartsContainingRepository
->where('lots.storage_location = ?1')
->setParameter(1, $element);
return (int) $qb->getQuery()->getSingleScalarResult();
}
}

View file

@ -21,7 +21,6 @@
namespace App\Repository\Parts;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use App\Repository\AbstractPartsContainingRepository;
use Doctrine\ORM\QueryBuilder;
@ -63,7 +62,6 @@ class SupplierRepository extends AbstractPartsContainingRepository
->where('orderdetail.supplier = ?1')
->setParameter(1, $element);
return (int) $qb->getQuery()->getSingleScalarResult();
}
}

View file

@ -63,7 +63,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
* The treeview is generic, that means the href are null and ID values are set.
*
* @param AbstractStructuralDBElement|null $parent The parent the root elements should have.
* @param AbstractStructuralDBElement|null $parent the parent the root elements should have
*
* @return TreeViewNode[]
*/
@ -90,7 +90,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
*
* @param AbstractStructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root
*
* @return AbstractStructuralDBElement[] A flattened list containing the tree elements.
* @return AbstractStructuralDBElement[] a flattened list containing the tree elements
*/
public function toNodesList(?AbstractStructuralDBElement $parent = null): array
{

View file

@ -60,8 +60,6 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU
/**
* Returns the anonymous user.
* The result is cached, so the database is only called once, after the anonymous user was found.
*
* @return User|null
*/
public function getAnonymousUser(): ?User
{

Some files were not shown because too many files have changed in this diff Show more