diff --git a/src/Command/CleanAttachmentsCommand.php b/src/Command/CleanAttachmentsCommand.php
index dedbaf5d..2622c99c 100644
--- a/src/Command/CleanAttachmentsCommand.php
+++ b/src/Command/CleanAttachmentsCommand.php
@@ -123,7 +123,7 @@ class CleanAttachmentsCommand extends Command
$continue = $io->confirm(sprintf('Found %d abandoned files. Do you want to delete them? This can not be undone!', count($file_list)), false);
- if (! $continue) {
+ if (!$continue) {
//We are finished here, when no files should be deleted
return 0;
}
diff --git a/src/Command/ConvertBBCodeCommand.php b/src/Command/ConvertBBCodeCommand.php
index 5b59a08b..48b8bd5c 100644
--- a/src/Command/ConvertBBCodeCommand.php
+++ b/src/Command/ConvertBBCodeCommand.php
@@ -154,14 +154,14 @@ class ConvertBBCodeCommand extends Command
foreach ($results as $result) {
/** @var AbstractNamedDBElement $result */
$io->writeln(
- 'Convert entity: '.$result->getName().' (' . get_class($result) . ': ' . $result->getID() . ')',
+ 'Convert entity: '.$result->getName().' ('.get_class($result).': '.$result->getID().')',
OutputInterface::VERBOSITY_VERBOSE
);
foreach ($properties as $property) {
//Retrieve bbcode from entity
$bbcode = $this->propertyAccessor->getValue($result, $property);
//Check if the current property really contains BBCode
- if (! preg_match(static::BBCODE_REGEX, $bbcode)) {
+ if (!preg_match(static::BBCODE_REGEX, $bbcode)) {
continue;
}
$io->writeln(
@@ -182,7 +182,7 @@ class ConvertBBCodeCommand extends Command
}
//If we are not in dry run, save changes to DB
- if (! $input->getOption('dry-run')) {
+ if (!$input->getOption('dry-run')) {
$this->em->flush();
$io->success('Changes saved to DB successfully!');
}
diff --git a/src/Command/SetPasswordCommand.php b/src/Command/SetPasswordCommand.php
index 8fc08d9d..be94ef79 100644
--- a/src/Command/SetPasswordCommand.php
+++ b/src/Command/SetPasswordCommand.php
@@ -102,14 +102,14 @@ class SetPasswordCommand extends Command
sprintf('You are going to change the password of %s with ID %d. Proceed?',
$user->getFullName(true), $user->getID()));
- if (! $proceed) {
+ if (!$proceed) {
return 1;
}
$success = false;
$new_password = '';
- while (! $success) {
+ while (!$success) {
$pw1 = $io->askHidden('Please enter new password:');
$pw2 = $io->askHidden('Please confirm:');
if ($pw1 !== $pw2) {
diff --git a/src/Command/UpdateExchangeRatesCommand.php b/src/Command/UpdateExchangeRatesCommand.php
index 3562681f..69f9a7b5 100644
--- a/src/Command/UpdateExchangeRatesCommand.php
+++ b/src/Command/UpdateExchangeRatesCommand.php
@@ -97,7 +97,7 @@ class UpdateExchangeRatesCommand extends Command
$iso_code = $input->getArgument('iso_code');
$repo = $this->em->getRepository(Currency::class);
- if (! empty($iso_code)) {
+ if (!empty($iso_code)) {
$candidates = $repo->findBy(['iso_code' => $iso_code]);
} else {
$candidates = $repo->findAll();
diff --git a/src/Controller/AdminPages/AttachmentTypeController.php b/src/Controller/AdminPages/AttachmentTypeController.php
index 289bc4f0..2395ff3c 100644
--- a/src/Controller/AdminPages/AttachmentTypeController.php
+++ b/src/Controller/AdminPages/AttachmentTypeController.php
@@ -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;
}
}
diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php
index e8ca6006..3d3e34d4 100644
--- a/src/Controller/AdminPages/BaseAdminController.php
+++ b/src/Controller/AdminPages/BaseAdminController.php
@@ -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,
@@ -203,7 +199,7 @@ abstract class BaseAdminController extends AbstractController
if (
$entity instanceof LabelProfile
&& 'twig' === $entity->getOptions()->getLinesMode()
- && ! $this->isGranted('@labels.use_twig')
+ && !$this->isGranted('@labels.use_twig')
) {
$form_options['disable_options'] = true;
}
@@ -251,7 +247,7 @@ abstract class BaseAdminController extends AbstractController
'attachment_class' => $this->attachment_class,
'parameter_class' => $this->parameter_class,
]);
- } elseif ($form->isSubmitted() && ! $form->isValid()) {
+ } elseif ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', 'entity.edit_flash.invalid');
}
@@ -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
@@ -346,7 +341,7 @@ abstract class BaseAdminController extends AbstractController
}
}
- if ($form->isSubmitted() && ! $form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', 'entity.created_flash.invalid');
}
@@ -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);
}
}
diff --git a/src/Controller/AdminPages/CategoryController.php b/src/Controller/AdminPages/CategoryController.php
index a922b475..75566ec5 100644
--- a/src/Controller/AdminPages/CategoryController.php
+++ b/src/Controller/AdminPages/CategoryController.php
@@ -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
{
diff --git a/src/Controller/AdminPages/CurrencyController.php b/src/Controller/AdminPages/CurrencyController.php
index db298a20..98d08921 100644
--- a/src/Controller/AdminPages/CurrencyController.php
+++ b/src/Controller/AdminPages/CurrencyController.php
@@ -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;
}
}
diff --git a/src/Controller/AdminPages/DeviceController.php b/src/Controller/AdminPages/DeviceController.php
index 71ea2ae6..97bc1188 100644
--- a/src/Controller/AdminPages/DeviceController.php
+++ b/src/Controller/AdminPages/DeviceController.php
@@ -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
{
diff --git a/src/Controller/AdminPages/FootprintController.php b/src/Controller/AdminPages/FootprintController.php
index 1eec7ec6..6b5f437e 100644
--- a/src/Controller/AdminPages/FootprintController.php
+++ b/src/Controller/AdminPages/FootprintController.php
@@ -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
{
diff --git a/src/Controller/AdminPages/LabelProfileController.php b/src/Controller/AdminPages/LabelProfileController.php
index 6854e32e..a1de996d 100644
--- a/src/Controller/AdminPages/LabelProfileController.php
+++ b/src/Controller/AdminPages/LabelProfileController.php
@@ -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
{
diff --git a/src/Controller/AdminPages/ManufacturerController.php b/src/Controller/AdminPages/ManufacturerController.php
index c852ef9f..601ab92d 100644
--- a/src/Controller/AdminPages/ManufacturerController.php
+++ b/src/Controller/AdminPages/ManufacturerController.php
@@ -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
{
diff --git a/src/Controller/AdminPages/MeasurementUnitController.php b/src/Controller/AdminPages/MeasurementUnitController.php
index f47d4296..f16af70a 100644
--- a/src/Controller/AdminPages/MeasurementUnitController.php
+++ b/src/Controller/AdminPages/MeasurementUnitController.php
@@ -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
{
diff --git a/src/Controller/AdminPages/StorelocationController.php b/src/Controller/AdminPages/StorelocationController.php
index bc8646c9..b1ae63e2 100644
--- a/src/Controller/AdminPages/StorelocationController.php
+++ b/src/Controller/AdminPages/StorelocationController.php
@@ -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
{
diff --git a/src/Controller/AdminPages/SupplierController.php b/src/Controller/AdminPages/SupplierController.php
index 9e9e27dc..6bad7e04 100644
--- a/src/Controller/AdminPages/SupplierController.php
+++ b/src/Controller/AdminPages/SupplierController.php
@@ -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
{
diff --git a/src/Controller/AttachmentFileController.php b/src/Controller/AttachmentFileController.php
index b2683e12..9d9ba2f1 100644
--- a/src/Controller/AttachmentFileController.php
+++ b/src/Controller/AttachmentFileController.php
@@ -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
{
@@ -77,7 +75,7 @@ class AttachmentFileController extends AbstractController
throw new RuntimeException('You can not download external attachments!');
}
- if (! $helper->isFileExisting($attachment)) {
+ if (!$helper->isFileExisting($attachment)) {
throw new RuntimeException('The file associated with the attachment is not existing!');
}
@@ -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
{
@@ -109,7 +105,7 @@ class AttachmentFileController extends AbstractController
throw new RuntimeException('You can not download external attachments!');
}
- if (! $helper->isFileExisting($attachment)) {
+ if (!$helper->isFileExisting($attachment)) {
throw new RuntimeException('The file associated with the attachment is not existing!');
}
diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php
index 36c61f63..85b1897f 100644
--- a/src/Controller/GroupController.php
+++ b/src/Controller/GroupController.php
@@ -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;
}
}
diff --git a/src/Controller/HomepageController.php b/src/Controller/HomepageController.php
index ebf6fa96..b9126867 100644
--- a/src/Controller/HomepageController.php
+++ b/src/Controller/HomepageController.php
@@ -81,8 +81,6 @@ class HomepageController extends AbstractController
/**
* @Route("/", name="homepage")
- *
- * @return \Symfony\Component\HttpFoundation\Response
*/
public function homepage(Request $request, GitVersionInfo $versionInfo): Response
{
diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php
index ac888ccb..33b6d2d3 100644
--- a/src/Controller/LabelController.php
+++ b/src/Controller/LabelController.php
@@ -81,7 +81,7 @@ class LabelController extends AbstractController
}
//We have to disable the options, if twig mode is selected and user is not allowed to use it.
- $disable_options = 'twig' === $label_options->getLinesMode() && ! $this->isGranted('@labels.use_twig');
+ $disable_options = 'twig' === $label_options->getLinesMode() && !$this->isGranted('@labels.use_twig');
$form = $this->createForm(LabelDialogType::class, null, [
'disable_options' => $disable_options,
@@ -109,10 +109,10 @@ class LabelController extends AbstractController
$filename = 'invalid.pdf';
//Generate PDF either when the form is submitted and valid, or the form was not submit yet, and generate is set
- if (($form->isSubmitted() && $form->isValid()) || ($generate && ! $form->isSubmitted() && null !== $profile)) {
+ if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && null !== $profile)) {
$target_id = (string) $form->get('target_id')->getData();
$targets = $this->findObjects($form_options->getSupportedElement(), $target_id);
- if (! empty($targets)) {
+ if (!empty($targets)) {
try {
$pdf_data = $this->labelGenerator->generateLabel($form_options, $targets);
$filename = $this->getLabelName($targets[0], $profile);
@@ -145,7 +145,7 @@ class LabelController extends AbstractController
protected function findObjects(string $type, string $ids): array
{
- if (! isset(LabelGenerator::CLASS_SUPPORT_MAPPING[$type])) {
+ if (!isset(LabelGenerator::CLASS_SUPPORT_MAPPING[$type])) {
throw new \InvalidArgumentException('The given type is not known and can not be mapped to a class!');
}
diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php
index 9c34be59..9195c70c 100644
--- a/src/Controller/LogController.php
+++ b/src/Controller/LogController.php
@@ -145,7 +145,7 @@ class LogController extends AbstractController
$this->dbRepository->changeID($element, $logEntry->getTargetID());
}
- if (! $element instanceof AbstractDBElement) {
+ if (!$element instanceof AbstractDBElement) {
$this->addFlash('error', 'log.undo.target_not_found');
return;
diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php
index 57fcfcd3..7f3b1c5b 100644
--- a/src/Controller/PartController.php
+++ b/src/Controller/PartController.php
@@ -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,13 +179,13 @@ 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()]);
}
//Reload form, so the SIUnitType entries use the new part unit
$form = $this->createForm(PartBaseType::class, $part);
- } elseif ($form->isSubmitted() && ! $form->isValid()) {
+ } elseif ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', 'part.edited_flash.invalid');
}
@@ -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,14 +302,14 @@ 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()]);
}
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
}
- if ($form->isSubmitted() && ! $form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', 'part.created_flash.invalid');
}
diff --git a/src/Controller/PartListsController.php b/src/Controller/PartListsController.php
index e5e0065b..3d4d339e 100644
--- a/src/Controller/PartListsController.php
+++ b/src/Controller/PartListsController.php
@@ -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);
}
diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php
index b0d9b4ab..72cc3477 100644
--- a/src/Controller/RedirectController.php
+++ b/src/Controller/RedirectController.php
@@ -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
{
@@ -79,7 +77,7 @@ class RedirectController extends AbstractController
//Check if a user has set a preferred language setting:
$user = $this->getUser();
- if (($user instanceof User) && ! empty($user->getLanguage())) {
+ if (($user instanceof User) && !empty($user->getLanguage())) {
$locale = $user->getLanguage();
}
@@ -87,7 +85,7 @@ class RedirectController extends AbstractController
$new_url = $request->getUriForPath('/'.$locale.$request->getPathInfo());
//If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string
- if (($this->enforce_index_php || ! $this->checkIfModRewriteAvailable())
+ if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable())
&& false === strpos($new_url, 'index.php')) {
//Like Request::getUriForPath only with index.php
$new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo();
@@ -100,12 +98,10 @@ 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
{
- if (! function_exists('apache_get_modules')) {
+ if (!function_exists('apache_get_modules')) {
//If we can not check for apache modules, we just hope for the best and assume url rewriting is available
//If you want to enforce index.php versions of the url, you can override this via ENV vars.
return true;
diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php
index 1f1c0bbe..f0058c8c 100644
--- a/src/Controller/SecurityController.php
+++ b/src/Controller/SecurityController.php
@@ -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
{
@@ -101,7 +99,7 @@ class SecurityController extends AbstractController
*/
public function requestPwReset(PasswordResetManager $passwordReset, Request $request)
{
- if (! $this->allow_email_pw_reset) {
+ if (!$this->allow_email_pw_reset) {
throw new AccessDeniedHttpException('The password reset via email is disabled!');
}
@@ -145,7 +143,7 @@ class SecurityController extends AbstractController
*/
public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null)
{
- if (! $this->allow_email_pw_reset) {
+ if (!$this->allow_email_pw_reset) {
throw new AccessDeniedHttpException('The password reset via email is disabled!');
}
@@ -190,7 +188,7 @@ class SecurityController extends AbstractController
$data = $form->getData();
//Try to set the new password
$success = $passwordReset->setNewPassword($data['username'], $data['token'], $data['new_password']);
- if (! $success) {
+ if (!$success) {
$this->addFlash('error', 'pw_reset.new_pw.error');
} else {
$this->addFlash('success', 'pw_reset.new_pw.success');
diff --git a/src/Controller/SelectAPIController.php b/src/Controller/SelectAPIController.php
index 851850f7..f1899d47 100644
--- a/src/Controller/SelectAPIController.php
+++ b/src/Controller/SelectAPIController.php
@@ -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);
@@ -107,14 +104,14 @@ class SelectAPIController extends AbstractController
foreach ($nodes_list as $node) {
/** @var AbstractStructuralDBElement $node */
$entry = [
- 'text' => str_repeat(' ', $node->getLevel()) . htmlspecialchars($node->getName()),
+ 'text' => str_repeat(' ', $node->getLevel()).htmlspecialchars($node->getName()),
'value' => $node->getID(),
'data-subtext' => $node->getParent() ? $node->getParent()->getFullPath() : null,
];
- $entries[] = $entry;
+ $entries[] = $entry;
}
return $entries;
}
-}
\ No newline at end of file
+}
diff --git a/src/Controller/StatisticsController.php b/src/Controller/StatisticsController.php
index 99ff5bd8..989c2f36 100644
--- a/src/Controller/StatisticsController.php
+++ b/src/Controller/StatisticsController.php
@@ -32,8 +32,6 @@ class StatisticsController extends AbstractController
{
/**
* @Route("/statistics", name="statistics_view")
- *
- * @return Response
*/
public function showStatistics(StatisticsHelper $helper): Response
{
diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php
index 248f2fed..a7a95db6 100644
--- a/src/Controller/ToolsController.php
+++ b/src/Controller/ToolsController.php
@@ -1,28 +1,23 @@
denyAccessUnlessGranted('@tools.reel_calculator');
- return $this->render("Tools/ReelCalculator/main.html.twig");
+ return $this->render('Tools/ReelCalculator/main.html.twig');
}
-}
\ No newline at end of file
+}
diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php
index 4443ccdb..4c340079 100644
--- a/src/Controller/TreeController.php
+++ b/src/Controller/TreeController.php
@@ -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
{
diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php
index 7d9f2810..7a51f6d3 100644
--- a/src/Controller/UserController.php
+++ b/src/Controller/UserController.php
@@ -88,6 +88,7 @@ class UserController extends AdminPages\BaseAdminController
$event = new SecurityEvent($entity);
$this->eventDispatcher->dispatch($event, SecurityEvents::PASSWORD_CHANGED);
}
+
return true;
}
@@ -132,7 +133,7 @@ class UserController extends AdminPages\BaseAdminController
protected function additionalActionNew(FormInterface $form, AbstractNamedDBElement $entity): bool
{
- if ($entity instanceof User && ! empty($form['new_password']->getData())) {
+ if ($entity instanceof User && !empty($form['new_password']->getData())) {
$password = $this->passwordEncoder->encodePassword($entity, $form['new_password']->getData());
$entity->setPassword($password);
//By default the user must change the password afterwards
@@ -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,15 +198,13 @@ 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
{
//If no user id was passed, then we show info about the current user
if (null === $user) {
$tmp = $this->getUser();
- if (! $tmp instanceof User) {
+ if (!$tmp instanceof User) {
throw new InvalidArgumentException('Userinfo only works for database users!');
}
$user = $tmp;
diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php
index 7ff41a65..4b64a5df 100644
--- a/src/Controller/UserSettingsController.php
+++ b/src/Controller/UserSettingsController.php
@@ -93,7 +93,7 @@ class UserSettingsController extends AbstractController
//When user change its settings, he should be logged in fully.
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
return new RuntimeException('This controller only works only for Part-DB User objects!');
}
@@ -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
{
@@ -124,7 +122,7 @@ class UserSettingsController extends AbstractController
//When user change its settings, he should be logged in fully.
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
throw new RuntimeException('This controller only works only for Part-DB User objects!');
}
@@ -178,7 +176,7 @@ class UserSettingsController extends AbstractController
//When user change its settings, he should be logged in fully.
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
return new RuntimeException('This controller only works only for Part-DB User objects!');
}
@@ -211,7 +209,7 @@ class UserSettingsController extends AbstractController
//When user change its settings, he should be logged in fully.
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
throw new RuntimeException('This controller only works only for Part-DB User objects!');
}
@@ -225,7 +223,7 @@ class UserSettingsController extends AbstractController
$form->handleRequest($request);
- if (! $this->demo_mode && $form->isSubmitted() && $form->isValid()) {
+ if (!$this->demo_mode && $form->isSubmitted() && $form->isValid()) {
//Check if user theme setting has changed
if ($user->getTheme() !== $em->getUnitOfWork()->getOriginalEntityData($user)['theme']) {
$page_need_reload = true;
@@ -285,7 +283,7 @@ class UserSettingsController extends AbstractController
$pw_form->handleRequest($request);
//Check if password if everything was correct, then save it to User and DB
- if (! $this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) {
+ if (!$this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) {
$password = $passwordEncoder->encodePassword($user, $pw_form['new_password']->getData());
$user->setPassword($password);
@@ -301,14 +299,14 @@ class UserSettingsController extends AbstractController
//Handle 2FA things
$google_form = $this->createForm(TFAGoogleSettingsType::class, $user);
$google_enabled = $user->isGoogleAuthenticatorEnabled();
- if (! $google_enabled && ! $form->isSubmitted()) {
+ if (!$google_enabled && !$form->isSubmitted()) {
$user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret());
$google_form->get('googleAuthenticatorSecret')->setData($user->getGoogleAuthenticatorSecret());
}
$google_form->handleRequest($request);
- if (! $this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) {
- if (! $google_enabled) {
+ if (!$this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) {
+ if (!$google_enabled) {
//Save 2FA settings (save secrets)
$user->setGoogleAuthenticatorSecret($google_form->get('googleAuthenticatorSecret')->getData());
$backupCodeManager->enableBackupCodes($user);
@@ -340,7 +338,7 @@ class UserSettingsController extends AbstractController
])->getForm();
$backup_form->handleRequest($request);
- if (! $this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) {
+ if (!$this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) {
$backupCodeManager->regenerateBackupCodes($user);
$em->flush();
$this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated');
diff --git a/src/DataFixtures/DataStructureFixtures.php b/src/DataFixtures/DataStructureFixtures.php
index 8100c8b7..a9aad137 100644
--- a/src/DataFixtures/DataStructureFixtures.php
+++ b/src/DataFixtures/DataStructureFixtures.php
@@ -89,7 +89,7 @@ class DataStructureFixtures extends Fixture
*/
public function createNodesForClass(string $class, ObjectManager $manager): void
{
- if (! new $class() instanceof AbstractStructuralDBElement) {
+ if (!new $class() instanceof AbstractStructuralDBElement) {
throw new InvalidArgumentException('$class must be a StructuralDBElement!');
}
diff --git a/src/DataTables/Adapter/ORMAdapter.php b/src/DataTables/Adapter/ORMAdapter.php
index b1d0bf18..467398ef 100644
--- a/src/DataTables/Adapter/ORMAdapter.php
+++ b/src/DataTables/Adapter/ORMAdapter.php
@@ -234,7 +234,7 @@ class ORMAdapter extends AbstractAdapter
$qb->resetDQLPart('orderBy');
$gb = $qb->getDQLPart('groupBy');
- if (empty($gb) || ! $this->hasGroupByPart($identifier, $gb)) {
+ if (empty($gb) || !$this->hasGroupByPart($identifier, $gb)) {
$qb->select($qb->expr()->count($identifier));
return (int) $qb->getQuery()->getSingleScalarResult();
diff --git a/src/DataTables/AttachmentDataTable.php b/src/DataTables/AttachmentDataTable.php
index 0d1f02a0..3391cd4a 100644
--- a/src/DataTables/AttachmentDataTable.php
+++ b/src/DataTables/AttachmentDataTable.php
@@ -81,12 +81,11 @@ final class AttachmentDataTable implements DataTableTypeInterface
'label' => '',
'render' => function ($value, Attachment $context) {
if ($context->isPicture()
- && ! $context->isExternal()
+ && !$context->isExternal()
&& $this->attachmentHelper->isFileExisting($context)) {
-
$title = htmlspecialchars($context->getName());
if ($context->getFilename()) {
- $title .= ' (' . htmlspecialchars($context->getFilename()) . ')';
+ $title .= ' ('.htmlspecialchars($context->getFilename()).')';
}
return sprintf(
diff --git a/src/DataTables/Column/EntityColumn.php b/src/DataTables/Column/EntityColumn.php
index 52be254f..583f6ebd 100644
--- a/src/DataTables/Column/EntityColumn.php
+++ b/src/DataTables/Column/EntityColumn.php
@@ -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)
{
diff --git a/src/DataTables/Column/LocaleDateTimeColumn.php b/src/DataTables/Column/LocaleDateTimeColumn.php
index 86ec7fa8..c22311ed 100644
--- a/src/DataTables/Column/LocaleDateTimeColumn.php
+++ b/src/DataTables/Column/LocaleDateTimeColumn.php
@@ -59,7 +59,7 @@ class LocaleDateTimeColumn extends AbstractColumn
{
if (null === $value) {
return $this->options['nullValue'];
- } elseif (! $value instanceof DateTimeInterface) {
+ } elseif (!$value instanceof DateTimeInterface) {
$value = new DateTime((string) $value);
}
diff --git a/src/DataTables/Column/LogEntryTargetColumn.php b/src/DataTables/Column/LogEntryTargetColumn.php
index f4e8a62b..1314900f 100644
--- a/src/DataTables/Column/LogEntryTargetColumn.php
+++ b/src/DataTables/Column/LogEntryTargetColumn.php
@@ -104,7 +104,7 @@ class LogEntryTargetColumn extends AbstractColumn
$tmp = '';
//The element is existing
- if ($target instanceof NamedElementInterface && ! empty($target->getName())) {
+ if ($target instanceof NamedElementInterface && !empty($target->getName())) {
try {
$tmp = sprintf(
'%s',
diff --git a/src/DataTables/Column/MarkdownColumn.php b/src/DataTables/Column/MarkdownColumn.php
index d7530c85..20294f64 100644
--- a/src/DataTables/Column/MarkdownColumn.php
+++ b/src/DataTables/Column/MarkdownColumn.php
@@ -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)
{
diff --git a/src/DataTables/Column/PartAttachmentsColumn.php b/src/DataTables/Column/PartAttachmentsColumn.php
index a7722e76..885ac6dc 100644
--- a/src/DataTables/Column/PartAttachmentsColumn.php
+++ b/src/DataTables/Column/PartAttachmentsColumn.php
@@ -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)
{
@@ -78,7 +76,7 @@ class PartAttachmentsColumn extends AbstractColumn
public function render($value, $context)
{
- if (! $context instanceof Part) {
+ if (!$context instanceof Part) {
throw new RuntimeException('$context must be a Part object!');
}
$tmp = '';
diff --git a/src/DataTables/Column/RevertLogColumn.php b/src/DataTables/Column/RevertLogColumn.php
index 51009741..bd730d89 100644
--- a/src/DataTables/Column/RevertLogColumn.php
+++ b/src/DataTables/Column/RevertLogColumn.php
@@ -65,7 +65,7 @@ class RevertLogColumn extends AbstractColumn
return '';
}
- $disabled = ! $this->security->isGranted('revert_element', $context->getTargetClass());
+ $disabled = !$this->security->isGranted('revert_element', $context->getTargetClass());
$tmp = '
';
$tmp .= sprintf(
diff --git a/src/DataTables/Column/TagsColumn.php b/src/DataTables/Column/TagsColumn.php
index 2f845463..678a151c 100644
--- a/src/DataTables/Column/TagsColumn.php
+++ b/src/DataTables/Column/TagsColumn.php
@@ -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)
{
diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php
index ce0eaa7c..bf8268d1 100644
--- a/src/DataTables/LogDataTable.php
+++ b/src/DataTables/LogDataTable.php
@@ -103,7 +103,7 @@ class LogDataTable implements DataTableTypeInterface
$optionsResolver->setAllowedTypes('mode', 'string');
$optionsResolver->setNormalizer('filter_elements', function (Options $options, $value) {
- if (! is_array($value)) {
+ if (!is_array($value)) {
return [$value];
}
@@ -254,8 +254,8 @@ class LogDataTable implements DataTableTypeInterface
},
'disabled' => function ($value, AbstractLogEntry $context) {
return
- ! $this->security->isGranted('@tools.timetravel')
- || ! $this->security->isGranted('show_history', $context->getTargetClass());
+ !$this->security->isGranted('@tools.timetravel')
+ || !$this->security->isGranted('show_history', $context->getTargetClass());
},
]);
@@ -293,7 +293,7 @@ class LogDataTable implements DataTableTypeInterface
]);
}
- if (! empty($options['filter_elements'])) {
+ if (!empty($options['filter_elements'])) {
foreach ($options['filter_elements'] as $element) {
/** @var AbstractDBElement $element */
diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php
index 7c79683d..d070ea60 100644
--- a/src/DataTables/PartsDataTable.php
+++ b/src/DataTables/PartsDataTable.php
@@ -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;
@@ -163,7 +162,7 @@ final class PartsDataTable implements DataTableTypeInterface
$title = htmlspecialchars($preview_attachment->getName());
if ($preview_attachment->getFilename()) {
- $title .= ' (' . htmlspecialchars($preview_attachment->getFilename()) . ')';
+ $title .= ' ('.htmlspecialchars($preview_attachment->getFilename()).')';
}
return sprintf(
@@ -396,8 +395,8 @@ final class PartsDataTable implements DataTableTypeInterface
$builder->andWhere('part.tags LIKE :tag')->setParameter('tag', '%'.$options['tag'].'%');
}
- if (! empty($options['search'])) {
- if (! $options['search_options']['regex']) {
+ if (!empty($options['search'])) {
+ if (!$options['search_options']['regex']) {
//Dont show results, if no things are selected
$builder->andWhere('0=1');
$defined = false;
diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php
index 9c86ca87..62335f2c 100644
--- a/src/Entity/Attachments/Attachment.php
+++ b/src/Entity/Attachments/Attachment.php
@@ -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%'];
@@ -182,7 +182,7 @@ abstract class Attachment extends AbstractNamedDBElement
return true;
}
- return ! in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
+ return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
}
/**
@@ -233,7 +233,7 @@ abstract class Attachment extends AbstractNamedDBElement
return null;
}
- if (! empty($this->original_filename)) {
+ if (!empty($this->original_filename)) {
return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION));
}
@@ -256,7 +256,7 @@ abstract class Attachment extends AbstractNamedDBElement
*/
public function getURL(): ?string
{
- if (! $this->isExternal() && ! $this->isBuiltIn()) {
+ if (!$this->isExternal() && !$this->isBuiltIn()) {
return null;
}
@@ -269,7 +269,7 @@ abstract class Attachment extends AbstractNamedDBElement
*/
public function getHost(): ?string
{
- if (! $this->isExternal()) {
+ if (!$this->isExternal()) {
return null;
}
@@ -299,7 +299,7 @@ abstract class Attachment extends AbstractNamedDBElement
}
//If we have a stored original filename, then use it
- if (! empty($this->original_filename)) {
+ if (!empty($this->original_filename)) {
return $this->original_filename;
}
@@ -345,7 +345,6 @@ abstract class Attachment extends AbstractNamedDBElement
return $this->attachment_type;
}
-
/*****************************************************************************************************
* Setters
***************************************************************************************************
@@ -367,7 +366,7 @@ abstract class Attachment extends AbstractNamedDBElement
*/
public function setElement(AttachmentContainingDBElement $element): self
{
- if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
+ if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
}
@@ -409,7 +408,7 @@ abstract class Attachment extends AbstractNamedDBElement
public function setURL(?string $url): self
{
//Only set if the URL is not empty
- if (! empty($url)) {
+ if (!empty($url)) {
if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) {
throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
}
diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php
index e77b62e0..ae102bd1 100644
--- a/src/Entity/Attachments/AttachmentType.php
+++ b/src/Entity/Attachments/AttachmentType.php
@@ -118,5 +118,4 @@ class AttachmentType extends AbstractStructuralDBElement
return $this;
}
-
}
diff --git a/src/Entity/Base/AbstractNamedDBElement.php b/src/Entity/Base/AbstractNamedDBElement.php
index 9356360e..1cb5ac85 100644
--- a/src/Entity/Base/AbstractNamedDBElement.php
+++ b/src/Entity/Base/AbstractNamedDBElement.php
@@ -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
{
diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php
index a813d1f3..e6e65622 100644
--- a/src/Entity/Base/AbstractPartsContainingDBElement.php
+++ b/src/Entity/Base/AbstractPartsContainingDBElement.php
@@ -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
{
-
}
diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php
index 2cb8506d..7f5e9dc2 100644
--- a/src/Entity/Base/AbstractStructuralDBElement.php
+++ b/src/Entity/Base/AbstractStructuralDBElement.php
@@ -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
*/
@@ -140,7 +140,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
//Check if both elements compared, are from the same type
// (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type):
- if (! is_a($another_element, $class_name) && ! is_a($this, get_class($another_element))) {
+ if (!is_a($another_element, $class_name) && !is_a($this, get_class($another_element))) {
throw new InvalidArgumentException('isChildOf() only works for objects of the same type!');
}
@@ -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
{
@@ -256,7 +256,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
$tmp[] = $this;
//We only allow 20 levels depth
- while (! end($tmp)->isRoot() && count($tmp) < 20) {
+ while (!end($tmp)->isRoot() && count($tmp) < 20) {
$tmp[] = end($tmp)->parent;
}
@@ -283,9 +283,6 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
return $this->children;
}
- /**
- * @return bool
- */
public function isNotSelectable(): bool
{
return $this->not_selectable;
@@ -337,7 +334,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
*/
public function setChildren($elements): self
{
- if (! is_array($elements) && ! $elements instanceof Collection) {
+ if (!is_array($elements) && !$elements instanceof Collection) {
throw new InvalidArgumentException('$elements must be an array or Collection!');
}
diff --git a/src/Entity/Base/PartsContainingRepositoryInterface.php b/src/Entity/Base/PartsContainingRepositoryInterface.php
index bcdaa07a..97a7bd12 100644
--- a/src/Entity/Base/PartsContainingRepositoryInterface.php
+++ b/src/Entity/Base/PartsContainingRepositoryInterface.php
@@ -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 array $order_by The order of the parts. Format ['name' => 'ASC']
+ *
+ * @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;
-}
\ No newline at end of file
+}
diff --git a/src/Entity/Contracts/LogWithCommentInterface.php b/src/Entity/Contracts/LogWithCommentInterface.php
index d00c6dfc..8ed1f311 100644
--- a/src/Entity/Contracts/LogWithCommentInterface.php
+++ b/src/Entity/Contracts/LogWithCommentInterface.php
@@ -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;
diff --git a/src/Entity/Contracts/LogWithEventUndoInterface.php b/src/Entity/Contracts/LogWithEventUndoInterface.php
index 87ace4d5..0f41e893 100644
--- a/src/Entity/Contracts/LogWithEventUndoInterface.php
+++ b/src/Entity/Contracts/LogWithEventUndoInterface.php
@@ -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;
}
diff --git a/src/Entity/Contracts/TimeTravelInterface.php b/src/Entity/Contracts/TimeTravelInterface.php
index d15416a0..2cd43161 100644
--- a/src/Entity/Contracts/TimeTravelInterface.php
+++ b/src/Entity/Contracts/TimeTravelInterface.php
@@ -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;
}
diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php
index 4213f008..417df882 100644
--- a/src/Entity/LabelSystem/LabelOptions.php
+++ b/src/Entity/LabelSystem/LabelOptions.php
@@ -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;
diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php
index 1df63357..c964a3cd 100644
--- a/src/Entity/LabelSystem/LabelProfile.php
+++ b/src/Entity/LabelSystem/LabelProfile.php
@@ -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
{
diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php
index 67c9c350..fe573395 100644
--- a/src/Entity/LogSystem/AbstractLogEntry.php
+++ b/src/Entity/LogSystem/AbstractLogEntry.php
@@ -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
*/
@@ -394,7 +386,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
*/
final public static function levelIntToString(int $level): string
{
- if (! isset(self::LEVEL_ID_TO_STRING[$level])) {
+ if (!isset(self::LEVEL_ID_TO_STRING[$level])) {
throw new \InvalidArgumentException('No level with this int is existing!');
}
@@ -406,12 +398,12 @@ 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
{
$tmp = array_flip(self::LEVEL_ID_TO_STRING);
- if (! isset($tmp[$level])) {
+ if (!isset($tmp[$level])) {
throw new \InvalidArgumentException('No level with this string is existing!');
}
@@ -422,12 +414,10 @@ 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
{
- if (! isset(self::TARGET_CLASS_MAPPING[$type_id])) {
+ if (!isset(self::TARGET_CLASS_MAPPING[$type_id])) {
throw new \InvalidArgumentException('No target type with this ID is existing!');
}
@@ -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
{
diff --git a/src/Entity/LogSystem/CollectionElementDeleted.php b/src/Entity/LogSystem/CollectionElementDeleted.php
index a37a8c8b..53cb9529 100644
--- a/src/Entity/LogSystem/CollectionElementDeleted.php
+++ b/src/Entity/LogSystem/CollectionElementDeleted.php
@@ -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
{
diff --git a/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php b/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php
index 8c25adde..5ee0fe04 100644
--- a/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php
+++ b/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php
@@ -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
{
diff --git a/src/Entity/LogSystem/ElementCreatedLogEntry.php b/src/Entity/LogSystem/ElementCreatedLogEntry.php
index 3cbf53a3..51ff75fa 100644
--- a/src/Entity/LogSystem/ElementCreatedLogEntry.php
+++ b/src/Entity/LogSystem/ElementCreatedLogEntry.php
@@ -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
{
diff --git a/src/Entity/LogSystem/ElementDeletedLogEntry.php b/src/Entity/LogSystem/ElementDeletedLogEntry.php
index d3a7f47b..7768b4bd 100644
--- a/src/Entity/LogSystem/ElementDeletedLogEntry.php
+++ b/src/Entity/LogSystem/ElementDeletedLogEntry.php
@@ -109,7 +109,7 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
public function hasOldDataInformations(): bool
{
- return ! empty($this->extra['o']);
+ return !empty($this->extra['o']);
}
public function getOldData(): array
diff --git a/src/Entity/LogSystem/ElementEditedLogEntry.php b/src/Entity/LogSystem/ElementEditedLogEntry.php
index d3449cfc..dd32eaa2 100644
--- a/src/Entity/LogSystem/ElementEditedLogEntry.php
+++ b/src/Entity/LogSystem/ElementEditedLogEntry.php
@@ -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
{
@@ -115,7 +113,7 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
public function hasOldDataInformations(): bool
{
- return ! empty($this->extra['d']);
+ return !empty($this->extra['d']);
}
public function getOldData(): array
diff --git a/src/Entity/LogSystem/ExceptionLogEntry.php b/src/Entity/LogSystem/ExceptionLogEntry.php
index 6f8c7d86..07bcccd5 100644
--- a/src/Entity/LogSystem/ExceptionLogEntry.php
+++ b/src/Entity/LogSystem/ExceptionLogEntry.php
@@ -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
{
diff --git a/src/Entity/LogSystem/InstockChangedLogEntry.php b/src/Entity/LogSystem/InstockChangedLogEntry.php
index a72e160f..cd51dfcf 100644
--- a/src/Entity/LogSystem/InstockChangedLogEntry.php
+++ b/src/Entity/LogSystem/InstockChangedLogEntry.php
@@ -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
{
diff --git a/src/Entity/LogSystem/SecurityEventLogEntry.php b/src/Entity/LogSystem/SecurityEventLogEntry.php
index 9fdca9f7..991bd9d2 100644
--- a/src/Entity/LogSystem/SecurityEventLogEntry.php
+++ b/src/Entity/LogSystem/SecurityEventLogEntry.php
@@ -59,7 +59,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
public function setTargetElement(?AbstractDBElement $element): AbstractLogEntry
{
- if (! $element instanceof User) {
+ if (!$element instanceof User) {
throw new \InvalidArgumentException('Target element must be a User object!');
}
@@ -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
diff --git a/src/Entity/LogSystem/UserLoginLogEntry.php b/src/Entity/LogSystem/UserLoginLogEntry.php
index 7dac1040..76ebfa44 100644
--- a/src/Entity/LogSystem/UserLoginLogEntry.php
+++ b/src/Entity/LogSystem/UserLoginLogEntry.php
@@ -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
diff --git a/src/Entity/LogSystem/UserLogoutLogEntry.php b/src/Entity/LogSystem/UserLogoutLogEntry.php
index 19e38c4c..9cb93bb4 100644
--- a/src/Entity/LogSystem/UserLogoutLogEntry.php
+++ b/src/Entity/LogSystem/UserLogoutLogEntry.php
@@ -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
diff --git a/src/Entity/LogSystem/UserNotAllowedLogEntry.php b/src/Entity/LogSystem/UserNotAllowedLogEntry.php
index 8d9d607f..1967d62e 100644
--- a/src/Entity/LogSystem/UserNotAllowedLogEntry.php
+++ b/src/Entity/LogSystem/UserNotAllowedLogEntry.php
@@ -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
{
diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php
index 9584ed70..8022f9d5 100644
--- a/src/Entity/Parameters/AbstractParameter.php
+++ b/src/Entity/Parameters/AbstractParameter.php
@@ -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
{
@@ -188,7 +184,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
*/
public function setElement(AbstractDBElement $element): self
{
- if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
+ if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
}
@@ -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,13 +373,11 @@ 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
{
$str = \sprintf($format, $value);
- if (! empty($this->unit)) {
+ if (!empty($this->unit)) {
return $str.' '.$this->unit;
}
diff --git a/src/Entity/Parameters/ParametersTrait.php b/src/Entity/Parameters/ParametersTrait.php
index 1d088afd..e3c7b95e 100644
--- a/src/Entity/Parameters/ParametersTrait.php
+++ b/src/Entity/Parameters/ParametersTrait.php
@@ -39,8 +39,6 @@ trait ParametersTrait
/**
* Return all associated specifications.
*
- * @return Collection
- *
* @psalm-return Collection
*/
public function getParameters(): \Doctrine\Common\Collections\Collection
diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php
index e0fee90f..0c344d38 100644
--- a/src/Entity/Parts/Category.php
+++ b/src/Entity/Parts/Category.php
@@ -111,7 +111,6 @@ class Category extends AbstractPartsContainingDBElement
*/
protected $parameters;
-
public function getPartnameHint(): string
{
return $this->partname_hint;
diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php
index 246ca4e3..7dc48bc3 100644
--- a/src/Entity/Parts/Footprint.php
+++ b/src/Entity/Parts/Footprint.php
@@ -99,7 +99,6 @@ class Footprint extends AbstractPartsContainingDBElement
*/
protected $parameters;
-
/****************************************
* Getters
****************************************/
diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php
index 7ffa238a..35df15d1 100644
--- a/src/Entity/Parts/MeasurementUnit.php
+++ b/src/Entity/Parts/MeasurementUnit.php
@@ -109,7 +109,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
*/
protected $parameters;
-
/**
* @return string
*/
diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php
index a067ff1a..7743ac3f 100644
--- a/src/Entity/Parts/Part.php
+++ b/src/Entity/Parts/Part.php
@@ -176,7 +176,6 @@ class Part extends AttachmentContainingDBElement
parent::__clone();
}
-
/**
* Get all devices which uses this part.
*
diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php
index 67234d73..d04d54b6 100644
--- a/src/Entity/Parts/PartLot.php
+++ b/src/Entity/Parts/PartLot.php
@@ -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,12 +270,9 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
return $this;
}
- /**
- * @return float
- */
public function getAmount(): float
{
- if ($this->part instanceof Part && ! $this->part->useFloatAmount()) {
+ if ($this->part instanceof Part && !$this->part->useFloatAmount()) {
return round($this->amount);
}
@@ -312,9 +298,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
return $this;
}
- /**
- * @return bool
- */
public function isNeedsRefill(): bool
{
return $this->needs_refill;
diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php
index 8f7516bd..ddc6d960 100644
--- a/src/Entity/Parts/PartTraits/InstockTrait.php
+++ b/src/Entity/Parts/PartTraits/InstockTrait.php
@@ -162,7 +162,7 @@ trait InstockTrait
public function useFloatAmount(): bool
{
if ($this->partUnit instanceof MeasurementUnit) {
- return ! $this->partUnit->isInteger();
+ return !$this->partUnit->isInteger();
}
//When no part unit is set, treat it as part count, and so use the integer value.
diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php
index 7f6ec2d5..a98bb03b 100644
--- a/src/Entity/Parts/PartTraits/OrderTrait.php
+++ b/src/Entity/Parts/PartTraits/OrderTrait.php
@@ -213,7 +213,7 @@ trait OrderTrait
}
foreach ($all_orderdetails as $orderdetails) {
- if (! $orderdetails->getObsolete()) {
+ if (!$orderdetails->getObsolete()) {
return false;
}
}
diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php
index a2e58c0a..3cfcbfda 100644
--- a/src/Entity/Parts/Storelocation.php
+++ b/src/Entity/Parts/Storelocation.php
@@ -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;
diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php
index 733af25f..3702ed95 100644
--- a/src/Entity/Parts/Supplier.php
+++ b/src/Entity/Parts/Supplier.php
@@ -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;
}
diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php
index 70ca7073..d05239a6 100644
--- a/src/Entity/PriceInformations/Currency.php
+++ b/src/Entity/PriceInformations/Currency.php
@@ -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;
@@ -68,7 +67,7 @@ class Currency extends AbstractStructuralDBElement
/**
* @var BigDecimal|null The exchange rate between this currency and the base currency
- * (how many base units the current currency is worth)
+ * (how many base units the current currency is worth)
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
* @BigDecimalPositive()
*/
@@ -119,9 +118,6 @@ class Currency extends AbstractStructuralDBElement
parent::__construct();
}
- /**
- * @return Collection
- */
public function getPricedetails(): Collection
{
return $this->pricedetails;
@@ -176,13 +172,13 @@ class Currency extends AbstractStructuralDBElement
* Sets the exchange rate of the currency.
*
* @param BigDecimal|null $exchange_rate The new exchange rate of the currency.
- * Set to null, if the exchange rate is unknown.
+ * Set to null, if the exchange rate is unknown.
*
* @return Currency
*/
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);
diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php
index e19e78b2..22b0be49 100644
--- a/src/Entity/PriceInformations/Pricedetail.php
+++ b/src/Entity/PriceInformations/Pricedetail.php
@@ -209,7 +209,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*/
public function getPriceRelatedQuantity(): float
{
- if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) {
+ if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
$tmp = round($this->price_related_quantity);
return $tmp < 1 ? 1 : $tmp;
@@ -232,7 +232,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*/
public function getMinDiscountQuantity(): float
{
- if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) {
+ if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
$tmp = round($this->min_discount_quantity);
return $tmp < 1 ? 1 : $tmp;
@@ -299,6 +299,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
if ((string) $tmp !== (string) $this->price) {
$this->price = $tmp;
}
+
return $this;
}
diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php
index d5b4c3ae..1b65ce96 100644
--- a/src/Entity/UserSystem/Group.php
+++ b/src/Entity/UserSystem/Group.php
@@ -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
*/
diff --git a/src/Entity/UserSystem/PermissionsEmbed.php b/src/Entity/UserSystem/PermissionsEmbed.php
index 63fed4d8..97987015 100644
--- a/src/Entity/UserSystem/PermissionsEmbed.php
+++ b/src/Entity/UserSystem/PermissionsEmbed.php
@@ -340,7 +340,7 @@ class PermissionsEmbed
*/
public function getBitValue(string $permission_name, int $bit_n): int
{
- if (! $this->isValidPermissionName($permission_name)) {
+ if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException(sprintf('No permission with the name "%s" is existing!', $permission_name));
}
@@ -410,7 +410,7 @@ class PermissionsEmbed
*/
public function setBitValue(string $permission_name, int $bit_n, int $new_value): self
{
- if (! $this->isValidPermissionName($permission_name)) {
+ if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException('No permission with the given name is existing!');
}
@@ -429,7 +429,7 @@ class PermissionsEmbed
*/
public function getRawPermissionValue(string $permission_name): int
{
- if (! $this->isValidPermissionName($permission_name)) {
+ if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException('No permission with the given name is existing!');
}
@@ -446,7 +446,7 @@ class PermissionsEmbed
*/
public function setRawPermissionValue(string $permission_name, int $value): self
{
- if (! $this->isValidPermissionName($permission_name)) {
+ if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException(sprintf('No permission with the given name %s is existing!', $permission_name));
}
@@ -466,7 +466,7 @@ class PermissionsEmbed
*/
public function setRawPermissionValues(array $values, ?array $values2 = null): self
{
- if (! empty($values2)) {
+ if (!empty($values2)) {
$values = array_combine($values, $values2);
}
@@ -493,6 +493,7 @@ class PermissionsEmbed
}
$mask = 0b11 << $n; //Create a mask for the data
+
return ($data & $mask) >> $n; //Apply mask and shift back
}
diff --git a/src/Entity/UserSystem/U2FKey.php b/src/Entity/UserSystem/U2FKey.php
index 84669865..a8cb4950 100644
--- a/src/Entity/UserSystem/U2FKey.php
+++ b/src/Entity/UserSystem/U2FKey.php
@@ -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
{
diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php
index c9dfa271..2a1178d1 100644
--- a/src/Entity/UserSystem/User.php
+++ b/src/Entity/UserSystem/User.php
@@ -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
{
@@ -498,7 +491,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
{
$tmp = $this->getFirstName();
//Dont add a space, if the name has only one part (it would look strange)
- if (! empty($this->getFirstName()) && ! empty($this->getLastName())) {
+ if (!empty($this->getFirstName()) && !empty($this->getLastName())) {
$tmp .= ' ';
}
$tmp .= $this->getLastName();
@@ -513,14 +506,14 @@ 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
*/
public function setName(string $new_name): AbstractNamedDBElement
{
// Anonymous user is not allowed to change its username
- if (! $this->isAnonymousUser()) {
+ if (!$this->isAnonymousUser()) {
$this->name = $new_name;
}
@@ -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
*/
public function getU2FKeys(): Collection
diff --git a/src/EntityListeners/AttachmentDeleteListener.php b/src/EntityListeners/AttachmentDeleteListener.php
index bf17a1fc..17bc0088 100644
--- a/src/EntityListeners/AttachmentDeleteListener.php
+++ b/src/EntityListeners/AttachmentDeleteListener.php
@@ -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;
}
diff --git a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php
index 484ef53c..8f58f231 100644
--- a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php
+++ b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php
@@ -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,14 +295,12 @@ class EventLoggerSubscriber implements EventSubscriber
/**
* Filter out every forbidden field and return the cleaned array.
- *
- * @return array
*/
protected function filterFieldRestrictions(AbstractDBElement $element, array $fields): array
{
unset($fields['lastModified']);
- if (! $this->hasFieldRestrictions($element)) {
+ if (!$this->hasFieldRestrictions($element)) {
return $fields;
}
@@ -322,7 +318,7 @@ class EventLoggerSubscriber implements EventSubscriber
{
$uow = $em->getUnitOfWork();
- if (! $logEntry instanceof ElementEditedLogEntry && ! $logEntry instanceof ElementDeletedLogEntry) {
+ if (!$logEntry instanceof ElementEditedLogEntry && !$logEntry instanceof ElementDeletedLogEntry) {
throw new \InvalidArgumentException('$logEntry must be ElementEditedLogEntry or ElementDeletedLogEntry!');
}
@@ -349,12 +345,12 @@ 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
{
//Dont log logentries itself!
- if ($entity instanceof AbstractDBElement && ! $entity instanceof AbstractLogEntry) {
+ if ($entity instanceof AbstractDBElement && !$entity instanceof AbstractLogEntry) {
return true;
}
diff --git a/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php b/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php
index 950fe34b..70eade97 100644
--- a/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php
+++ b/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php
@@ -49,7 +49,7 @@ class LogAccessDeniedSubscriber implements EventSubscriberInterface
$throwable = $throwable->getPrevious();
}
//Ignore everything except AccessDeniedExceptions
- if (! $throwable instanceof AccessDeniedException) {
+ if (!$throwable instanceof AccessDeniedException) {
return;
}
diff --git a/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php b/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php
index 8d01848a..211d8615 100644
--- a/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php
+++ b/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php
@@ -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.
diff --git a/src/EventSubscriber/LogSystem/LogoutLoggerListener.php b/src/EventSubscriber/LogSystem/LogoutLoggerListener.php
index 765b314f..7b0cacc3 100644
--- a/src/EventSubscriber/LogSystem/LogoutLoggerListener.php
+++ b/src/EventSubscriber/LogSystem/LogoutLoggerListener.php
@@ -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;
}
diff --git a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php
index 1d597c86..b7157182 100644
--- a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php
+++ b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php
@@ -82,7 +82,7 @@ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
public function onKernelResponse(ResponseEvent $event): void
{
- if (! $this->kernel_debug) {
+ if (!$this->kernel_debug) {
return;
}
diff --git a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php
index f501f96c..90725478 100644
--- a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php
+++ b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php
@@ -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;
@@ -97,15 +96,15 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
$user = $this->security->getUser();
$request = $event->getRequest();
- if (! $event->isMasterRequest()) {
+ if (!$event->isMasterRequest()) {
return;
}
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
return;
}
//Abort if we dont need to redirect the user.
- if (! $user->isNeedPwChange() && ! static::TFARedirectNeeded($user)) {
+ if (!$user->isNeedPwChange() && !static::TFARedirectNeeded($user)) {
return;
}
@@ -140,15 +139,15 @@ 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
{
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
- if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && ! $tfa_enabled) {
+ if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
return true;
}
diff --git a/src/EventSubscriber/UserSystem/RegisterU2FSubscriber.php b/src/EventSubscriber/UserSystem/RegisterU2FSubscriber.php
index f8e78f8e..b1695112 100644
--- a/src/EventSubscriber/UserSystem/RegisterU2FSubscriber.php
+++ b/src/EventSubscriber/UserSystem/RegisterU2FSubscriber.php
@@ -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;
@@ -96,9 +95,9 @@ final class RegisterU2FSubscriber implements EventSubscriberInterface
public function onRegister(RegisterEvent $event): void
{
//Skip adding of U2F key on demo mode
- if (! $this->demo_mode) {
+ if (!$this->demo_mode) {
$user = $event->getUser();
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
throw new \InvalidArgumentException('Only User objects can be registered for U2F!');
}
diff --git a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php
index c4af39e2..7f0d5fb8 100644
--- a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php
+++ b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php
@@ -68,12 +68,12 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface
//Check if the user has set a timezone
$user = $this->security->getUser();
- if ($user instanceof User && ! empty($user->getTimezone())) {
+ if ($user instanceof User && !empty($user->getTimezone())) {
$timezone = $user->getTimezone();
}
//Fill with default value if needed
- if (null === $timezone && ! empty($this->default_timezone)) {
+ if (null === $timezone && !empty($this->default_timezone)) {
$timezone = $this->default_timezone;
}
diff --git a/src/Form/AdminPages/AttachmentTypeAdminForm.php b/src/Form/AdminPages/AttachmentTypeAdminForm.php
index 2e5cd003..e43db04d 100644
--- a/src/Form/AdminPages/AttachmentTypeAdminForm.php
+++ b/src/Form/AdminPages/AttachmentTypeAdminForm.php
@@ -71,7 +71,7 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm
'placeholder' => 'attachment_type.edit.filetype_filter.placeholder',
],
'empty_data' => '',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
//Normalize data before writing it to database
diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php
index 1fcfe807..37cd38ff 100644
--- a/src/Form/AdminPages/BaseEntityAdminForm.php
+++ b/src/Form/AdminPages/BaseEntityAdminForm.php
@@ -90,7 +90,7 @@ class BaseEntityAdminForm extends AbstractType
'attr' => [
'placeholder' => 'part.name.placeholder',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
if ($entity instanceof AbstractStructuralDBElement) {
@@ -101,7 +101,7 @@ class BaseEntityAdminForm extends AbstractType
'class' => get_class($entity),
'required' => false,
'label' => 'parent.label',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
]
)
->add(
@@ -114,7 +114,7 @@ class BaseEntityAdminForm extends AbstractType
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]
);
}
@@ -130,7 +130,7 @@ class BaseEntityAdminForm extends AbstractType
'rows' => 4,
],
'help' => 'bbcode.hint',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]
);
}
@@ -144,7 +144,7 @@ class BaseEntityAdminForm extends AbstractType
'allow_delete' => true,
'label' => false,
'reindex_enable' => true,
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'entry_options' => [
'data_class' => $options['attachment_class'],
],
@@ -153,7 +153,7 @@ class BaseEntityAdminForm extends AbstractType
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
'required' => false,
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'label' => 'part.edit.master_attachment',
'entity' => $entity,
]);
@@ -173,7 +173,7 @@ class BaseEntityAdminForm extends AbstractType
'entry_type' => ParameterType::class,
'allow_add' => $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'allow_delete' => $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'reindex_enable' => true,
'label' => false,
'by_reference' => false,
@@ -191,11 +191,11 @@ class BaseEntityAdminForm extends AbstractType
'attr' => [
'class' => $is_new ? 'btn-success' : '',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
])
->add('reset', ResetType::class, [
'label' => 'entity.edit.reset',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
}
diff --git a/src/Form/AdminPages/CategoryAdminForm.php b/src/Form/AdminPages/CategoryAdminForm.php
index 4ec83e54..77e4717f 100644
--- a/src/Form/AdminPages/CategoryAdminForm.php
+++ b/src/Form/AdminPages/CategoryAdminForm.php
@@ -60,7 +60,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('disable_manufacturers', CheckboxType::class, [
@@ -70,7 +70,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('disable_autodatasheets', CheckboxType::class, [
@@ -80,7 +80,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('disable_properties', CheckboxType::class, [
@@ -90,7 +90,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('partname_hint', TextType::class, [
@@ -100,7 +100,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'attr' => [
'placeholder' => 'category.edit.partname_hint.placeholder',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('partname_regex', TextType::class, [
@@ -110,7 +110,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'attr' => [
'placeholder' => 'category.edit.partname_regex.placeholder',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('default_description', TextType::class, [
@@ -120,7 +120,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'attr' => [
'placeholder' => 'category.edit.default_description.placeholder',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('default_comment', TextType::class, [
@@ -130,7 +130,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
'attr' => [
'placeholder' => 'category.edit.default_comment.placeholder',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
}
}
diff --git a/src/Form/AdminPages/CompanyForm.php b/src/Form/AdminPages/CompanyForm.php
index 9f7b2979..e93faf3b 100644
--- a/src/Form/AdminPages/CompanyForm.php
+++ b/src/Form/AdminPages/CompanyForm.php
@@ -57,7 +57,7 @@ class CompanyForm extends BaseEntityAdminForm
$builder->add('address', TextareaType::class, [
'label' => 'company.edit.address',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'attr' => [
'placeholder' => 'company.edit.address.placeholder',
],
@@ -67,7 +67,7 @@ class CompanyForm extends BaseEntityAdminForm
$builder->add('phone_number', TelType::class, [
'label' => 'company.edit.phone_number',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'attr' => [
'placeholder' => 'company.edit.phone_number.placeholder',
],
@@ -77,7 +77,7 @@ class CompanyForm extends BaseEntityAdminForm
$builder->add('fax_number', TelType::class, [
'label' => 'company.edit.fax_number',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'attr' => [
'placeholder' => 'company.fax_number.placeholder',
],
@@ -87,7 +87,7 @@ class CompanyForm extends BaseEntityAdminForm
$builder->add('email_address', EmailType::class, [
'label' => 'company.edit.email',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'attr' => [
'placeholder' => 'company.edit.email.placeholder',
],
@@ -97,7 +97,7 @@ class CompanyForm extends BaseEntityAdminForm
$builder->add('website', UrlType::class, [
'label' => 'company.edit.website',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'attr' => [
'placeholder' => 'company.edit.website.placeholder',
],
@@ -108,7 +108,7 @@ class CompanyForm extends BaseEntityAdminForm
$builder->add('auto_product_url', UrlType::class, [
'label' => 'company.edit.auto_product_url',
'help' => 'company.edit.auto_product_url.help',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
'attr' => [
'placeholder' => 'company.edit.auto_product_url.placeholder',
],
diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php
index d2897d0f..4f7e137f 100644
--- a/src/Form/AdminPages/CurrencyAdminForm.php
+++ b/src/Form/AdminPages/CurrencyAdminForm.php
@@ -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;
@@ -73,7 +72,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm
'title' => 'selectpicker.nothing_selected',
'data-live-search' => true,
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('exchange_rate', BigDecimalMoneyType::class, [
@@ -81,16 +80,16 @@ class CurrencyAdminForm extends BaseEntityAdminForm
'label' => 'currency.edit.exchange_rate',
'currency' => $this->default_currency,
'scale' => 6,
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
- if(!$is_new) {
+ if (!$is_new) {
$builder->add(
'update_exchange_rate',
SubmitType::class,
[
'label' => 'currency.edit.update_rate',
- 'disabled' => ! $this->security->isGranted('edit', $entity)
+ 'disabled' => !$this->security->isGranted('edit', $entity),
]
);
}
diff --git a/src/Form/AdminPages/FootprintAdminForm.php b/src/Form/AdminPages/FootprintAdminForm.php
index 121928bd..2587be60 100644
--- a/src/Form/AdminPages/FootprintAdminForm.php
+++ b/src/Form/AdminPages/FootprintAdminForm.php
@@ -52,7 +52,7 @@ class FootprintAdminForm extends BaseEntityAdminForm
{
$builder->add('footprint_3d', MasterPictureAttachmentType::class, [
'required' => false,
- 'disabled' => ! $this->security->isGranted(null === $entity->getID() ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted(null === $entity->getID() ? 'create' : 'edit', $entity),
'label' => 'footprint.edit.3d_model',
'filter' => '3d_model',
'entity' => $entity,
diff --git a/src/Form/AdminPages/GroupAdminForm.php b/src/Form/AdminPages/GroupAdminForm.php
index 6a20c144..1beccd13 100644
--- a/src/Form/AdminPages/GroupAdminForm.php
+++ b/src/Form/AdminPages/GroupAdminForm.php
@@ -60,13 +60,13 @@ class GroupAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('permissions', PermissionsType::class, [
'mapped' => false,
'data' => $builder->getData(),
- 'disabled' => ! $this->security->isGranted('edit_permissions', $entity),
+ 'disabled' => !$this->security->isGranted('edit_permissions', $entity),
]);
}
}
diff --git a/src/Form/AdminPages/ImportType.php b/src/Form/AdminPages/ImportType.php
index c1679628..82e4aecb 100644
--- a/src/Form/AdminPages/ImportType.php
+++ b/src/Form/AdminPages/ImportType.php
@@ -69,7 +69,7 @@ class ImportType extends AbstractType
//Disable import if user is not allowed to create elements.
$entity = new $data['entity_class']();
$perm_name = 'create';
- $disabled = ! $this->security->isGranted($perm_name, $entity);
+ $disabled = !$this->security->isGranted($perm_name, $entity);
$builder
diff --git a/src/Form/AdminPages/MassCreationForm.php b/src/Form/AdminPages/MassCreationForm.php
index 4eeb0d0e..209e1fcc 100644
--- a/src/Form/AdminPages/MassCreationForm.php
+++ b/src/Form/AdminPages/MassCreationForm.php
@@ -66,7 +66,7 @@ class MassCreationForm extends AbstractType
//Disable import if user is not allowed to create elements.
$entity = new $data['entity_class']();
$perm_name = 'create';
- $disabled = ! $this->security->isGranted($perm_name, $entity);
+ $disabled = !$this->security->isGranted($perm_name, $entity);
$builder
->add('lines', TextareaType::class, [
diff --git a/src/Form/AdminPages/MeasurementUnitAdminForm.php b/src/Form/AdminPages/MeasurementUnitAdminForm.php
index 2ff9aa14..d66f3125 100644
--- a/src/Form/AdminPages/MeasurementUnitAdminForm.php
+++ b/src/Form/AdminPages/MeasurementUnitAdminForm.php
@@ -60,7 +60,7 @@ class MeasurementUnitAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('use_si_prefix', CheckboxType::class, [
@@ -70,7 +70,7 @@ class MeasurementUnitAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('unit', TextType::class, [
@@ -79,7 +79,7 @@ class MeasurementUnitAdminForm extends BaseEntityAdminForm
'attr' => [
'placeholder' => 'measurement_unit.edit.unit_symbol.placeholder',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
}
}
diff --git a/src/Form/AdminPages/StorelocationAdminForm.php b/src/Form/AdminPages/StorelocationAdminForm.php
index fef9ec31..cf4df30e 100644
--- a/src/Form/AdminPages/StorelocationAdminForm.php
+++ b/src/Form/AdminPages/StorelocationAdminForm.php
@@ -61,7 +61,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
]);
$builder->add('limit_to_existing_parts', CheckboxType::class, [
@@ -71,7 +71,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
]);
$builder->add('only_single_part', CheckboxType::class, [
@@ -81,7 +81,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
'label_attr' => [
'class' => 'checkbox-custom',
],
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
]);
$builder->add('storage_type', StructuralEntityType::class, [
@@ -90,7 +90,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
'help' => 'storelocation.storage_type.help',
'class' => MeasurementUnit::class,
'disable_not_selectable' => true,
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
]);
}
}
diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php
index 17a39ce3..61a5d6a4 100644
--- a/src/Form/AdminPages/SupplierForm.php
+++ b/src/Form/AdminPages/SupplierForm.php
@@ -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;
@@ -71,7 +70,7 @@ class SupplierForm extends CompanyForm
'required' => false,
'label' => 'supplier.edit.default_currency',
'disable_not_selectable' => true,
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
]);
$builder->add('shipping_costs', BigDecimalMoneyType::class, [
@@ -79,7 +78,7 @@ class SupplierForm extends CompanyForm
'currency' => $this->default_currency,
'scale' => 3,
'label' => 'supplier.shipping_costs.label',
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
]);
}
}
diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php
index 29730848..2662120a 100644
--- a/src/Form/AttachmentFormType.php
+++ b/src/Form/AttachmentFormType.php
@@ -115,7 +115,7 @@ class AttachmentFormType extends AbstractType
'required' => false,
'label' => 'attachment.edit.secure_file',
'mapped' => false,
- 'disabled' => ! $this->security->isGranted('@parts_attachments.show_private'),
+ 'disabled' => !$this->security->isGranted('@parts_attachments.show_private'),
'attr' => [
'class' => 'form-control-sm',
],
@@ -143,7 +143,7 @@ class AttachmentFormType extends AbstractType
'required' => false,
'label' => 'attachment.edit.download_url',
'mapped' => false,
- 'disabled' => ! $this->allow_attachments_download,
+ 'disabled' => !$this->allow_attachments_download,
'attr' => [
'class' => 'form-control-sm',
],
@@ -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'))
);
}
}
diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php
index 4f0af242..0b2f0fc3 100644
--- a/src/Form/LabelOptionsType.php
+++ b/src/Form/LabelOptionsType.php
@@ -133,7 +133,7 @@ class LabelOptionsType extends AbstractType
'label_attr' => [
'class' => 'radio-custom radio-inline',
],
- 'disabled' => ! $this->security->isGranted('@labels.use_twig'),
+ 'disabled' => !$this->security->isGranted('@labels.use_twig'),
]);
}
diff --git a/src/Form/LabelSystem/LabelDialogType.php b/src/Form/LabelSystem/LabelDialogType.php
index 2c5bf343..472f708d 100644
--- a/src/Form/LabelSystem/LabelDialogType.php
+++ b/src/Form/LabelSystem/LabelDialogType.php
@@ -54,7 +54,7 @@ class LabelDialogType extends AbstractType
$builder->add('options', LabelOptionsType::class, [
'label' => false,
- 'disabled' => ! $this->security->isGranted('@labels.edit_options') || $options['disable_options'],
+ 'disabled' => !$this->security->isGranted('@labels.edit_options') || $options['disable_options'],
]);
$builder->add('update', SubmitType::class, [
'label' => 'label_generator.update',
diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php
index 8605b411..013cf25e 100644
--- a/src/Form/Part/OrderdetailType.php
+++ b/src/Form/Part/OrderdetailType.php
@@ -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;
@@ -119,7 +118,7 @@ class OrderdetailType extends AbstractType
'prototype_data' => $dummy_pricedetail,
'by_reference' => false,
'entry_options' => [
- 'disabled' => ! $this->security->isGranted('@parts_prices.edit'),
+ 'disabled' => !$this->security->isGranted('@parts_prices.edit'),
'measurement_unit' => $options['measurement_unit'],
],
]);
diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php
index cab0c8ce..655887a4 100644
--- a/src/Form/Part/PartBaseType.php
+++ b/src/Form/Part/PartBaseType.php
@@ -105,7 +105,7 @@ class PartBaseType extends AbstractType
'attr' => [
'placeholder' => 'part.edit.name.placeholder',
],
- 'disabled' => ! $this->security->isGranted('name.edit', $part),
+ 'disabled' => !$this->security->isGranted('name.edit', $part),
])
->add('description', CKEditorType::class, [
'required' => false,
@@ -116,7 +116,7 @@ class PartBaseType extends AbstractType
'placeholder' => 'part.edit.description.placeholder',
'rows' => 2,
],
- 'disabled' => ! $this->security->isGranted('description.edit', $part),
+ 'disabled' => !$this->security->isGranted('description.edit', $part),
])
->add('minAmount', SIUnitType::class, [
'attr' => [
@@ -125,23 +125,22 @@ class PartBaseType extends AbstractType
],
'label' => 'part.edit.mininstock',
'measurement_unit' => $part->getPartUnit(),
- 'disabled' => ! $this->security->isGranted('minamount.edit', $part),
+ 'disabled' => !$this->security->isGranted('minamount.edit', $part),
])
->add('category', StructuralEntityType::class, [
'class' => Category::class,
'label' => 'part.edit.category',
'disable_not_selectable' => true,
- 'disabled' => ! $this->security->isGranted('category.edit', $part),
+ 'disabled' => !$this->security->isGranted('category.edit', $part),
'constraints' => [
-
- ]
+ ],
])
->add('footprint', StructuralEntityType::class, [
'class' => Footprint::class,
'required' => false,
'label' => 'part.edit.footprint',
'disable_not_selectable' => true,
- 'disabled' => ! $this->security->isGranted('footprint.edit', $part),
+ 'disabled' => !$this->security->isGranted('footprint.edit', $part),
])
->add('tags', TextType::class, [
'required' => false,
@@ -151,7 +150,7 @@ class PartBaseType extends AbstractType
'class' => 'tagsinput',
'data-autocomplete' => $this->urlGenerator->generate('typeahead_tags', ['query' => 'QUERY']),
],
- 'disabled' => ! $this->security->isGranted('tags.edit', $part),
+ 'disabled' => !$this->security->isGranted('tags.edit', $part),
]);
//Manufacturer section
@@ -160,25 +159,25 @@ class PartBaseType extends AbstractType
'required' => false,
'label' => 'part.edit.manufacturer.label',
'disable_not_selectable' => true,
- 'disabled' => ! $this->security->isGranted('manufacturer.edit', $part),
+ 'disabled' => !$this->security->isGranted('manufacturer.edit', $part),
])
->add('manufacturer_product_url', UrlType::class, [
'required' => false,
'empty_data' => '',
'label' => 'part.edit.manufacturer_url.label',
- 'disabled' => ! $this->security->isGranted('mpn.edit', $part),
+ 'disabled' => !$this->security->isGranted('mpn.edit', $part),
])
->add('manufacturer_product_number', TextType::class, [
'required' => false,
'empty_data' => '',
'label' => 'part.edit.mpn',
- 'disabled' => ! $this->security->isGranted('mpn.edit', $part),
+ 'disabled' => !$this->security->isGranted('mpn.edit', $part),
])
->add('manufacturing_status', ChoiceType::class, [
'label' => 'part.edit.manufacturing_status',
'choices' => $status_choices,
'required' => false,
- 'disabled' => ! $this->security->isGranted('status.edit', $part),
+ 'disabled' => !$this->security->isGranted('status.edit', $part),
]);
//Advanced section
@@ -188,7 +187,7 @@ class PartBaseType extends AbstractType
],
'required' => false,
'label' => 'part.edit.needs_review',
- 'disabled' => ! $this->security->isGranted('edit', $part),
+ 'disabled' => !$this->security->isGranted('edit', $part),
])
->add('favorite', CheckboxType::class, [
'label_attr' => [
@@ -196,20 +195,20 @@ class PartBaseType extends AbstractType
],
'required' => false,
'label' => 'part.edit.is_favorite',
- 'disabled' => ! $this->security->isGranted('change_favorite', $part),
+ 'disabled' => !$this->security->isGranted('change_favorite', $part),
])
->add('mass', SIUnitType::class, [
'unit' => 'g',
'label' => 'part.edit.mass',
'required' => false,
- 'disabled' => ! $this->security->isGranted('mass.edit', $part),
+ 'disabled' => !$this->security->isGranted('mass.edit', $part),
])
->add('partUnit', StructuralEntityType::class, [
'class' => MeasurementUnit::class,
'required' => false,
'disable_not_selectable' => true,
'label' => 'part.edit.partUnit',
- 'disabled' => ! $this->security->isGranted('unit.edit', $part),
+ 'disabled' => !$this->security->isGranted('unit.edit', $part),
]);
//Comment section
@@ -219,7 +218,7 @@ class PartBaseType extends AbstractType
'attr' => [
'rows' => 4,
],
- 'disabled' => ! $this->security->isGranted('comment.edit', $part),
+ 'disabled' => !$this->security->isGranted('comment.edit', $part),
'empty_data' => '',
]);
@@ -232,7 +231,7 @@ class PartBaseType extends AbstractType
'label' => false,
'entry_options' => [
'measurement_unit' => $part->getPartUnit(),
- 'disabled' => ! $this->security->isGranted('lots.edit', $part),
+ 'disabled' => !$this->security->isGranted('lots.edit', $part),
],
'by_reference' => false,
]);
@@ -246,14 +245,14 @@ class PartBaseType extends AbstractType
'label' => false,
'entry_options' => [
'data_class' => PartAttachment::class,
- 'disabled' => ! $this->security->isGranted('attachments.edit', $part),
+ 'disabled' => !$this->security->isGranted('attachments.edit', $part),
],
'by_reference' => false,
]);
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
'required' => false,
- 'disabled' => ! $this->security->isGranted('attachments.edit', $part),
+ 'disabled' => !$this->security->isGranted('attachments.edit', $part),
'label' => 'part.edit.master_attachment',
'entity' => $part,
]);
@@ -269,7 +268,7 @@ class PartBaseType extends AbstractType
'prototype_data' => new Orderdetail(),
'entry_options' => [
'measurement_unit' => $part->getPartUnit(),
- 'disabled' => ! $this->security->isGranted('orderdetails.edit', $part),
+ 'disabled' => !$this->security->isGranted('orderdetails.edit', $part),
],
]);
@@ -282,7 +281,7 @@ class PartBaseType extends AbstractType
'by_reference' => false,
'prototype_data' => new PartParameter(),
'entry_options' => [
- 'disabled' => ! $this->security->isGranted('parameters.edit', $part),
+ 'disabled' => !$this->security->isGranted('parameters.edit', $part),
'data_class' => PartParameter::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']);
}
diff --git a/src/Form/Part/PricedetailType.php b/src/Form/Part/PricedetailType.php
index 440660e3..1fa52a70 100644
--- a/src/Form/Part/PricedetailType.php
+++ b/src/Form/Part/PricedetailType.php
@@ -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;
diff --git a/src/Form/Permissions/PermissionGroupType.php b/src/Form/Permissions/PermissionGroupType.php
index 84cd5009..f952ddee 100644
--- a/src/Form/Permissions/PermissionGroupType.php
+++ b/src/Form/Permissions/PermissionGroupType.php
@@ -98,7 +98,7 @@ class PermissionGroupType extends AbstractType
$resolver->setDefault('inherit', false);
$resolver->setDefault('label', function (Options $options) {
- if (! empty($this->perm_structure['groups'][$options['group_name']]['label'])) {
+ if (!empty($this->perm_structure['groups'][$options['group_name']]['label'])) {
return $this->perm_structure['groups'][$options['group_name']]['label'];
}
diff --git a/src/Form/Permissions/PermissionType.php b/src/Form/Permissions/PermissionType.php
index 9424be98..4a7af654 100644
--- a/src/Form/Permissions/PermissionType.php
+++ b/src/Form/Permissions/PermissionType.php
@@ -71,7 +71,7 @@ class PermissionType extends AbstractType
});
$resolver->setDefault('label', function (Options $options) {
- if (! empty($this->perm_structure['perms'][$options['perm_name']]['label'])) {
+ if (!empty($this->perm_structure['perms'][$options['perm_name']]['label'])) {
return $this->perm_structure['perms'][$options['perm_name']]['label'];
}
@@ -79,7 +79,7 @@ class PermissionType extends AbstractType
});
$resolver->setDefault('multi_checkbox', function (Options $options) {
- return ! $options['disabled'];
+ return !$options['disabled'];
});
$resolver->setDefaults([
diff --git a/src/Form/Permissions/PermissionsType.php b/src/Form/Permissions/PermissionsType.php
index 8df1f647..6766ed03 100644
--- a/src/Form/Permissions/PermissionsType.php
+++ b/src/Form/Permissions/PermissionsType.php
@@ -67,7 +67,7 @@ class PermissionsType extends AbstractType
$resolver->setDefaults([
'show_legend' => true,
'constraints' => function (Options $options) {
- if (! $options['disabled']) {
+ if (!$options['disabled']) {
return [new NoLockout()];
}
diff --git a/src/Form/TFAGoogleSettingsType.php b/src/Form/TFAGoogleSettingsType.php
index 06eb4de6..c2f35ecd 100644
--- a/src/Form/TFAGoogleSettingsType.php
+++ b/src/Form/TFAGoogleSettingsType.php
@@ -70,7 +70,7 @@ class TFAGoogleSettingsType extends AbstractType
$user = $event->getData();
//Only show setup fields, when google authenticator is not enabled
- if (! $user->isGoogleAuthenticatorEnabled()) {
+ if (!$user->isGoogleAuthenticatorEnabled()) {
$form->add(
'google_confirmation',
TextType::class,
diff --git a/src/Form/Type/BigDecimalMoneyType.php b/src/Form/Type/BigDecimalMoneyType.php
index 163e0786..0d77abaa 100644
--- a/src/Form/Type/BigDecimalMoneyType.php
+++ b/src/Form/Type/BigDecimalMoneyType.php
@@ -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,10 +53,10 @@ class BigDecimalMoneyType extends AbstractType implements DataTransformerInterfa
public function reverseTransform($value)
{
- if ($value === null) {
+ if (null === $value) {
return null;
}
return BigDecimal::of($value);
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/Type/BigDecimalNumberType.php b/src/Form/Type/BigDecimalNumberType.php
index 7759e121..00863914 100644
--- a/src/Form/Type/BigDecimalNumberType.php
+++ b/src/Form/Type/BigDecimalNumberType.php
@@ -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,10 +53,10 @@ class BigDecimalNumberType extends AbstractType implements DataTransformerInterf
public function reverseTransform($value)
{
- if ($value === null) {
+ if (null === $value) {
return null;
}
return BigDecimal::of($value);
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/Type/CurrencyEntityType.php b/src/Form/Type/CurrencyEntityType.php
index 067cb7fc..38b7501b 100644
--- a/src/Form/Type/CurrencyEntityType.php
+++ b/src/Form/Type/CurrencyEntityType.php
@@ -88,7 +88,7 @@ class CurrencyEntityType extends StructuralEntityType
{
//Similar to StructuralEntityType, but we use the currency symbol instead if available
- if (! $choice instanceof Currency) {
+ if (!$choice instanceof Currency) {
throw new \InvalidArgumentException('$choice must be an currency object!');
}
@@ -117,7 +117,7 @@ class CurrencyEntityType extends StructuralEntityType
/** @var Currency $choice */
$tmp = [];
- if (! empty($choice->getIsoCode())) {
+ if (!empty($choice->getIsoCode())) {
//Show the name of the currency
$tmp += ['data-subtext' => $choice->getName()];
}
diff --git a/src/Form/Type/MasterPictureAttachmentType.php b/src/Form/Type/MasterPictureAttachmentType.php
index 4e0570d8..8bd8225d 100644
--- a/src/Form/Type/MasterPictureAttachmentType.php
+++ b/src/Form/Type/MasterPictureAttachmentType.php
@@ -70,9 +70,9 @@ class MasterPictureAttachmentType extends AbstractType
/** @var Attachment $choice */
$tmp = ['data-subtext' => $choice->getFilename() ?? 'URL'];
- if ('picture' === $options['filter'] && ! $choice->isPicture()) {
+ if ('picture' === $options['filter'] && !$choice->isPicture()) {
$tmp += ['disabled' => 'disabled'];
- } elseif ('3d_model' === $options['filter'] && ! $choice->is3DModel()) {
+ } elseif ('3d_model' === $options['filter'] && !$choice->is3DModel()) {
$tmp += ['disabled' => 'disabled'];
}
@@ -83,7 +83,7 @@ class MasterPictureAttachmentType extends AbstractType
'choice_loader' => function (Options $options) {
return new CallbackChoiceLoader(function () use ($options) {
$entity = $options['entity'];
- if (! $entity instanceof AttachmentContainingDBElement) {
+ if (!$entity instanceof AttachmentContainingDBElement) {
throw new \RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)');
}
diff --git a/src/Form/Type/StructuralEntityType.php b/src/Form/Type/StructuralEntityType.php
index b81ba90e..e9e641c1 100644
--- a/src/Form/Type/StructuralEntityType.php
+++ b/src/Form/Type/StructuralEntityType.php
@@ -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
{
diff --git a/src/Form/UserAdminForm.php b/src/Form/UserAdminForm.php
index 57997bc3..497fb767 100644
--- a/src/Form/UserAdminForm.php
+++ b/src/Form/UserAdminForm.php
@@ -95,7 +95,7 @@ class UserAdminForm extends AbstractType
'attr' => [
'placeholder' => 'user.username.placeholder',
],
- 'disabled' => ! $this->security->isGranted('edit_username', $entity),
+ 'disabled' => !$this->security->isGranted('edit_username', $entity),
])
->add('group', StructuralEntityType::class, [
@@ -103,7 +103,7 @@ class UserAdminForm extends AbstractType
'required' => false,
'label' => 'group.label',
'disable_not_selectable' => true,
- 'disabled' => ! $this->security->isGranted('change_group', $entity),
+ 'disabled' => !$this->security->isGranted('change_group', $entity),
])
->add('first_name', TextType::class, [
@@ -113,7 +113,7 @@ class UserAdminForm extends AbstractType
'placeholder' => 'user.firstName.placeholder',
],
'required' => false,
- 'disabled' => ! $this->security->isGranted('edit_infos', $entity),
+ 'disabled' => !$this->security->isGranted('edit_infos', $entity),
])
->add('last_name', TextType::class, [
@@ -123,7 +123,7 @@ class UserAdminForm extends AbstractType
'placeholder' => 'user.lastName.placeholder',
],
'required' => false,
- 'disabled' => ! $this->security->isGranted('edit_infos', $entity),
+ 'disabled' => !$this->security->isGranted('edit_infos', $entity),
])
->add('email', TextType::class, [
@@ -133,7 +133,7 @@ class UserAdminForm extends AbstractType
'placeholder' => 'user.email.placeholder',
],
'required' => false,
- 'disabled' => ! $this->security->isGranted('edit_infos', $entity),
+ 'disabled' => !$this->security->isGranted('edit_infos', $entity),
])
->add('department', TextType::class, [
@@ -143,7 +143,7 @@ class UserAdminForm extends AbstractType
'placeholder' => 'user.department.placeholder',
],
'required' => false,
- 'disabled' => ! $this->security->isGranted('edit_infos', $entity),
+ 'disabled' => !$this->security->isGranted('edit_infos', $entity),
])
//Config section
@@ -157,7 +157,7 @@ class UserAdminForm extends AbstractType
'placeholder' => 'user_settings.language.placeholder',
'label' => 'user.language_select',
'preferred_choices' => ['en', 'de'],
- 'disabled' => ! $this->security->isGranted('change_user_settings', $entity),
+ 'disabled' => !$this->security->isGranted('change_user_settings', $entity),
])
->add('timezone', TimezoneType::class, [
'required' => false,
@@ -169,7 +169,7 @@ class UserAdminForm extends AbstractType
'placeholder' => 'user_settings.timezone.placeholder',
'label' => 'user.timezone.label',
'preferred_choices' => ['Europe/Berlin'],
- 'disabled' => ! $this->security->isGranted('change_user_settings', $entity),
+ 'disabled' => !$this->security->isGranted('change_user_settings', $entity),
])
->add('theme', ChoiceType::class, [
'required' => false,
@@ -184,12 +184,12 @@ class UserAdminForm extends AbstractType
'choice_translation_domain' => false,
'placeholder' => 'user_settings.theme.placeholder',
'label' => 'user.theme.label',
- 'disabled' => ! $this->security->isGranted('change_user_settings', $entity),
+ 'disabled' => !$this->security->isGranted('change_user_settings', $entity),
])
->add('currency', CurrencyEntityType::class, [
'required' => false,
'label' => 'user.currency.label',
- 'disabled' => ! $this->security->isGranted('change_user_settings', $entity),
+ 'disabled' => !$this->security->isGranted('change_user_settings', $entity),
])
->add('new_password', RepeatedType::class, [
@@ -203,7 +203,7 @@ class UserAdminForm extends AbstractType
'invalid_message' => 'password_must_match',
'required' => false,
'mapped' => false,
- 'disabled' => ! $this->security->isGranted('set_password', $entity),
+ 'disabled' => !$this->security->isGranted('set_password', $entity),
'constraints' => [new Length([
'min' => 6,
'max' => 128,
@@ -216,7 +216,7 @@ class UserAdminForm extends AbstractType
'class' => 'checkbox-custom',
],
'label' => 'user.edit.needs_pw_change',
- 'disabled' => ! $this->security->isGranted('set_password', $entity),
+ 'disabled' => !$this->security->isGranted('set_password', $entity),
])
->add('disabled', CheckboxType::class, [
@@ -225,7 +225,7 @@ class UserAdminForm extends AbstractType
'class' => 'checkbox-custom',
],
'label' => 'user.edit.user_disabled',
- 'disabled' => ! $this->security->isGranted('set_password', $entity)
+ 'disabled' => !$this->security->isGranted('set_password', $entity)
|| $entity === $this->security->getUser(),
])
@@ -233,7 +233,7 @@ class UserAdminForm extends AbstractType
->add('permissions', PermissionsType::class, [
'mapped' => false,
'data' => $builder->getData(),
- 'disabled' => ! $this->security->isGranted('edit_permissions', $entity),
+ 'disabled' => !$this->security->isGranted('edit_permissions', $entity),
])
;
/*->add('comment', CKEditorType::class, ['required' => false,
@@ -253,7 +253,7 @@ class UserAdminForm extends AbstractType
'data_class' => $options['attachment_class'],
],
'by_reference' => false,
- 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('log_comment', TextType::class, [
diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php
index f9d89fd9..66048650 100644
--- a/src/Form/UserSettingsType.php
+++ b/src/Form/UserSettingsType.php
@@ -72,27 +72,27 @@ class UserSettingsType extends AbstractType
$builder
->add('name', TextType::class, [
'label' => 'user.username.label',
- 'disabled' => ! $this->security->isGranted('edit_username', $options['data']) || $this->demo_mode,
+ 'disabled' => !$this->security->isGranted('edit_username', $options['data']) || $this->demo_mode,
])
->add('first_name', TextType::class, [
'required' => false,
'label' => 'user.firstName.label',
- 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
+ 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
])
->add('last_name', TextType::class, [
'required' => false,
'label' => 'user.lastName.label',
- 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
+ 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
])
->add('department', TextType::class, [
'required' => false,
'label' => 'user.department.label',
- 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
+ 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
])
->add('email', EmailType::class, [
'required' => false,
'label' => 'user.email.label',
- 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
+ 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
])
->add('language', LanguageType::class, [
'disabled' => $this->demo_mode,
diff --git a/src/Form/WorkaroundCollectionType.php b/src/Form/WorkaroundCollectionType.php
index 20a0cc27..45bd0ba6 100644
--- a/src/Form/WorkaroundCollectionType.php
+++ b/src/Form/WorkaroundCollectionType.php
@@ -1,26 +1,18 @@
vars['multipart'] = true;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Helpers/BigDecimalType.php b/src/Helpers/BigDecimalType.php
index 49fb3b07..0c963088 100644
--- a/src/Helpers/BigDecimalType.php
+++ b/src/Helpers/BigDecimalType.php
@@ -20,7 +20,6 @@
namespace App\Helpers;
-
use Brick\Math\BigDecimal;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
@@ -35,13 +34,13 @@ class BigDecimalType extends Type
}
/**
- * @param string $value
- * @param AbstractPlatform $platform
+ * @param string $value
+ *
* @return BigDecimal|\Brick\Math\BigNumber|mixed
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
- if ($value === null) {
+ if (null === $value) {
return null;
}
@@ -49,13 +48,11 @@ class BigDecimalType extends Type
}
/**
- * @param BigDecimal $value
- * @param AbstractPlatform $platform
- * @return mixed
+ * @param BigDecimal $value
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
- if ($value === null) {
+ if (null === $value) {
return null;
}
@@ -71,4 +68,4 @@ class BigDecimalType extends Type
{
return true;
}
-}
\ No newline at end of file
+}
diff --git a/src/Helpers/LabelResponse.php b/src/Helpers/LabelResponse.php
index b60aa875..af07d25d 100644
--- a/src/Helpers/LabelResponse.php
+++ b/src/Helpers/LabelResponse.php
@@ -90,7 +90,7 @@ class LabelResponse extends Response
*/
public function setContentDisposition($disposition, $filename, $filenameFallback = '')
{
- if ('' === $filenameFallback && (! preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) {
+ if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) {
$encoding = mb_detect_encoding($filename, null, true) ?: '8bit';
for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) {
diff --git a/src/Helpers/Trees/StructuralDBElementIterator.php b/src/Helpers/Trees/StructuralDBElementIterator.php
index 8eda8095..433af404 100644
--- a/src/Helpers/Trees/StructuralDBElementIterator.php
+++ b/src/Helpers/Trees/StructuralDBElementIterator.php
@@ -59,7 +59,7 @@ final class StructuralDBElementIterator extends ArrayIterator implements Recursi
/** @var AbstractStructuralDBElement $element */
$element = $this->current();
- return ! empty($element->getSubelements());
+ return !empty($element->getSubelements());
}
public function getChildren()
diff --git a/src/Helpers/Trees/TreeViewNode.php b/src/Helpers/Trees/TreeViewNode.php
index 68716e0f..a604e932 100644
--- a/src/Helpers/Trees/TreeViewNode.php
+++ b/src/Helpers/Trees/TreeViewNode.php
@@ -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
*/
diff --git a/src/Helpers/Trees/TreeViewNodeIterator.php b/src/Helpers/Trees/TreeViewNodeIterator.php
index f8e6faf3..a944f6c1 100644
--- a/src/Helpers/Trees/TreeViewNodeIterator.php
+++ b/src/Helpers/Trees/TreeViewNodeIterator.php
@@ -60,7 +60,7 @@ final class TreeViewNodeIterator extends ArrayIterator implements RecursiveItera
/** @var TreeViewNode $element */
$element = $this->current();
- return ! empty($element->getNodes());
+ return !empty($element->getNodes());
}
public function getChildren()
diff --git a/src/Helpers/Trees/TreeViewNodeState.php b/src/Helpers/Trees/TreeViewNodeState.php
index 6f22967a..e61ee692 100644
--- a/src/Helpers/Trees/TreeViewNodeState.php
+++ b/src/Helpers/Trees/TreeViewNodeState.php
@@ -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;
diff --git a/src/Helpers/UTCDateTimeType.php b/src/Helpers/UTCDateTimeType.php
index d2707314..d6a02f2a 100644
--- a/src/Helpers/UTCDateTimeType.php
+++ b/src/Helpers/UTCDateTimeType.php
@@ -58,7 +58,7 @@ class UTCDateTimeType extends DateTimeType
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
- if (! self::$utc_timezone) {
+ if (!self::$utc_timezone) {
self::$utc_timezone = new DateTimeZone('UTC');
}
@@ -71,7 +71,7 @@ class UTCDateTimeType extends DateTimeType
public function convertToPHPValue($value, AbstractPlatform $platform)
{
- if (! self::$utc_timezone) {
+ if (!self::$utc_timezone) {
self::$utc_timezone = new DateTimeZone('UTC');
}
@@ -85,7 +85,7 @@ class UTCDateTimeType extends DateTimeType
self::$utc_timezone
);
- if (! $converted) {
+ if (!$converted) {
throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeFormatString());
}
diff --git a/src/Migration/AbstractMultiPlatformMigration.php b/src/Migration/AbstractMultiPlatformMigration.php
index beab8532..f73b79da 100644
--- a/src/Migration/AbstractMultiPlatformMigration.php
+++ b/src/Migration/AbstractMultiPlatformMigration.php
@@ -1,9 +1,7 @@
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
{
@@ -109,7 +105,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
if (!empty($this->admin_pw)) {
$this->logger->warning('');
- $this->logger->warning('The initial password for the "admin" user is: ' . $this->admin_pw . '>');
+ $this->logger->warning('The initial password for the "admin" user is: '.$this->admin_pw.'>');
$this->logger->warning('');
}
}
@@ -121,4 +117,4 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
abstract public function sqLiteUp(Schema $schema): void;
abstract public function sqLiteDown(Schema $schema): void;
-}
\ No newline at end of file
+}
diff --git a/src/Repository/AbstractPartsContainingRepository.php b/src/Repository/AbstractPartsContainingRepository.php
index 0c1f1dba..f4cdb0bf 100644
--- a/src/Repository/AbstractPartsContainingRepository.php
+++ b/src/Repository/AbstractPartsContainingRepository.php
@@ -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 array $order_by The order of the parts. Format ['name' => 'ASC']
+ *
+ * @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]);
}
-
-}
\ No newline at end of file
+}
diff --git a/src/Repository/AttachmentRepository.php b/src/Repository/AttachmentRepository.php
index 76a14589..cdac1c04 100644
--- a/src/Repository/AttachmentRepository.php
+++ b/src/Repository/AttachmentRepository.php
@@ -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
*/
diff --git a/src/Repository/LabelProfileRepository.php b/src/Repository/LabelProfileRepository.php
index e4d6f784..ad31d727 100644
--- a/src/Repository/LabelProfileRepository.php
+++ b/src/Repository/LabelProfileRepository.php
@@ -32,12 +32,10 @@ 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
{
- if (! in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) {
+ if (!in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) {
throw new \InvalidArgumentException('Invalid supported_element type given.');
}
@@ -64,7 +62,7 @@ class LabelProfileRepository extends NamedDBElementRepository
$type_children[] = $node;
}
- if (! empty($type_children)) {
+ if (!empty($type_children)) {
//Use default label e.g. 'part_label'. $$ marks that it will be translated in TreeViewGenerator
$tmp = new TreeViewNode('$$'.$type.'.label', null, $type_children);
@@ -78,14 +76,12 @@ 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
{
- if (! in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) {
+ if (!in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) {
throw new \InvalidArgumentException('Invalid supported_element type given.');
}
diff --git a/src/Repository/LogEntryRepository.php b/src/Repository/LogEntryRepository.php
index 313a57be..8e8c2e27 100644
--- a/src/Repository/LogEntryRepository.php
+++ b/src/Repository/LogEntryRepository.php
@@ -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
{
@@ -171,7 +169,7 @@ class LogEntryRepository extends DBElementRepository
$query = $qb->getQuery();
$count = $query->getSingleScalarResult();
- return ! ($count > 0);
+ return !($count > 0);
}
/**
@@ -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
{
diff --git a/src/Repository/PartRepository.php b/src/Repository/PartRepository.php
index bcde3d26..b6aff3e4 100644
--- a/src/Repository/PartRepository.php
+++ b/src/Repository/PartRepository.php
@@ -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
*/
diff --git a/src/Repository/Parts/CategoryRepository.php b/src/Repository/Parts/CategoryRepository.php
index 0b6f1ba0..dad7a306 100644
--- a/src/Repository/Parts/CategoryRepository.php
+++ b/src/Repository/Parts/CategoryRepository.php
@@ -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) {
@@ -44,4 +42,4 @@ class CategoryRepository extends AbstractPartsContainingRepository
return $this->getPartsCountByField($element, 'category');
}
-}
\ No newline at end of file
+}
diff --git a/src/Repository/Parts/FootprintRepository.php b/src/Repository/Parts/FootprintRepository.php
index a9fae76b..a9b2ed3e 100644
--- a/src/Repository/Parts/FootprintRepository.php
+++ b/src/Repository/Parts/FootprintRepository.php
@@ -21,14 +21,13 @@
namespace App\Repository\Parts;
use App\Entity\Parts\Footprint;
-use App\Entity\Parts\Storelocation;
use App\Repository\AbstractPartsContainingRepository;
class FootprintRepository extends AbstractPartsContainingRepository
{
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{
- if(!$element instanceof Footprint) {
+ if (!$element instanceof Footprint) {
throw new \InvalidArgumentException('$element must be an Footprint!');
}
@@ -37,10 +36,10 @@ class FootprintRepository extends AbstractPartsContainingRepository
public function getPartsCount(object $element): int
{
- if(!$element instanceof Footprint) {
+ if (!$element instanceof Footprint) {
throw new \InvalidArgumentException('$element must be an Footprint!');
}
return $this->getPartsCountByField($element, 'footprint');
}
-}
\ No newline at end of file
+}
diff --git a/src/Repository/Parts/ManufacturerRepository.php b/src/Repository/Parts/ManufacturerRepository.php
index b03f2f21..77e2b5d5 100644
--- a/src/Repository/Parts/ManufacturerRepository.php
+++ b/src/Repository/Parts/ManufacturerRepository.php
@@ -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) {
@@ -44,4 +42,4 @@ class ManufacturerRepository extends AbstractPartsContainingRepository
return $this->getPartsCountByField($element, 'manufacturer');
}
-}
\ No newline at end of file
+}
diff --git a/src/Repository/Parts/MeasurementUnitRepository.php b/src/Repository/Parts/MeasurementUnitRepository.php
index 1754245a..7389be28 100644
--- a/src/Repository/Parts/MeasurementUnitRepository.php
+++ b/src/Repository/Parts/MeasurementUnitRepository.php
@@ -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) {
@@ -44,4 +42,4 @@ class MeasurementUnitRepository extends AbstractPartsContainingRepository
return $this->getPartsCountByField($element, 'partUnit');
}
-}
\ No newline at end of file
+}
diff --git a/src/Repository/Parts/StorelocationRepository.php b/src/Repository/Parts/StorelocationRepository.php
index 6ed2d6ef..a5a73b15 100644
--- a/src/Repository/Parts/StorelocationRepository.php
+++ b/src/Repository/Parts/StorelocationRepository.php
@@ -21,20 +21,18 @@
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
{
/**
- * @param Storelocation $element
+ * @param Storelocation $element
*/
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{
- if(!$element instanceof Storelocation) {
+ if (!$element instanceof Storelocation) {
throw new \InvalidArgumentException('$element must be an Storelocation!');
}
@@ -47,7 +45,7 @@ class StorelocationRepository extends AbstractPartsContainingRepository
->setParameter(1, $element);
foreach ($order_by as $field => $order) {
- $qb->addOrderBy('part.' . $field, $order);
+ $qb->addOrderBy('part.'.$field, $order);
}
return $qb->getQuery()->getResult();
@@ -55,7 +53,7 @@ class StorelocationRepository extends AbstractPartsContainingRepository
public function getPartsCount(object $element): int
{
- if(!$element instanceof Storelocation) {
+ if (!$element instanceof Storelocation) {
throw new \InvalidArgumentException('$element must be an Storelocation!');
}
@@ -67,7 +65,6 @@ class StorelocationRepository extends AbstractPartsContainingRepository
->where('lots.storage_location = ?1')
->setParameter(1, $element);
-
return (int) $qb->getQuery()->getSingleScalarResult();
}
-}
\ No newline at end of file
+}
diff --git a/src/Repository/Parts/SupplierRepository.php b/src/Repository/Parts/SupplierRepository.php
index 6d6242d3..79a52699 100644
--- a/src/Repository/Parts/SupplierRepository.php
+++ b/src/Repository/Parts/SupplierRepository.php
@@ -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;
@@ -30,7 +29,7 @@ class SupplierRepository extends AbstractPartsContainingRepository
{
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{
- if(!$element instanceof Supplier) {
+ if (!$element instanceof Supplier) {
throw new \InvalidArgumentException('$element must be an Supplier!');
}
@@ -43,7 +42,7 @@ class SupplierRepository extends AbstractPartsContainingRepository
->setParameter(1, $element);
foreach ($order_by as $field => $order) {
- $qb->addOrderBy('part.' . $field, $order);
+ $qb->addOrderBy('part.'.$field, $order);
}
return $qb->getQuery()->getResult();
@@ -51,7 +50,7 @@ class SupplierRepository extends AbstractPartsContainingRepository
public function getPartsCount(object $element): int
{
- if(!$element instanceof Supplier) {
+ if (!$element instanceof Supplier) {
throw new \InvalidArgumentException('$element must be an Supplier!');
}
@@ -63,7 +62,6 @@ class SupplierRepository extends AbstractPartsContainingRepository
->where('orderdetail.supplier = ?1')
->setParameter(1, $element);
-
return (int) $qb->getQuery()->getSingleScalarResult();
}
-}
\ No newline at end of file
+}
diff --git a/src/Repository/StructuralDBElementRepository.php b/src/Repository/StructuralDBElementRepository.php
index 74d07682..6332458e 100644
--- a/src/Repository/StructuralDBElementRepository.php
+++ b/src/Repository/StructuralDBElementRepository.php
@@ -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
{
diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php
index 87fa33d0..8d742303 100644
--- a/src/Repository/UserRepository.php
+++ b/src/Repository/UserRepository.php
@@ -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
{
diff --git a/src/Security/EntityListeners/ElementPermissionListener.php b/src/Security/EntityListeners/ElementPermissionListener.php
index bf796e57..8b71d551 100644
--- a/src/Security/EntityListeners/ElementPermissionListener.php
+++ b/src/Security/EntityListeners/ElementPermissionListener.php
@@ -115,7 +115,7 @@ class ElementPermissionListener
);
//Check if user is allowed to read info, otherwise apply placeholder
- if ((null !== $annotation) && ! $this->isGranted('read', $annotation, $element)) {
+ if ((null !== $annotation) && !$this->isGranted('read', $annotation, $element)) {
$property->setAccessible(true);
$value = $annotation->getPlaceholder();
@@ -162,8 +162,8 @@ class ElementPermissionListener
$property->setAccessible(true);
//If the user is not allowed to edit or read this property, reset all values.
- if ((! $this->isGranted('read', $annotation, $element)
- || ! $this->isGranted('edit', $annotation, $element))) {
+ if ((!$this->isGranted('read', $annotation, $element)
+ || !$this->isGranted('edit', $annotation, $element))) {
//Set value to old value, so that there a no change to this property
if (isset($old_data[$property->getName()])) {
$property->setValue($element, $old_data[$property->getName()]);
@@ -186,7 +186,7 @@ class ElementPermissionListener
*/
protected function isRunningFromCLI()
{
- if (empty($_SERVER['REMOTE_ADDR']) && ! isset($_SERVER['HTTP_USER_AGENT']) && count($_SERVER['argv']) > 0) {
+ if (empty($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['HTTP_USER_AGENT']) && count($_SERVER['argv']) > 0) {
return true;
}
@@ -219,7 +219,7 @@ class ElementPermissionListener
}
//Check if we have already have saved the permission, otherwise save it to cache
- if (! isset($this->perm_cache[$mode][get_class($element)][$operation])) {
+ if (!isset($this->perm_cache[$mode][get_class($element)][$operation])) {
$this->perm_cache[$mode][get_class($element)][$operation] = $this->security->isGranted($operation, $element);
}
diff --git a/src/Security/UserChecker.php b/src/Security/UserChecker.php
index e228d166..bc51936b 100644
--- a/src/Security/UserChecker.php
+++ b/src/Security/UserChecker.php
@@ -71,7 +71,7 @@ final class UserChecker implements UserCheckerInterface
*/
public function checkPostAuth(UserInterface $user): void
{
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
return;
}
diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php
index 01b86fe5..6493147f 100644
--- a/src/Security/Voter/AttachmentVoter.php
+++ b/src/Security/Voter/AttachmentVoter.php
@@ -53,8 +53,6 @@ class AttachmentVoter extends ExtendedVoter
* The current user (or the anonymous user) is passed by $user.
*
* @param string $attribute
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Security/Voter/ExtendedVoter.php b/src/Security/Voter/ExtendedVoter.php
index f0ea142d..b2b17838 100644
--- a/src/Security/Voter/ExtendedVoter.php
+++ b/src/Security/Voter/ExtendedVoter.php
@@ -76,7 +76,7 @@ abstract class ExtendedVoter extends Voter
}
// if the user is anonymous, we use the anonymous user.
- if (! $user instanceof User) {
+ if (!$user instanceof User) {
/** @var UserRepository $repo */
$repo = $this->entityManager->getRepository(User::class);
$user = $repo->getAnonymousUser();
@@ -93,8 +93,6 @@ abstract class ExtendedVoter extends Voter
* The current user (or the anonymous user) is passed by $user.
*
* @param string $attribute
- *
- * @return bool
*/
abstract protected function voteOnUser($attribute, $subject, User $user): bool;
}
diff --git a/src/Security/Voter/GroupVoter.php b/src/Security/Voter/GroupVoter.php
index c6eb405f..5c507145 100644
--- a/src/Security/Voter/GroupVoter.php
+++ b/src/Security/Voter/GroupVoter.php
@@ -52,8 +52,6 @@ class GroupVoter extends ExtendedVoter
* The current user (or the anonymous user) is passed by $user.
*
* @param string $attribute
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Security/Voter/LabelProfileVoter.php b/src/Security/Voter/LabelProfileVoter.php
index 837bbe90..5526cdb1 100644
--- a/src/Security/Voter/LabelProfileVoter.php
+++ b/src/Security/Voter/LabelProfileVoter.php
@@ -45,7 +45,7 @@ class LabelProfileVoter extends ExtendedVoter
protected function supports($attribute, $subject)
{
if ($subject instanceof LabelProfile) {
- if (! isset(self::MAPPING[$attribute])) {
+ if (!isset(self::MAPPING[$attribute])) {
return false;
}
diff --git a/src/Security/Voter/StructureVoter.php b/src/Security/Voter/StructureVoter.php
index 0a9d6d98..0161667f 100644
--- a/src/Security/Voter/StructureVoter.php
+++ b/src/Security/Voter/StructureVoter.php
@@ -97,7 +97,7 @@ class StructureVoter extends ExtendedVoter
*/
protected function instanceToPermissionName($subject): ?string
{
- if (! is_string($subject)) {
+ if (!is_string($subject)) {
$class_name = get_class($subject);
} else {
$class_name = $subject;
@@ -122,8 +122,6 @@ class StructureVoter extends ExtendedVoter
* The current user (or the anonymous user) is passed by $user.
*
* @param string $attribute
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Security/Voter/UserVoter.php b/src/Security/Voter/UserVoter.php
index 333c365d..371a12ad 100644
--- a/src/Security/Voter/UserVoter.php
+++ b/src/Security/Voter/UserVoter.php
@@ -73,8 +73,6 @@ class UserVoter extends ExtendedVoter
* The current user (or the anonymous user) is passed by $user.
*
* @param string $attribute
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Services/AmountFormatter.php b/src/Services/AmountFormatter.php
index 4cb7c36e..5754ae7b 100644
--- a/src/Services/AmountFormatter.php
+++ b/src/Services/AmountFormatter.php
@@ -72,7 +72,7 @@ class AmountFormatter
*/
public function format($value, ?MeasurementUnit $unit = null, array $options = [])
{
- if (! is_numeric($value)) {
+ if (!is_numeric($value)) {
throw new InvalidArgumentException('$value must be an numeric value!');
}
$value = (float) $value;
@@ -94,7 +94,7 @@ class AmountFormatter
}
//Otherwise just output it
- if (! empty($options['unit'])) {
+ if (!empty($options['unit'])) {
$format_string = '%.'.$options['decimals'].'f '.$options['unit'];
} else { //Dont add space after number if no unit was specified
$format_string = '%.'.$options['decimals'].'f';
diff --git a/src/Services/Attachments/AttachmentManager.php b/src/Services/Attachments/AttachmentManager.php
index 5818819e..66c8d7df 100644
--- a/src/Services/Attachments/AttachmentManager.php
+++ b/src/Services/Attachments/AttachmentManager.php
@@ -72,7 +72,7 @@ class AttachmentManager
*/
public function attachmentToFile(Attachment $attachment): ?SplFileInfo
{
- if ($attachment->isExternal() || ! $this->isFileExisting($attachment)) {
+ if ($attachment->isExternal() || !$this->isFileExisting($attachment)) {
return null;
}
@@ -150,7 +150,7 @@ class AttachmentManager
return null;
}
- if (! $this->isFileExisting($attachment)) {
+ if (!$this->isFileExisting($attachment)) {
return null;
}
diff --git a/src/Services/Attachments/AttachmentPathResolver.php b/src/Services/Attachments/AttachmentPathResolver.php
index 198c30d2..63af13e9 100644
--- a/src/Services/Attachments/AttachmentPathResolver.php
+++ b/src/Services/Attachments/AttachmentPathResolver.php
@@ -203,7 +203,7 @@ class AttachmentPathResolver
}
//If the new string does not begin with a placeholder, it is invalid
- if (! preg_match('#^%\w+%#', $real_path)) {
+ if (!preg_match('#^%\w+%#', $real_path)) {
return null;
}
diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php
index 66dabc81..a748494e 100644
--- a/src/Services/Attachments/AttachmentSubmitHandler.php
+++ b/src/Services/Attachments/AttachmentSubmitHandler.php
@@ -58,7 +58,6 @@ use App\Entity\Attachments\StorelocationAttachment;
use App\Entity\Attachments\SupplierAttachment;
use App\Entity\Attachments\UserAttachment;
use App\Exceptions\AttachmentDownloadException;
-use Symfony\Component\Form\FormInterface;
use const DIRECTORY_SEPARATOR;
use function get_class;
use InvalidArgumentException;
@@ -82,7 +81,6 @@ class AttachmentSubmitHandler
protected $mimeTypes;
protected $filterTools;
-
public function __construct(AttachmentPathResolver $pathResolver, bool $allow_attachments_downloads,
HttpClientInterface $httpClient, MimeTypesInterface $mimeTypes,
FileTypeFilterTools $filterTools)
@@ -114,9 +112,6 @@ class AttachmentSubmitHandler
/**
* Check if the extension of the uploaded file is allowed for the given attachment type.
* Returns true, if the file is allowed, false if not.
- * @param AttachmentType $attachment_type
- * @param UploadedFile $uploadedFile
- * @return bool
*/
public function isValidFileExtension(AttachmentType $attachment_type, UploadedFile $uploadedFile): bool
{
@@ -174,7 +169,7 @@ class AttachmentSubmitHandler
}
//Ensure the given attachment class is known to mapping
- if (! isset($this->folder_mapping[get_class($attachment)])) {
+ if (!isset($this->folder_mapping[get_class($attachment)])) {
throw new InvalidArgumentException('The given attachment class is not known! The passed class was: '.get_class($attachment));
}
//Ensure the attachment has an assigned element
@@ -260,13 +255,13 @@ class AttachmentSubmitHandler
//Determine the old filepath
$old_path = $this->pathResolver->placeholderToRealPath($attachment->getPath());
- if (! file_exists($old_path)) {
+ if (!file_exists($old_path)) {
return $attachment;
}
$filename = basename($old_path);
//If the basename is not one of the new unique on, we have to save the old filename
- if (! preg_match('#\w+-\w{13}\.#', $filename)) {
+ if (!preg_match('#\w+-\w{13}\.#', $filename)) {
//Save filename to attachment field
$attachment->setFilename($attachment->getFilename());
}
@@ -298,7 +293,7 @@ class AttachmentSubmitHandler
protected function downloadURL(Attachment $attachment, array $options): Attachment
{
//Check if we are allowed to download files
- if (! $this->allow_attachments_downloads) {
+ if (!$this->allow_attachments_downloads) {
throw new RuntimeException('Download of attachments is not allowed!');
}
@@ -348,7 +343,7 @@ class AttachmentSubmitHandler
//Check if we have a extension given
$pathinfo = pathinfo($filename);
- if (! empty($pathinfo['extension'])) {
+ if (!empty($pathinfo['extension'])) {
$new_ext = $pathinfo['extension'];
} else { //Otherwise we have to guess the extension for the new file, based on its content
$new_ext = $this->mimeTypes->getExtensions($this->mimeTypes->guessMimeType($tmp_path))[0] ?? 'tmp';
diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php
index 14bea264..e90643f6 100644
--- a/src/Services/Attachments/AttachmentURLGenerator.php
+++ b/src/Services/Attachments/AttachmentURLGenerator.php
@@ -106,13 +106,12 @@ class AttachmentURLGenerator
/**
* Converts a placeholder path to a path to a image path.
*
- * @param string $placeholder_path the placeholder path that should be converted
- *
- * @return string|null
+ * @param string $placeholder_path the placeholder path that should be converted
*/
public function placeholderPathToAssetPath(string $placeholder_path): ?string
{
$absolute_path = $this->pathResolver->placeholderToRealPath($placeholder_path);
+
return $this->absolutePathToAssetPath($absolute_path);
}
@@ -142,11 +141,11 @@ class AttachmentURLGenerator
*/
public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): string
{
- if (! $attachment->isPicture()) {
+ if (!$attachment->isPicture()) {
throw new InvalidArgumentException('Thumbnail creation only works for picture attachments!');
}
- if ($attachment->isExternal() && ! empty($attachment->getURL())) {
+ if ($attachment->isExternal() && !empty($attachment->getURL())) {
return $attachment->getURL();
}
@@ -165,7 +164,7 @@ class AttachmentURLGenerator
//because the footprints images are small and highly optimized already.
if (('thumbnail_md' === $filter_name && $attachment->isBuiltIn())
//GD can not work with SVG, so serve it directly...
- || $attachment->getExtension() === 'svg') {
+ || 'svg' === $attachment->getExtension()) {
return $this->assets->getUrl($asset_path);
}
diff --git a/src/Services/Attachments/FileTypeFilterTools.php b/src/Services/Attachments/FileTypeFilterTools.php
index bf5640f9..61f24b38 100644
--- a/src/Services/Attachments/FileTypeFilterTools.php
+++ b/src/Services/Attachments/FileTypeFilterTools.php
@@ -91,9 +91,9 @@ class FileTypeFilterTools
//Check for each element if it is valid:
foreach ($elements as $element) {
$element = trim($element);
- if (! preg_match('#^\.\w+$#', $element) // .ext is allowed
- && ! preg_match('#^[-\w.]+\/[-\w.]+#', $element) //Explicit MIME type is allowed
- && ! in_array($element, static::ALLOWED_MIME_PLACEHOLDERS, false)) { //image/* is allowed
+ if (!preg_match('#^\.\w+$#', $element) // .ext is allowed
+ && !preg_match('#^[-\w.]+\/[-\w.]+#', $element) //Explicit MIME type is allowed
+ && !in_array($element, static::ALLOWED_MIME_PLACEHOLDERS, false)) { //image/* is allowed
return false;
}
}
@@ -139,7 +139,7 @@ class FileTypeFilterTools
$element = 'video/*';
} elseif ('audio' === $element || 'audio/' === $element) {
$element = 'audio/*';
- } elseif (! preg_match('#^[-\w.]+\/[-\w.*]+#', $element) && 0 !== strpos($element, '.')) {
+ } elseif (!preg_match('#^[-\w.]+\/[-\w.*]+#', $element) && 0 !== strpos($element, '.')) {
//Convert jpg to .jpg
$element = '.'.$element;
}
diff --git a/src/Services/CustomEnvVarProcessor.php b/src/Services/CustomEnvVarProcessor.php
index 6127fee3..5f369943 100644
--- a/src/Services/CustomEnvVarProcessor.php
+++ b/src/Services/CustomEnvVarProcessor.php
@@ -54,7 +54,7 @@ final class CustomEnvVarProcessor implements EnvVarProcessorInterface
try {
$env = $getEnv($name);
- return ! empty($env) && 'null://null' !== $env;
+ return !empty($env) && 'null://null' !== $env;
} catch (EnvNotFoundException $envNotFoundException) {
return false;
}
diff --git a/src/Services/EntityExporter.php b/src/Services/EntityExporter.php
index 587b20b4..707bf8c0 100644
--- a/src/Services/EntityExporter.php
+++ b/src/Services/EntityExporter.php
@@ -91,13 +91,13 @@ class EntityExporter
$format = $request->get('format') ?? 'json';
//Check if we have one of the supported formats
- if (! in_array($format, ['json', 'csv', 'yaml', 'xml'], true)) {
+ if (!in_array($format, ['json', 'csv', 'yaml', 'xml'], true)) {
throw new InvalidArgumentException('Given format is not supported!');
}
//Check export verbosity level
$level = $request->get('level') ?? 'extended';
- if (! in_array($level, ['simple', 'extended', 'full'], true)) {
+ if (!in_array($level, ['simple', 'extended', 'full'], true)) {
throw new InvalidArgumentException('Given level is not supported!');
}
@@ -145,7 +145,7 @@ class EntityExporter
$response->headers->set('Content-Type', $content_type);
//If view option is not specified, then download the file.
- if (! $request->get('view')) {
+ if (!$request->get('view')) {
if ($entity instanceof AbstractNamedDBElement) {
$entity_name = $entity->getName();
} elseif (is_array($entity)) {
diff --git a/src/Services/EntityImporter.php b/src/Services/EntityImporter.php
index f65aff3e..bac74f0e 100644
--- a/src/Services/EntityImporter.php
+++ b/src/Services/EntityImporter.php
@@ -81,10 +81,10 @@ class EntityImporter
//Expand every line to a single entry:
$names = explode("\n", $lines);
- if (! is_a($class_name, AbstractStructuralDBElement::class, true)) {
+ if (!is_a($class_name, AbstractStructuralDBElement::class, true)) {
throw new InvalidArgumentException('$class_name must be a StructuralDBElement type!');
}
- if (null !== $parent && ! is_a($parent, $class_name)) {
+ if (null !== $parent && !is_a($parent, $class_name)) {
throw new InvalidArgumentException('$parent must have the same type as specified in $class_name!');
}
@@ -201,7 +201,7 @@ class EntityImporter
]);
//Ensure we have an array of entitity elements.
- if (! is_array($entities)) {
+ if (!is_array($entities)) {
$entities = [$entities];
}
diff --git a/src/Services/EntityURLGenerator.php b/src/Services/EntityURLGenerator.php
index 5151a463..4f3080d3 100644
--- a/src/Services/EntityURLGenerator.php
+++ b/src/Services/EntityURLGenerator.php
@@ -127,8 +127,6 @@ class EntityURLGenerator
/**
* Gets the URL to view the given element at a given timestamp.
- *
- * @return string
*/
public function timeTravelURL(AbstractDBElement $entity, \DateTime $dateTime): string
{
@@ -398,7 +396,7 @@ class EntityURLGenerator
$class = get_class($entity);
//Check if we have an direct mapping for the given class
- if (! array_key_exists($class, $map)) {
+ if (!array_key_exists($class, $map)) {
//Check if we need to check inheritance by looping through our map
foreach (array_keys($map) as $key) {
if (is_a($entity, $key)) {
diff --git a/src/Services/ExchangeRateUpdater.php b/src/Services/ExchangeRateUpdater.php
index 4a7cb189..008d1ed5 100644
--- a/src/Services/ExchangeRateUpdater.php
+++ b/src/Services/ExchangeRateUpdater.php
@@ -1,9 +1,7 @@
swap->latest($currency->getIsoCode().'/'.$this->base_currency);
$currency->setExchangeRate(BigDecimal::of($rate->getValue()));
+
return $currency;
}
-
-}
\ No newline at end of file
+}
diff --git a/src/Services/FAIconGenerator.php b/src/Services/FAIconGenerator.php
index fe6e6c4b..afbcfbba 100644
--- a/src/Services/FAIconGenerator.php
+++ b/src/Services/FAIconGenerator.php
@@ -93,7 +93,7 @@ class FAIconGenerator
*
* @param string $icon_class The icon which should be shown (e.g. fa-file-text)
* @param string $style The style of the icon 'fas'
- * @param string $options Any other css class attributes like size, etc.
+ * @param string $options any other css class attributes like size, etc
*
* @return string The final html
*/
diff --git a/src/Services/GitVersionInfo.php b/src/Services/GitVersionInfo.php
index 8bd54282..f9b1da38 100644
--- a/src/Services/GitVersionInfo.php
+++ b/src/Services/GitVersionInfo.php
@@ -64,7 +64,7 @@ class GitVersionInfo
$git = file($this->project_dir.'/.git/HEAD');
$head = explode('/', $git[0], 3);
- if (! isset($head[2])) {
+ if (!isset($head[2])) {
return null;
}
@@ -89,7 +89,7 @@ class GitVersionInfo
if (is_file($filename)) {
$head = file($filename);
- if (! isset($head[0])) {
+ if (!isset($head[0])) {
return null;
}
diff --git a/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php b/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php
index f4260563..92452a8c 100644
--- a/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php
+++ b/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php
@@ -51,8 +51,6 @@ final class BarcodeContentGenerator
/**
* Generates a fixed URL to the given Element that can be embedded in a 2D code (e.g. QR code).
- *
- * @return string
*/
public function getURLContent(AbstractDBElement $target): string
{
@@ -68,8 +66,6 @@ final class BarcodeContentGenerator
/**
* Returns a Code that can be used in a 1D barcode.
* The return value has a format of "L0123".
- *
- * @return string
*/
public function get1DBarcodeContent(AbstractDBElement $target): string
{
diff --git a/src/Services/LabelSystem/Barcodes/BarcodeExampleElementsGenerator.php b/src/Services/LabelSystem/Barcodes/BarcodeExampleElementsGenerator.php
index 29150c17..d0ac5d97 100644
--- a/src/Services/LabelSystem/Barcodes/BarcodeExampleElementsGenerator.php
+++ b/src/Services/LabelSystem/Barcodes/BarcodeExampleElementsGenerator.php
@@ -102,7 +102,7 @@ final class BarcodeExampleElementsGenerator
private function getStructuralData(string $class): AbstractStructuralDBElement
{
- if (! is_a($class, AbstractStructuralDBElement::class, true)) {
+ if (!is_a($class, AbstractStructuralDBElement::class, true)) {
throw new \InvalidArgumentException('$class must be an child of AbstractStructuralDBElement');
}
diff --git a/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php b/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php
index e8c69a8f..542ede10 100644
--- a/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php
+++ b/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php
@@ -34,8 +34,6 @@ final class BarcodeNormalizer
/**
* Parses barcode content and normalizes it.
* Returns an array in the format ['part', 1]: First entry contains element type, second the ID of the element.
- *
- * @return array
*/
public function normalizeBarcodeContent(string $input): array
{
@@ -55,7 +53,7 @@ final class BarcodeNormalizer
$prefix = $matches[1];
$id = (int) $matches[2];
- if (! isset(self::PREFIX_TYPE_MAP[$prefix])) {
+ if (!isset(self::PREFIX_TYPE_MAP[$prefix])) {
throw new \InvalidArgumentException('Unknown prefix '.$prefix);
}
@@ -67,7 +65,7 @@ final class BarcodeNormalizer
$prefix = $matches[1];
$id = (int) $matches[2];
- if (! isset(self::PREFIX_TYPE_MAP[$prefix])) {
+ if (!isset(self::PREFIX_TYPE_MAP[$prefix])) {
throw new \InvalidArgumentException('Unknown prefix '.$prefix);
}
diff --git a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php
index 5cd8da08..4ce169ef 100644
--- a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php
+++ b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php
@@ -45,7 +45,7 @@ final class BarcodeRedirector
* @param string $type The type of the element that was scanned (e.g. 'part', 'lot', etc.)
* @param int $id The ID of the element that was scanned
*
- * @return string The URL to which should be redirected.
+ * @return string the URL to which should be redirected
*
* @throws EntityNotFoundException
*/
diff --git a/src/Services/LabelSystem/LabelGenerator.php b/src/Services/LabelSystem/LabelGenerator.php
index f3049166..f547bb8f 100644
--- a/src/Services/LabelSystem/LabelGenerator.php
+++ b/src/Services/LabelSystem/LabelGenerator.php
@@ -48,21 +48,19 @@ final class LabelGenerator
/**
* @param object|object[] $elements An element or an array of elements for which labels should be generated
- *
- * @return string
*/
public function generateLabel(LabelOptions $options, $elements): string
{
- if (! is_array($elements) && ! is_object($elements)) {
+ if (!is_array($elements) && !is_object($elements)) {
throw new \InvalidArgumentException('$element must be an object or an array of objects!');
}
- if (! is_array($elements)) {
+ if (!is_array($elements)) {
$elements = [$elements];
}
foreach ($elements as $element) {
- if (! $this->supports($options, $element)) {
+ if (!$this->supports($options, $element)) {
throw new \InvalidArgumentException('The given options are not compatible with the given element!');
}
}
@@ -83,7 +81,7 @@ final class LabelGenerator
public function supports(LabelOptions $options, object $element)
{
$supported_type = $options->getSupportedElement();
- if (! isset(static::CLASS_SUPPORT_MAPPING[$supported_type])) {
+ if (!isset(static::CLASS_SUPPORT_MAPPING[$supported_type])) {
throw new \InvalidArgumentException('Supported type name of the Label options not known!');
}
diff --git a/src/Services/LabelSystem/LabelTextReplacer.php b/src/Services/LabelSystem/LabelTextReplacer.php
index 1413d7ab..de90bb38 100644
--- a/src/Services/LabelSystem/LabelTextReplacer.php
+++ b/src/Services/LabelSystem/LabelTextReplacer.php
@@ -43,7 +43,7 @@ final class LabelTextReplacer
* If the given string is not a placeholder or the placeholder is not known, it will be returned unchanged.
*
* @param string $placeholder The placeholder that should be replaced. (e.g. '%%PLACEHOLDER%%')
- * @param object $target The object that should be used for the placeholder info source.
+ * @param object $target the object that should be used for the placeholder info source
*
* @return string If the placeholder was valid, the replaced info. Otherwise the passed string.
*/
@@ -64,9 +64,9 @@ final class LabelTextReplacer
* Replaces all placeholders in the input lines.
*
* @param string $lines The input lines that should be replaced
- * @param object $target The object that should be used as source for the informations.
+ * @param object $target the object that should be used as source for the informations
*
- * @return string The Lines with replaced informations.
+ * @return string the Lines with replaced informations
*/
public function replace(string $lines, object $target): string
{
diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php
index 3098c1cc..96145465 100644
--- a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php
+++ b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php
@@ -40,7 +40,7 @@ final class PartProvider implements PlaceholderProviderInterface
public function replace(string $placeholder, object $part, array $options = []): ?string
{
- if (! $part instanceof Part) {
+ if (!$part instanceof Part) {
return null;
}
diff --git a/src/Services/LabelSystem/PlaceholderProviders/PlaceholderProviderInterface.php b/src/Services/LabelSystem/PlaceholderProviders/PlaceholderProviderInterface.php
index cb259dcc..4863d290 100644
--- a/src/Services/LabelSystem/PlaceholderProviders/PlaceholderProviderInterface.php
+++ b/src/Services/LabelSystem/PlaceholderProviders/PlaceholderProviderInterface.php
@@ -31,9 +31,9 @@ interface PlaceholderProviderInterface
*
* @param string $placeholder The placeholder (e.g. "%%PLACEHOLDER%%") that should be replaced
* @param object $label_target The object that is targeted by the label
- * @param array $options A list of options that can be used to specify the generated output further.
+ * @param array $options a list of options that can be used to specify the generated output further
*
- * @return string|null The real value of this placeholder, null if not supported.
+ * @return string|null the real value of this placeholder, null if not supported
*/
public function replace(string $placeholder, object $label_target, array $options = []): ?string;
}
diff --git a/src/Services/LogSystem/EventCommentHelper.php b/src/Services/LogSystem/EventCommentHelper.php
index 472293ee..92cf978b 100644
--- a/src/Services/LogSystem/EventCommentHelper.php
+++ b/src/Services/LogSystem/EventCommentHelper.php
@@ -51,8 +51,6 @@ class EventCommentHelper
/**
* Returns the currently set message, or null if no message is set yet.
- *
- * @return string|null
*/
public function getMessage(): ?string
{
@@ -69,8 +67,6 @@ class EventCommentHelper
/**
* Check if a message is currently set.
- *
- * @return bool
*/
public function isMessageSet(): bool
{
diff --git a/src/Services/LogSystem/EventLogger.php b/src/Services/LogSystem/EventLogger.php
index 0569ac6f..7a90e9a4 100644
--- a/src/Services/LogSystem/EventLogger.php
+++ b/src/Services/LogSystem/EventLogger.php
@@ -68,7 +68,7 @@ class EventLogger
* Adds the given log entry to the Log, if the entry fullfills the global configured criterias.
* The change will not be flushed yet.
*
- * @return bool Returns true, if the event was added to log.
+ * @return bool returns true, if the event was added to log
*/
public function log(AbstractLogEntry $logEntry): bool
{
@@ -99,7 +99,7 @@ class EventLogger
/**
* Adds the given log entry to the Log, if the entry fullfills the global configured criterias and flush afterwards.
*
- * @return bool Returns true, if the event was added to log.
+ * @return bool returns true, if the event was added to log
*/
public function logAndFlush(AbstractLogEntry $logEntry): bool
{
@@ -126,12 +126,12 @@ class EventLogger
}
//Check if the event type is black listed
- if (! empty($blacklist) && $this->isObjectClassInArray($logEntry, $blacklist)) {
+ if (!empty($blacklist) && $this->isObjectClassInArray($logEntry, $blacklist)) {
return false;
}
//Check for whitelisting
- if (! empty($whitelist) && ! $this->isObjectClassInArray($logEntry, $whitelist)) {
+ if (!empty($whitelist) && !$this->isObjectClassInArray($logEntry, $whitelist)) {
return false;
}
@@ -143,9 +143,7 @@ class EventLogger
* Check if the object type is given in the classes array. This also works for inherited types.
*
* @param object $object The object which should be checked
- * @param string[] $classes The list of class names that should be used for checking.
- *
- * @return bool
+ * @param string[] $classes the list of class names that should be used for checking
*/
protected function isObjectClassInArray(object $object, array $classes): bool
{
diff --git a/src/Services/LogSystem/EventUndoHelper.php b/src/Services/LogSystem/EventUndoHelper.php
index ccc64ed9..def06817 100644
--- a/src/Services/LogSystem/EventUndoHelper.php
+++ b/src/Services/LogSystem/EventUndoHelper.php
@@ -43,7 +43,7 @@ class EventUndoHelper
public function setMode(string $mode): void
{
- if (! in_array($mode, self::ALLOWED_MODES, true)) {
+ if (!in_array($mode, self::ALLOWED_MODES, true)) {
throw new \InvalidArgumentException('Invalid mode passed!');
}
$this->mode = $mode;
@@ -65,8 +65,6 @@ class EventUndoHelper
/**
* Returns event that is currently undone.
- *
- * @return AbstractLogEntry|null
*/
public function getUndoneEvent(): ?AbstractLogEntry
{
@@ -83,8 +81,6 @@ class EventUndoHelper
/**
* Check if a event is undone.
- *
- * @return bool
*/
public function isUndo(): bool
{
diff --git a/src/Services/LogSystem/HistoryHelper.php b/src/Services/LogSystem/HistoryHelper.php
index 193c891d..2278fe7d 100644
--- a/src/Services/LogSystem/HistoryHelper.php
+++ b/src/Services/LogSystem/HistoryHelper.php
@@ -38,8 +38,6 @@ class HistoryHelper
* Returns an array containing all elements that are associated with the argument.
* The returned array contains the given element.
*
- * @return array
- *
* @psalm-return array<\App\Entity\Parameters\AbstractParameter|array-key, mixed>
*/
public function getAssociatedElements(AbstractDBElement $element): array
diff --git a/src/Services/LogSystem/LogEntryExtraFormatter.php b/src/Services/LogSystem/LogEntryExtraFormatter.php
index a49489da..39428681 100644
--- a/src/Services/LogSystem/LogEntryExtraFormatter.php
+++ b/src/Services/LogSystem/LogEntryExtraFormatter.php
@@ -77,8 +77,6 @@ class LogEntryExtraFormatter
/**
* Return an user viewable representation of the extra data in a log entry, styled for console output.
- *
- * @return string
*/
public function formatConsole(AbstractLogEntry $logEntry): string
{
@@ -92,7 +90,7 @@ class LogEntryExtraFormatter
$str .= ''.$this->translator->trans($key).': ';
}
$str .= $value;
- if (! empty($str)) {
+ if (!empty($str)) {
$tmp[] = $str;
}
}
@@ -102,8 +100,6 @@ class LogEntryExtraFormatter
/**
* Return a HTML formatted string containing a user viewable form of the Extra data.
- *
- * @return string
*/
public function format(AbstractLogEntry $context): string
{
@@ -117,7 +113,7 @@ class LogEntryExtraFormatter
$str .= ''.$this->translator->trans($key).': ';
}
$str .= $value;
- if (! empty($str)) {
+ if (!empty($str)) {
$tmp[] = $str;
}
}
@@ -187,7 +183,7 @@ class LogEntryExtraFormatter
'%s %s (%s)',
$context->getOldInstock(),
$context->getNewInstock(),
- (! $context->isWithdrawal() ? '+' : '-').$context->getDifference(true)
+ (!$context->isWithdrawal() ? '+' : '-').$context->getDifference(true)
);
$array['log.instock_changed.comment'] = htmlspecialchars($context->getComment());
}
diff --git a/src/Services/LogSystem/TimeTravel.php b/src/Services/LogSystem/TimeTravel.php
index 50ec7076..9cd63f74 100644
--- a/src/Services/LogSystem/TimeTravel.php
+++ b/src/Services/LogSystem/TimeTravel.php
@@ -52,9 +52,7 @@ class TimeTravel
* Undeletes the element with the given ID.
*
* @param string $class The class name of the element that should be undeleted
- * @param int $id The ID of the element that should be undeleted.
- *
- * @return AbstractDBElement
+ * @param int $id the ID of the element that should be undeleted
*/
public function undeleteEntity(string $class, int $id): AbstractDBElement
{
@@ -80,7 +78,7 @@ class TimeTravel
*/
public function revertEntityToTimestamp(AbstractDBElement $element, \DateTime $timestamp, array $reverted_elements = []): void
{
- if (! $element instanceof TimeStampableInterface) {
+ if (!$element instanceof TimeStampableInterface) {
throw new \InvalidArgumentException('$element must have a Timestamp!');
}
@@ -154,7 +152,7 @@ class TimeTravel
foreach ($target_elements as $target_element) {
if (null !== $target_element && $element->getLastModified() >= $timestamp) {
//Remove the element from collection, if it did not existed at $timestamp
- if (! $this->repo->getElementExistedAtTimestamp($target_element, $timestamp)) {
+ if (!$this->repo->getElementExistedAtTimestamp($target_element, $timestamp)) {
if ($target_elements instanceof Collection) {
$target_elements->removeElement($target_element);
}
@@ -174,10 +172,10 @@ class TimeTravel
public function applyEntry(AbstractDBElement $element, TimeTravelInterface $logEntry): void
{
//Skip if this does not provide any info...
- if (! $logEntry->hasOldDataInformations()) {
+ if (!$logEntry->hasOldDataInformations()) {
return;
}
- if (! $element instanceof TimeStampableInterface) {
+ if (!$element instanceof TimeStampableInterface) {
return;
}
$metadata = $this->em->getClassMetadata(get_class($element));
@@ -185,8 +183,7 @@ class TimeTravel
foreach ($old_data as $field => $data) {
if ($metadata->hasField($field)) {
-
- if ($metadata->getFieldMapping($field)['type'] === 'big_decimal') {
+ if ('big_decimal' === $metadata->getFieldMapping($field)['type']) {
//We need to convert the string to a BigDecimal first
if (!$data instanceof BigDecimal) {
$data = BigDecimal::of($data);
@@ -227,7 +224,6 @@ class TimeTravel
$property = $reflection->getProperty($field);
$property->setAccessible(true);
-
$property->setValue($element, $new_value);
}
}
diff --git a/src/Services/Misc/RangeParser.php b/src/Services/Misc/RangeParser.php
index ea857dbf..cf7f754d 100644
--- a/src/Services/Misc/RangeParser.php
+++ b/src/Services/Misc/RangeParser.php
@@ -66,7 +66,7 @@ class RangeParser
*
* @param string $range_str The string that should be checked
*
- * @return bool True if the string is valid, false if not.
+ * @return bool true if the string is valid, false if not
*/
public function isValidRange(string $range_str): bool
{
diff --git a/src/Services/MoneyFormatter.php b/src/Services/MoneyFormatter.php
index b5f54339..8f88b0f7 100644
--- a/src/Services/MoneyFormatter.php
+++ b/src/Services/MoneyFormatter.php
@@ -70,7 +70,7 @@ class MoneyFormatter
public function format($value, ?Currency $currency = null, $decimals = 5, bool $show_all_digits = false)
{
$iso_code = $this->base_currency;
- if (null !== $currency && ! empty($currency->getIsoCode())) {
+ if (null !== $currency && !empty($currency->getIsoCode())) {
$iso_code = $currency->getIsoCode();
}
diff --git a/src/Services/Parameters/ParameterExtractor.php b/src/Services/Parameters/ParameterExtractor.php
index 4a37314b..4f2c344f 100644
--- a/src/Services/Parameters/ParameterExtractor.php
+++ b/src/Services/Parameters/ParameterExtractor.php
@@ -40,7 +40,7 @@ class ParameterExtractor
*/
public function extractParameters(string $input, string $class = PartParameter::class): array
{
- if (! is_a($class, AbstractParameter::class, true)) {
+ if (!is_a($class, AbstractParameter::class, true)) {
throw new \InvalidArgumentException('$class must be a child class of AbstractParameter!');
}
@@ -68,7 +68,7 @@ class ParameterExtractor
$matches = [];
\preg_match($regex, $input, $matches);
- if (! empty($matches)) {
+ if (!empty($matches)) {
[, $name, $value] = $matches;
$value = trim($value);
diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php
index 6db7a3fa..3f83d994 100644
--- a/src/Services/Parts/PartsTableActionHandler.php
+++ b/src/Services/Parts/PartsTableActionHandler.php
@@ -20,7 +20,6 @@
namespace App\Services\Parts;
-
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
@@ -43,8 +42,10 @@ final class PartsTableActionHandler
}
/**
- * Converts the given array to an array of Parts
- * @param string $ids A comma separated list of Part IDs.
+ * Converts the given array to an array of Parts.
+ *
+ * @param string $ids a comma separated list of Part IDs
+ *
* @return Part[]
*/
public function idStringToArray(string $ids): array
@@ -53,13 +54,12 @@ final class PartsTableActionHandler
/** @var DBElementRepository $repo */
$repo = $this->entityManager->getRepository(Part::class);
+
return $repo->getElementsFromIDArray($id_array);
}
/**
- * @param string $action
- * @param Part[] $selected_parts
- * @param int|null $target_id
+ * @param Part[] $selected_parts
*/
public function handleAction(string $action, array $selected_parts, ?int $target_id): void
{
@@ -89,19 +89,19 @@ final class PartsTableActionHandler
break;
case 'change_footprint':
$this->denyAccessUnlessGranted('footprint.edit', $part);
- $part->setFootprint($target_id === null ? null : $this->entityManager->find(Footprint::class, $target_id));
+ $part->setFootprint(null === $target_id ? null : $this->entityManager->find(Footprint::class, $target_id));
break;
case 'change_manufacturer':
$this->denyAccessUnlessGranted('manufacturer.edit', $part);
- $part->setManufacturer($target_id === null ? null : $this->entityManager->find(Manufacturer::class, $target_id));
+ $part->setManufacturer(null === $target_id ? null : $this->entityManager->find(Manufacturer::class, $target_id));
break;
case 'change_unit':
$this->denyAccessUnlessGranted('unit.edit', $part);
- $part->setPartUnit($target_id === null ? null : $this->entityManager->find(MeasurementUnit::class, $target_id));
+ $part->setPartUnit(null === $target_id ? null : $this->entityManager->find(MeasurementUnit::class, $target_id));
break;
default:
- throw new \InvalidArgumentException('The given action is unknown! (' . $action . ')');
+ throw new \InvalidArgumentException('The given action is unknown! ('.$action.')');
}
}
}
@@ -122,4 +122,4 @@ final class PartsTableActionHandler
throw $exception;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/PasswordResetManager.php b/src/Services/PasswordResetManager.php
index 95cf212c..7bb18175 100644
--- a/src/Services/PasswordResetManager.php
+++ b/src/Services/PasswordResetManager.php
@@ -91,7 +91,7 @@ class PasswordResetManager
$expiration_date->add(date_interval_create_from_date_string('1 day'));
$user->setPwResetExpires($expiration_date);
- if (! empty($user->getEmail())) {
+ if (!empty($user->getEmail())) {
$address = new Address($user->getEmail(), $user->getFullName());
$mail = new TemplatedEmail();
$mail->to($address);
@@ -139,7 +139,7 @@ class PasswordResetManager
}
//Check if token is valid
- if (! $this->passwordEncoder->isPasswordValid($user->getPwResetToken(), $token, null)) {
+ if (!$this->passwordEncoder->isPasswordValid($user->getPwResetToken(), $token, null)) {
return false;
}
diff --git a/src/Services/PermissionResolver.php b/src/Services/PermissionResolver.php
index 65ca59f3..fdfd0ae2 100644
--- a/src/Services/PermissionResolver.php
+++ b/src/Services/PermissionResolver.php
@@ -171,7 +171,7 @@ class PermissionResolver
*/
public function listOperationsForPermission(string $permission): array
{
- if (! $this->isValidPermission($permission)) {
+ if (!$this->isValidPermission($permission)) {
throw new \InvalidArgumentException(sprintf('A permission with that name is not existing! Got %s.', $permission));
}
$operations = $this->permission_structure['perms'][$permission]['operations'];
@@ -210,7 +210,7 @@ class PermissionResolver
$cache = new ConfigCache($this->cache_file, $this->is_debug);
//Check if the cache is fresh, else regenerate it.
- if (! $cache->isFresh()) {
+ if (!$cache->isFresh()) {
$permission_file = __DIR__.'/../../config/permissions.yaml';
//Read the permission config file...
diff --git a/src/Services/PricedetailHelper.php b/src/Services/PricedetailHelper.php
index 5de1ba0f..81bf970d 100644
--- a/src/Services/PricedetailHelper.php
+++ b/src/Services/PricedetailHelper.php
@@ -150,7 +150,7 @@ class PricedetailHelper
* @param Currency|null $currency The currency in which the average price should be calculated
*
* @return BigDecimal|null The Average price as bcmath string. Returns null, if it was not possible to calculate the
- * price for the given
+ * price for the given
*/
public function calculateAvgPrice(Part $part, ?float $amount = null, ?Currency $currency = null): ?BigDecimal
{
@@ -200,7 +200,7 @@ class PricedetailHelper
* Set to null, to use global base currency.
*
* @return BigDecimal|null The value in $targetCurrency given as bcmath string.
- * Returns null, if it was not possible to convert between both values (e.g. when the exchange rates are missing)
+ * Returns null, if it was not possible to convert between both values (e.g. when the exchange rates are missing)
*/
public function convertMoneyToCurrency(BigDecimal $value, ?Currency $originCurrency = null, ?Currency $targetCurrency = null): ?BigDecimal
{
@@ -213,7 +213,7 @@ class PricedetailHelper
//Convert value to base currency
if (null !== $originCurrency) {
//Without an exchange rate we can not calculate the exchange rate
- if ($originCurrency->getExchangeRate() === null || $originCurrency->getExchangeRate()->isZero()) {
+ if (null === $originCurrency->getExchangeRate() || $originCurrency->getExchangeRate()->isZero()) {
return null;
}
diff --git a/src/Services/StatisticsHelper.php b/src/Services/StatisticsHelper.php
index da7613f2..2afa3068 100644
--- a/src/Services/StatisticsHelper.php
+++ b/src/Services/StatisticsHelper.php
@@ -61,8 +61,6 @@ class StatisticsHelper
/**
* Returns the summed instocked over all parts (only parts without a measurement unit).
*
- * @return float
- *
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
@@ -74,8 +72,6 @@ class StatisticsHelper
/**
* Returns the number of all parts which have price informations.
*
- * @return int
- *
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
@@ -86,8 +82,6 @@ class StatisticsHelper
/**
* Returns the number of datastructures for the given type.
- *
- * @return int
*/
public function getDataStructuresCount(string $type): int
{
@@ -103,7 +97,7 @@ class StatisticsHelper
'currency' => Currency::class,
];
- if (! isset($arr[$type])) {
+ if (!isset($arr[$type])) {
throw new \InvalidArgumentException('No count for the given type available!');
}
@@ -115,8 +109,6 @@ class StatisticsHelper
/**
* Gets the count of all attachments.
- *
- * @return int
*/
public function getAttachmentsCount(): int
{
@@ -125,8 +117,6 @@ class StatisticsHelper
/**
* Gets the count of all private/secure attachments.
- *
- * @return int
*/
public function getPrivateAttachmentsCount(): int
{
@@ -136,8 +126,6 @@ class StatisticsHelper
/**
* Gets the count of all external (only containing an URL) attachments.
*
- * @return int
- *
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
@@ -149,8 +137,6 @@ class StatisticsHelper
/**
* Gets the count of all attachments where the user uploaded an file.
*
- * @return int
- *
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
diff --git a/src/Services/StructuralElementRecursionHelper.php b/src/Services/StructuralElementRecursionHelper.php
index 23ad2f84..140c696f 100644
--- a/src/Services/StructuralElementRecursionHelper.php
+++ b/src/Services/StructuralElementRecursionHelper.php
@@ -76,7 +76,7 @@ class StructuralElementRecursionHelper
$children = $element->getChildren();
//If we should call from top we execute the func here.
- if (! $call_from_bottom) {
+ if (!$call_from_bottom) {
$func($element);
}
diff --git a/src/Services/TFA/BackupCodeGenerator.php b/src/Services/TFA/BackupCodeGenerator.php
index 038e38e2..b7ace1c4 100644
--- a/src/Services/TFA/BackupCodeGenerator.php
+++ b/src/Services/TFA/BackupCodeGenerator.php
@@ -53,8 +53,8 @@ class BackupCodeGenerator
/**
* BackupCodeGenerator constructor.
*
- * @param int $code_length How many characters a single code should have.
- * @param int $code_count How many codes are generated for a whole backup set.
+ * @param int $code_length how many characters a single code should have
+ * @param int $code_count how many codes are generated for a whole backup set
*/
public function __construct(int $code_length, int $code_count)
{
@@ -75,7 +75,7 @@ class BackupCodeGenerator
*
* @return string The generated backup code (e.g. 1f3870be2)
*
- * @throws \Exception If no entropy source is available.
+ * @throws \Exception if no entropy source is available
*/
public function generateSingleCode(): string
{
@@ -87,7 +87,7 @@ class BackupCodeGenerator
/**
* Returns a full backup code set. The code count can be configured in the constructor.
*
- * @return string[] An array containing different backup codes.
+ * @return string[] an array containing different backup codes
*/
public function generateCodeSet(): array
{
diff --git a/src/Services/TranslationExtractor/PermissionExtractor.php b/src/Services/TranslationExtractor/PermissionExtractor.php
index b6f8ffa0..8010fac8 100644
--- a/src/Services/TranslationExtractor/PermissionExtractor.php
+++ b/src/Services/TranslationExtractor/PermissionExtractor.php
@@ -68,7 +68,7 @@ final class PermissionExtractor implements ExtractorInterface
*/
public function extract($resource, MessageCatalogue $catalogue): void
{
- if (! $this->finished) {
+ if (!$this->finished) {
//Extract for every group...
foreach ($this->permission_structure['groups'] as $group) {
if (isset($group['label'])) {
diff --git a/src/Services/Trees/NodesListBuilder.php b/src/Services/Trees/NodesListBuilder.php
index b108b315..3bb13486 100644
--- a/src/Services/Trees/NodesListBuilder.php
+++ b/src/Services/Trees/NodesListBuilder.php
@@ -69,10 +69,10 @@ class NodesListBuilder
* Gets a flattened hierachical tree. Useful for generating option lists.
* In difference to the Repository Function, the results here are cached.
*
- * @param string $class_name The class name of the entity you want to retrieve.
+ * @param string $class_name the class name of the entity you want to retrieve
* @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 typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array
{
diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php
index 76569d8e..759d19cc 100644
--- a/src/Services/Trees/ToolsTreeBuilder.php
+++ b/src/Services/Trees/ToolsTreeBuilder.php
@@ -94,7 +94,7 @@ class ToolsTreeBuilder
* Generates the tree for the tools menu.
* The result is cached.
*
- * @return TreeViewNode[] The array containing all Nodes for the tools menu.
+ * @return TreeViewNode[] the array containing all Nodes for the tools menu
*/
public function getTree(): array
{
@@ -264,8 +264,6 @@ class ToolsTreeBuilder
/**
* This function creates the tree entries for the "system" node of the tools tree.
- *
- * @return array
*/
protected function getSystemNodes(): array
{
diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php
index f0a406d2..3dc0a7ea 100644
--- a/src/Services/Trees/TreeViewGenerator.php
+++ b/src/Services/Trees/TreeViewGenerator.php
@@ -82,7 +82,7 @@ class TreeViewGenerator
* Set to empty string, to disable href field.
* @param AbstractDBElement|null $selectedElement The element that should be selected. If set to null, no element will be selected.
*
- * @return TreeViewNode[] An array of TreeViewNode[] elements of the root elements.
+ * @return TreeViewNode[] an array of TreeViewNode[] elements of the root elements
*/
public function getTreeView(string $class, ?AbstractStructuralDBElement $parent = null, string $href_type = 'list_parts', ?AbstractDBElement $selectedElement = null): array
{
@@ -114,11 +114,11 @@ class TreeViewGenerator
$item->setSelected(true);
}
- if (! empty($item->getNodes())) {
+ if (!empty($item->getNodes())) {
$item->addTag((string) \count($item->getNodes()));
}
- if (! empty($href_type) && null !== $item->getId()) {
+ if (!empty($href_type) && null !== $item->getId()) {
$entity = $this->em->getPartialReference($class, $item->getId());
$item->setHref($this->urlGenerator->getURL($entity, $href_type));
}
@@ -138,16 +138,16 @@ class TreeViewGenerator
* The treeview is generic, that means the href are null and ID values are set.
*
* @param string $class The class for which the tree should be generated
- * @param AbstractStructuralDBElement|null $parent The parent the root elements should have.
+ * @param AbstractStructuralDBElement|null $parent the parent the root elements should have
*
* @return TreeViewNode[]
*/
public function getGenericTree(string $class, ?AbstractStructuralDBElement $parent = null): array
{
- if (! is_a($class, AbstractNamedDBElement::class, true)) {
+ if (!is_a($class, AbstractNamedDBElement::class, true)) {
throw new \InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!');
}
- if (null !== $parent && ! is_a($parent, $class)) {
+ if (null !== $parent && !is_a($parent, $class)) {
throw new \InvalidArgumentException('$parent must be of the type $class!');
}
diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php
index 8ed0c883..62ca61b9 100644
--- a/src/Twig/AppExtension.php
+++ b/src/Twig/AppExtension.php
@@ -135,8 +135,6 @@ class AppExtension extends AbstractExtension
/**
* This function/filter generates an path.
- *
- * @return string
*/
public function loginPath(string $path): string
{
diff --git a/src/Twig/BarcodeExtension.php b/src/Twig/BarcodeExtension.php
index 0b4b72c6..30b60384 100644
--- a/src/Twig/BarcodeExtension.php
+++ b/src/Twig/BarcodeExtension.php
@@ -20,7 +20,6 @@
namespace App\Twig;
-
use Com\Tecnick\Barcode\Barcode;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
@@ -30,11 +29,12 @@ class BarcodeExtension extends AbstractExtension
public function getFilters()
{
return [
- new TwigFilter('barcodeSVG', function (string $content, string $type = "QRCODE") {
+ new TwigFilter('barcodeSVG', function (string $content, string $type = 'QRCODE') {
$barcodeFactory = new Barcode();
$barcode = $barcodeFactory->getBarcodeObj($type, $content);
+
return $barcode->getSvgCode();
}),
];
}
-}
\ No newline at end of file
+}
diff --git a/src/Twig/Sandbox/InheritanceSecurityPolicy.php b/src/Twig/Sandbox/InheritanceSecurityPolicy.php
index 5ad6d007..cbaf5424 100644
--- a/src/Twig/Sandbox/InheritanceSecurityPolicy.php
+++ b/src/Twig/Sandbox/InheritanceSecurityPolicy.php
@@ -77,19 +77,19 @@ final class InheritanceSecurityPolicy implements SecurityPolicyInterface
public function checkSecurity($tags, $filters, $functions): void
{
foreach ($tags as $tag) {
- if (! \in_array($tag, $this->allowedTags, true)) {
+ if (!\in_array($tag, $this->allowedTags, true)) {
throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag);
}
}
foreach ($filters as $filter) {
- if (! \in_array($filter, $this->allowedFilters, true)) {
+ if (!\in_array($filter, $this->allowedFilters, true)) {
throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter);
}
}
foreach ($functions as $function) {
- if (! \in_array($function, $this->allowedFunctions, true)) {
+ if (!\in_array($function, $this->allowedFunctions, true)) {
throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function);
}
}
@@ -114,7 +114,7 @@ final class InheritanceSecurityPolicy implements SecurityPolicyInterface
}
}
- if (! $allowed) {
+ if (!$allowed) {
$class = \get_class($obj);
throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method);
@@ -135,7 +135,7 @@ final class InheritanceSecurityPolicy implements SecurityPolicyInterface
}
}
- if (! $allowed) {
+ if (!$allowed) {
$class = \get_class($obj);
throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property);
diff --git a/src/Twig/TypeLabelExtension.php b/src/Twig/TypeLabelExtension.php
index 1b398dda..3b25a60b 100644
--- a/src/Twig/TypeLabelExtension.php
+++ b/src/Twig/TypeLabelExtension.php
@@ -1,9 +1,7 @@
nameGenerator, 'getTypeNameCombination']),
];
}
-}
\ No newline at end of file
+}
diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php
index e140223c..49d15fb8 100644
--- a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php
+++ b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php
@@ -20,7 +20,6 @@
namespace App\Validator\Constraints\BigDecimal;
-
use Brick\Math\BigDecimal;
use Symfony\Component\Validator\Constraints\AbstractComparisonValidator;
use Symfony\Component\Validator\Constraints\GreaterThan;
@@ -56,4 +55,4 @@ class BigDecimalGreaterThanValidator extends AbstractComparisonValidator
{
return GreaterThan::TOO_LOW_ERROR;
}
-}
\ No newline at end of file
+}
diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php
index dd1887b0..bc88027b 100644
--- a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php
+++ b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php
@@ -20,7 +20,6 @@
namespace App\Validator\Constraints\BigDecimal;
-
use Brick\Math\BigDecimal;
use Symfony\Component\Validator\Constraints\AbstractComparisonValidator;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php b/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php
index aa92a3ab..1f843966 100644
--- a/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php
+++ b/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php
@@ -20,9 +20,7 @@
namespace App\Validator\Constraints\BigDecimal;
-
use Symfony\Component\Validator\Constraints\GreaterThan;
-use Symfony\Component\Validator\Constraints\GreaterThanValidator;
use Symfony\Component\Validator\Constraints\NumberConstraintTrait;
/**
@@ -46,4 +44,4 @@ class BigDecimalPositive extends GreaterThan
{
return BigDecimalGreaterThanValidator::class;
}
-}
\ No newline at end of file
+}
diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php b/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php
index 748ed1c2..c73d86c4 100644
--- a/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php
+++ b/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php
@@ -20,7 +20,6 @@
namespace App\Validator\Constraints\BigDecimal;
-
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Validator\Constraints\NumberConstraintTrait;
@@ -45,4 +44,4 @@ class BigDecimalPositiveOrZero extends GreaterThanOrEqual
{
return BigDecimalGreaterThenOrEqualValidator::class;
}
-}
\ No newline at end of file
+}
diff --git a/src/Validator/Constraints/Misc/ValidRangeValidator.php b/src/Validator/Constraints/Misc/ValidRangeValidator.php
index a805508f..71c42e19 100644
--- a/src/Validator/Constraints/Misc/ValidRangeValidator.php
+++ b/src/Validator/Constraints/Misc/ValidRangeValidator.php
@@ -40,7 +40,7 @@ class ValidRangeValidator extends ConstraintValidator
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof ValidRange) {
+ if (!$constraint instanceof ValidRange) {
throw new UnexpectedTypeException($constraint, ValidRange::class);
}
@@ -50,11 +50,11 @@ class ValidRangeValidator extends ConstraintValidator
return;
}
- if (! is_string($value)) {
+ if (!is_string($value)) {
throw new UnexpectedValueException($value, 'string');
}
- if (! $this->rangeParser->isValidRange($value)) {
+ if (!$this->rangeParser->isValidRange($value)) {
$this->context->buildViolation($constraint->message)
->addViolation();
}
diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php
index 58a3b62b..62539a6c 100644
--- a/src/Validator/Constraints/NoLockoutValidator.php
+++ b/src/Validator/Constraints/NoLockoutValidator.php
@@ -74,7 +74,7 @@ class NoLockoutValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof NoLockout) {
+ if (!$constraint instanceof NoLockout) {
throw new UnexpectedTypeException($constraint, NoLockout::class);
}
diff --git a/src/Validator/Constraints/NoneOfItsChildrenValidator.php b/src/Validator/Constraints/NoneOfItsChildrenValidator.php
index 2b2bb1a4..894f4723 100644
--- a/src/Validator/Constraints/NoneOfItsChildrenValidator.php
+++ b/src/Validator/Constraints/NoneOfItsChildrenValidator.php
@@ -61,7 +61,7 @@ class NoneOfItsChildrenValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof NoneOfItsChildren) {
+ if (!$constraint instanceof NoneOfItsChildren) {
throw new UnexpectedTypeException($constraint, NoneOfItsChildren::class);
}
@@ -72,7 +72,7 @@ class NoneOfItsChildrenValidator extends ConstraintValidator
}
//Check type of value. Validating only works for StructuralDBElements
- if (! $value instanceof AbstractStructuralDBElement) {
+ if (!$value instanceof AbstractStructuralDBElement) {
throw new UnexpectedValueException($value, 'StructuralDBElement');
}
diff --git a/src/Validator/Constraints/SelectableValidator.php b/src/Validator/Constraints/SelectableValidator.php
index d5a5ce11..713c9f24 100644
--- a/src/Validator/Constraints/SelectableValidator.php
+++ b/src/Validator/Constraints/SelectableValidator.php
@@ -61,7 +61,7 @@ class SelectableValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof Selectable) {
+ if (!$constraint instanceof Selectable) {
throw new UnexpectedTypeException($constraint, Selectable::class);
}
@@ -72,7 +72,7 @@ class SelectableValidator extends ConstraintValidator
}
//Check type of value. Validating only works for StructuralDBElements
- if (! $value instanceof AbstractStructuralDBElement) {
+ if (!$value instanceof AbstractStructuralDBElement) {
throw new UnexpectedValueException($value, 'StructuralDBElement');
}
diff --git a/src/Validator/Constraints/UrlOrBuiltinValidator.php b/src/Validator/Constraints/UrlOrBuiltinValidator.php
index 0a83a38a..f8ed2ce8 100644
--- a/src/Validator/Constraints/UrlOrBuiltinValidator.php
+++ b/src/Validator/Constraints/UrlOrBuiltinValidator.php
@@ -56,14 +56,14 @@ class UrlOrBuiltinValidator extends UrlValidator
{
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof UrlOrBuiltin) {
+ if (!$constraint instanceof UrlOrBuiltin) {
throw new UnexpectedTypeException($constraint, UrlOrBuiltin::class);
}
if (null === $value || '' === $value) {
return;
}
- if (! is_scalar($value) && ! (\is_object($value) && method_exists($value, '__toString'))) {
+ if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
$value = (string) $value;
@@ -74,7 +74,7 @@ class UrlOrBuiltinValidator extends UrlValidator
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placholder via explode
$tmp = explode('/', $value);
//Builtins must have a %PLACEHOLDER% construction
- if (! empty($tmp) && \in_array($tmp[0], $constraint->allowed_placeholders, false)) {
+ if (!empty($tmp) && \in_array($tmp[0], $constraint->allowed_placeholders, false)) {
return;
}
diff --git a/src/Validator/Constraints/ValidFileFilterValidator.php b/src/Validator/Constraints/ValidFileFilterValidator.php
index 3b54e597..a850111e 100644
--- a/src/Validator/Constraints/ValidFileFilterValidator.php
+++ b/src/Validator/Constraints/ValidFileFilterValidator.php
@@ -65,7 +65,7 @@ class ValidFileFilterValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof ValidFileFilter) {
+ if (!$constraint instanceof ValidFileFilter) {
throw new UnexpectedTypeException($constraint, ValidFileFilter::class);
}
@@ -73,12 +73,12 @@ class ValidFileFilterValidator extends ConstraintValidator
return;
}
- if (! \is_string($value)) {
+ if (!\is_string($value)) {
// throw this exception if your validator cannot handle the passed type so that it can be marked as invalid
throw new UnexpectedValueException($value, 'string');
}
- if (! $this->filterTools->validateFilterString($value)) {
+ if (!$this->filterTools->validateFilterString($value)) {
$this->context->buildViolation('validator.file_type_filter.invalid')
->addViolation();
}
diff --git a/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php b/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php
index e004e606..8ef75d12 100644
--- a/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php
+++ b/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php
@@ -61,7 +61,7 @@ class ValidGoogleAuthCodeValidator extends ConstraintValidator
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof ValidGoogleAuthCode) {
+ if (!$constraint instanceof ValidGoogleAuthCode) {
throw new UnexpectedTypeException($constraint, ValidGoogleAuthCode::class);
}
@@ -69,11 +69,11 @@ class ValidGoogleAuthCodeValidator extends ConstraintValidator
return;
}
- if (! \is_string($value)) {
+ if (!\is_string($value)) {
throw new UnexpectedValueException($value, 'string');
}
- if (! ctype_digit($value)) {
+ if (!ctype_digit($value)) {
$this->context->addViolation('validator.google_code.only_digits_allowed');
}
@@ -89,7 +89,7 @@ class ValidGoogleAuthCodeValidator extends ConstraintValidator
$user = $this->context->getObject()->getParent()->getData();
//Check if the given code is valid
- if (! $this->googleAuthenticator->checkCode($user, $value)) {
+ if (!$this->googleAuthenticator->checkCode($user, $value)) {
$this->context->addViolation('validator.google_code.wrong_code');
}
}
diff --git a/src/Validator/Constraints/ValidPartLotValidator.php b/src/Validator/Constraints/ValidPartLotValidator.php
index f89cf726..84a53b2d 100644
--- a/src/Validator/Constraints/ValidPartLotValidator.php
+++ b/src/Validator/Constraints/ValidPartLotValidator.php
@@ -67,11 +67,11 @@ class ValidPartLotValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof ValidPartLot) {
+ if (!$constraint instanceof ValidPartLot) {
throw new UnexpectedTypeException($constraint, ValidPartLot::class);
}
- if (! $value instanceof PartLot) {
+ if (!$value instanceof PartLot) {
throw new UnexpectedTypeException($value, PartLot::class);
}
@@ -79,7 +79,7 @@ class ValidPartLotValidator extends ConstraintValidator
if ($value->getStorageLocation()) {
$repo = $this->em->getRepository(Storelocation::class);
//We can only determine associated parts, if the part have an ID
- if ($value->getID() !== null) {
+ if (null !== $value->getID()) {
$parts = new ArrayCollection($repo->getParts($value->getStorageLocation()));
} else {
$parts = new ArrayCollection([]);
@@ -97,7 +97,7 @@ class ValidPartLotValidator extends ConstraintValidator
->atPath('amount')->addViolation();
}
- if (! $parts->contains($value->getPart())) {
+ if (!$parts->contains($value->getPart())) {
$this->context->buildViolation('validator.part_lot.location_full')
->atPath('storage_location')->addViolation();
}
@@ -105,7 +105,7 @@ class ValidPartLotValidator extends ConstraintValidator
//Check for onlyExisting
if ($value->getStorageLocation()->isLimitToExistingParts()) {
- if (! $parts->contains($value->getPart())) {
+ if (!$parts->contains($value->getPart())) {
$this->context->buildViolation('validator.part_lot.only_existing')
->atPath('storage_location')->addViolation();
}
@@ -113,7 +113,7 @@ class ValidPartLotValidator extends ConstraintValidator
//Check for only single part
if ($value->getStorageLocation()->isOnlySinglePart()) {
- if (($parts->count() > 0) && ! $parts->contains($value->getPart())) {
+ if (($parts->count() > 0) && !$parts->contains($value->getPart())) {
$this->context->buildViolation('validator.part_lot.single_part')
->atPath('storage_location')->addViolation();
}
diff --git a/src/Validator/Constraints/ValidPermissionValidator.php b/src/Validator/Constraints/ValidPermissionValidator.php
index 712e7121..77c58672 100644
--- a/src/Validator/Constraints/ValidPermissionValidator.php
+++ b/src/Validator/Constraints/ValidPermissionValidator.php
@@ -67,7 +67,7 @@ class ValidPermissionValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint): void
{
- if (! $constraint instanceof ValidPermission) {
+ if (!$constraint instanceof ValidPermission) {
throw new UnexpectedTypeException($constraint, ValidPermission::class);
}
@@ -77,7 +77,7 @@ class ValidPermissionValidator extends ConstraintValidator
//Check for each permission and operation, for an alsoSet attribute
foreach ($this->perm_structure['perms'] as $perm_key => $permission) {
foreach ($permission['operations'] as $op_key => $op) {
- if (! empty($op['alsoSet']) &&
+ if (!empty($op['alsoSet']) &&
true === $this->resolver->dontInherit($perm_holder, $perm_key, $op_key)) {
//Set every op listed in also Set
foreach ($op['alsoSet'] as $set_also) {
diff --git a/tests/Controller/AdminPages/AbstractAdminControllerTest.php b/tests/Controller/AdminPages/AbstractAdminControllerTest.php
index d462291a..c3f2b513 100644
--- a/tests/Controller/AdminPages/AbstractAdminControllerTest.php
+++ b/tests/Controller/AdminPages/AbstractAdminControllerTest.php
@@ -90,7 +90,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
$client->request('GET', static::$base_path.'/new');
$this->assertFalse($client->getResponse()->isRedirect());
$this->assertSame($read, $client->getResponse()->isSuccessful(), 'Controller was not successful!');
- $this->assertSame($read, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!');
+ $this->assertSame($read, !$client->getResponse()->isForbidden(), 'Permission Checking not working!');
}
/**
@@ -115,7 +115,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
$client->request('GET', static::$base_path.'/1');
$this->assertFalse($client->getResponse()->isRedirect());
$this->assertSame($read, $client->getResponse()->isSuccessful(), 'Controller was not successful!');
- $this->assertSame($read, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!');
+ $this->assertSame($read, !$client->getResponse()->isForbidden(), 'Permission Checking not working!');
}
public function deleteDataProvider(): array
@@ -152,6 +152,6 @@ abstract class AbstractAdminControllerTest extends WebTestCase
//Page is redirected to '/new', when delete was successful
$this->assertSame($delete, $client->getResponse()->isRedirect(static::$base_path.'/new'));
- $this->assertSame($delete, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!');
+ $this->assertSame($delete, !$client->getResponse()->isForbidden(), 'Permission Checking not working!');
}
}
diff --git a/tests/Controller/AdminPages/LabelProfileControllerTest.php b/tests/Controller/AdminPages/LabelProfileControllerTest.php
index 0441055d..2d128c2e 100644
--- a/tests/Controller/AdminPages/LabelProfileControllerTest.php
+++ b/tests/Controller/AdminPages/LabelProfileControllerTest.php
@@ -55,6 +55,6 @@ class LabelProfileControllerTest extends AbstractAdminControllerTest
//Page is redirected to '/new', when delete was successful
$this->assertSame($delete, $client->getResponse()->isRedirect(static::$base_path.'/new'));
- $this->assertSame($delete, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!');
+ $this->assertSame($delete, !$client->getResponse()->isForbidden(), 'Permission Checking not working!');
}
}
diff --git a/tests/Services/Attachments/AttachmentPathResolverTest.php b/tests/Services/Attachments/AttachmentPathResolverTest.php
index d46888ed..78387882 100644
--- a/tests/Services/Attachments/AttachmentPathResolverTest.php
+++ b/tests/Services/Attachments/AttachmentPathResolverTest.php
@@ -87,7 +87,7 @@ class AttachmentPathResolverTest extends WebTestCase
$this->assertSame(self::$projectDir_orig, self::$service->parameterToAbsolutePath(self::$projectDir));
//Relative pathes should be resolved
- $expected = str_replace('\\', '/',self::$projectDir_orig.DIRECTORY_SEPARATOR.'src');
+ $expected = str_replace('\\', '/', self::$projectDir_orig.DIRECTORY_SEPARATOR.'src');
$this->assertSame($expected, self::$service->parameterToAbsolutePath('src'));
$this->assertSame($expected, self::$service->parameterToAbsolutePath('./src'));
diff --git a/tests/Services/LabelSystem/LabelGeneratorTest.php b/tests/Services/LabelSystem/LabelGeneratorTest.php
index 2b308982..423be8bb 100644
--- a/tests/Services/LabelSystem/LabelGeneratorTest.php
+++ b/tests/Services/LabelSystem/LabelGeneratorTest.php
@@ -65,7 +65,8 @@ class LabelGeneratorTest extends WebTestCase
$this->assertTrue($this->service->supports($options, new $class()));
//Ensure that another class is not supported
- $not_supported = new class() extends AbstractDBElement {};
+ $not_supported = new class() extends AbstractDBElement {
+ };
$this->assertFalse($this->service->supports($options, $not_supported));
}