diff --git a/src/Command/CleanAttachmentsCommand.php b/src/Command/CleanAttachmentsCommand.php index 4c11ac36..e6e1403e 100644 --- a/src/Command/CleanAttachmentsCommand.php +++ b/src/Command/CleanAttachmentsCommand.php @@ -145,8 +145,6 @@ class CleanAttachmentsCommand extends Command * This function removes all empty folders inside $path. Taken from https://stackoverflow.com/a/1833681. * * @param string $path The path in which the empty folders should be deleted - * - * @return bool */ protected function removeEmptySubFolders($path): bool { diff --git a/src/Controller/AdminPages/ManufacturerController.php b/src/Controller/AdminPages/ManufacturerController.php index a008ac5e..4fbb0535 100644 --- a/src/Controller/AdminPages/ManufacturerController.php +++ b/src/Controller/AdminPages/ManufacturerController.php @@ -79,8 +79,6 @@ class ManufacturerController extends BaseAdminController /** * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="manufacturer_edit") * @Route("/{id}", requirements={"id"="\d+"}) - * - * @return Response */ public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { diff --git a/src/Controller/AdminPages/MeasurementUnitController.php b/src/Controller/AdminPages/MeasurementUnitController.php index fae7cad6..f67cad31 100644 --- a/src/Controller/AdminPages/MeasurementUnitController.php +++ b/src/Controller/AdminPages/MeasurementUnitController.php @@ -69,8 +69,6 @@ class MeasurementUnitController extends BaseAdminController /** * @Route("/{id}", name="measurement_unit_delete", methods={"DELETE"}) - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function delete(Request $request, MeasurementUnit $entity, StructuralElementRecursionHelper $recursionHelper): \Symfony\Component\HttpFoundation\RedirectResponse { @@ -80,8 +78,6 @@ class MeasurementUnitController extends BaseAdminController /** * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="measurement_unit_edit") * @Route("/{id}", requirements={"id"="\d+"}) - * - * @return Response */ public function edit(MeasurementUnit $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { diff --git a/src/Controller/AdminPages/StorelocationController.php b/src/Controller/AdminPages/StorelocationController.php index 9fe10e7e..ecdff3a5 100644 --- a/src/Controller/AdminPages/StorelocationController.php +++ b/src/Controller/AdminPages/StorelocationController.php @@ -68,8 +68,6 @@ class StorelocationController extends BaseAdminController /** * @Route("/{id}", name="store_location_delete", methods={"DELETE"}) - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { @@ -79,8 +77,6 @@ class StorelocationController extends BaseAdminController /** * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="store_location_edit") * @Route("/{id}", requirements={"id"="\d+"}) - * - * @return Response */ public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { diff --git a/src/Controller/AdminPages/SupplierController.php b/src/Controller/AdminPages/SupplierController.php index 2d623b7a..10d95659 100644 --- a/src/Controller/AdminPages/SupplierController.php +++ b/src/Controller/AdminPages/SupplierController.php @@ -69,8 +69,6 @@ class SupplierController extends BaseAdminController /** * @Route("/{id}", name="supplier_delete", methods={"DELETE"}) - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function delete(Request $request, Supplier $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { @@ -80,8 +78,6 @@ class SupplierController extends BaseAdminController /** * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="supplier_edit") * @Route("/{id}", requirements={"id"="\d+"}) - * - * @return Response */ public function edit(Supplier $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index 9f9f12bc..6d627408 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -72,8 +72,6 @@ class TypeaheadController extends AbstractController /** * @Route("/builtInResources/search", name="typeahead_builtInRessources") - * - * @return JsonResponse */ public function builtInResources(Request $request, BuiltinAttachmentsFinder $finder): JsonResponse { @@ -103,8 +101,6 @@ class TypeaheadController extends AbstractController /** * @Route("/tags/search/{query}", name="typeahead_tags", requirements={"query"= ".+"}) - * - * @return JsonResponse */ public function tags(string $query, TagFinder $finder): JsonResponse { diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 21614807..d9a0cb6a 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -97,8 +97,6 @@ class UserController extends AdminPages\BaseAdminController * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="user_edit") * @Route("/{id}/", requirements={"id"="\d+"}) * - * @return Response - * * @throws \Exception */ public function edit(User $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response @@ -168,8 +166,6 @@ class UserController extends AdminPages\BaseAdminController /** * @Route("/{id}", name="user_delete", methods={"DELETE"}, requirements={"id"="\d+"}) - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function delete(Request $request, User $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { diff --git a/src/Entity/LogSystem/SecurityEventLogEntry.php b/src/Entity/LogSystem/SecurityEventLogEntry.php index a44fe80d..181ee24d 100644 --- a/src/Entity/LogSystem/SecurityEventLogEntry.php +++ b/src/Entity/LogSystem/SecurityEventLogEntry.php @@ -93,6 +93,7 @@ class SecurityEventLogEntry extends AbstractLogEntry public function getEventType(): string { $key = $this->extra['e']; + return static::SECURITY_TYPE_MAPPING[$key] ?? 'unkown'; } diff --git a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php index 5f0e3bce..1fb8ea7d 100644 --- a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php +++ b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php @@ -333,12 +333,12 @@ class EventLoggerSubscriber implements EventSubscriber //Restrict length of string fields, to save memory... $old_data = array_map( static function ($value) { - if (is_string($value)) { - return mb_strimwidth($value, 0, self::MAX_STRING_LENGTH, '...'); - } + if (is_string($value)) { + return mb_strimwidth($value, 0, self::MAX_STRING_LENGTH, '...'); + } - return $value; - }, $old_data); + return $value; + }, $old_data); $logEntry->setOldData($old_data); } diff --git a/src/Events/SecurityEvent.php b/src/Events/SecurityEvent.php index a71e35c9..a1198a46 100644 --- a/src/Events/SecurityEvent.php +++ b/src/Events/SecurityEvent.php @@ -42,8 +42,6 @@ class SecurityEvent extends Event /** * Returns the affected user. - * - * @return User */ public function getTargetUser(): User { diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index 10366f02..8a07649a 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -178,10 +178,10 @@ class AttachmentFormType extends AbstractType if ($attachment instanceof Attachment && $file instanceof UploadedFile && $attachment->getAttachmentType( ) && !$this->submitHandler->isValidFileExtension($attachment->getAttachmentType(), $file)) { - $event->getForm()->get('file')->addError( + $event->getForm()->get('file')->addError( new FormError($this->translator->trans('validator.file_ext_not_allowed')) ); - } + } }); //Check the secure file checkbox, if file is in securefile location diff --git a/src/Form/Permissions/PermissionsMapper.php b/src/Form/Permissions/PermissionsMapper.php index f4803594..321754bb 100644 --- a/src/Form/Permissions/PermissionsMapper.php +++ b/src/Form/Permissions/PermissionsMapper.php @@ -119,7 +119,7 @@ final class PermissionsMapper implements DataMapperInterface * @param mixed $viewData The compound form's view data that get mapped * its children model data */ - public function mapFormsToData($forms, &$viewData) :void + public function mapFormsToData($forms, &$viewData): void { if ($this->inherit) { throw new RuntimeException('The permission type is readonly when it is showing read only data!'); diff --git a/src/Form/Type/MasterPictureAttachmentType.php b/src/Form/Type/MasterPictureAttachmentType.php index c36e827b..54c66f27 100644 --- a/src/Form/Type/MasterPictureAttachmentType.php +++ b/src/Form/Type/MasterPictureAttachmentType.php @@ -83,13 +83,13 @@ class MasterPictureAttachmentType extends AbstractType 'choice_loader' => static function (Options $options) { return new CallbackChoiceLoader( static function () use ($options) { - $entity = $options['entity']; - if (!$entity instanceof AttachmentContainingDBElement) { - throw new \RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)'); - } + $entity = $options['entity']; + if (!$entity instanceof AttachmentContainingDBElement) { + throw new \RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)'); + } - return $entity->getAttachments()->toArray(); - }); + return $entity->getAttachments()->toArray(); + }); }, ]); diff --git a/src/Security/EntityListeners/ElementPermissionListener.php b/src/Security/EntityListeners/ElementPermissionListener.php index 375c267c..60cd0d03 100644 --- a/src/Security/EntityListeners/ElementPermissionListener.php +++ b/src/Security/EntityListeners/ElementPermissionListener.php @@ -166,9 +166,9 @@ class ElementPermissionListener || !$this->isGranted('edit', $annotation, $element)) && isset( $old_data[$property->getName()] )) { - $property->setValue($element, $old_data[$property->getName()]); - $changed = true; - } + $property->setValue($element, $old_data[$property->getName()]); + $changed = true; + } if ($changed) { //Schedule for update, so the post update method will be called diff --git a/src/Services/CustomEnvVarProcessor.php b/src/Services/CustomEnvVarProcessor.php index 1fbc9ebb..62f32c11 100644 --- a/src/Services/CustomEnvVarProcessor.php +++ b/src/Services/CustomEnvVarProcessor.php @@ -59,6 +59,7 @@ final class CustomEnvVarProcessor implements EnvVarProcessorInterface return false; } } + return false; } diff --git a/src/Services/EntityExporter.php b/src/Services/EntityExporter.php index 168d7794..8d6d6cde 100644 --- a/src/Services/EntityExporter.php +++ b/src/Services/EntityExporter.php @@ -159,7 +159,7 @@ class EntityExporter $disposition = $response->headers->makeDisposition( ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename, - $string = preg_replace('![^'.preg_quote('-','!').'a-z0-_9\s]+!', '', strtolower($filename)) + $string = preg_replace('![^'.preg_quote('-', '!').'a-z0-_9\s]+!', '', strtolower($filename)) ); // Set the content disposition $response->headers->set('Content-Disposition', $disposition); diff --git a/src/Services/EntityImporter.php b/src/Services/EntityImporter.php index 711d3983..7f214900 100644 --- a/src/Services/EntityImporter.php +++ b/src/Services/EntityImporter.php @@ -151,7 +151,7 @@ class EntityImporter $tmp = $this->validator->validate($entity); //When no validation error occured, persist entity to database (cascade must be set in entity) - if ($tmp === null) { + if (null === $tmp) { $this->em->persist($entity); } else { //Log validation errors to global log. $errors[$entity->getFullPath()] = $tmp; diff --git a/src/Services/LabelSystem/LabelGenerator.php b/src/Services/LabelSystem/LabelGenerator.php index aa15dcec..73efb814 100644 --- a/src/Services/LabelSystem/LabelGenerator.php +++ b/src/Services/LabelSystem/LabelGenerator.php @@ -75,8 +75,6 @@ final class LabelGenerator /** * Check if the given LabelOptions can be used with $element. - * - * @return bool */ public function supports(LabelOptions $options, object $element): bool { diff --git a/src/Services/LogSystem/TimeTravel.php b/src/Services/LogSystem/TimeTravel.php index b0edd54e..25bf42c7 100644 --- a/src/Services/LogSystem/TimeTravel.php +++ b/src/Services/LogSystem/TimeTravel.php @@ -156,8 +156,8 @@ class TimeTravel $target_element, $timestamp ) && $target_elements instanceof Collection) { - $target_elements->removeElement($target_element); - } + $target_elements->removeElement($target_element); + } $this->revertEntityToTimestamp($target_element, $timestamp, $reverted_elements); } } diff --git a/src/Services/MoneyFormatter.php b/src/Services/MoneyFormatter.php index 3b472e53..b3c0e2c3 100644 --- a/src/Services/MoneyFormatter.php +++ b/src/Services/MoneyFormatter.php @@ -64,8 +64,6 @@ class MoneyFormatter * @param Currency|null $currency The currency that should be used for formatting. If null the global one is used * @param int $decimals the number of decimals that should be shown * @param bool $show_all_digits if set to true, all digits are shown, even if they are null - * - * @return string */ public function format($value, ?Currency $currency = null, $decimals = 5, bool $show_all_digits = false): string { diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index 613ef7e1..f44b0b98 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -124,7 +124,7 @@ class TreeViewGenerator } //Translate text if text starts with $$ - if (strpos($item->getText(), '$$') === 0) { + if (0 === strpos($item->getText(), '$$')) { $item->setText($this->translator->trans(substr($item->getText(), 2))); } } diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php index d2c025e6..d333295c 100644 --- a/src/Validator/Constraints/NoLockoutValidator.php +++ b/src/Validator/Constraints/NoLockoutValidator.php @@ -94,8 +94,8 @@ class NoLockoutValidator extends ConstraintValidator 'users', 'edit_permissions' ) ?? false)) { - $this->context->addViolation($constraint->message); - } + $this->context->addViolation($constraint->message); + } } } } diff --git a/src/Validator/Constraints/SelectableValidator.php b/src/Validator/Constraints/SelectableValidator.php index 85bdf585..e06141b4 100644 --- a/src/Validator/Constraints/SelectableValidator.php +++ b/src/Validator/Constraints/SelectableValidator.php @@ -56,8 +56,8 @@ class SelectableValidator extends ConstraintValidator /** * Checks if the passed value is valid. * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation + * @param mixed $value The value that should be validated + * @param Constraint $constraint The constraint for the validation */ public function validate($value, Constraint $constraint): void { diff --git a/src/Validator/Constraints/ValidPartLotValidator.php b/src/Validator/Constraints/ValidPartLotValidator.php index 03940c89..1028bccc 100644 --- a/src/Validator/Constraints/ValidPartLotValidator.php +++ b/src/Validator/Constraints/ValidPartLotValidator.php @@ -113,9 +113,9 @@ class ValidPartLotValidator extends ConstraintValidator if ($value->getStorageLocation()->isOnlySinglePart() && ($parts->count() > 0) && !$parts->contains( $value->getPart() )) { - $this->context->buildViolation('validator.part_lot.single_part') + $this->context->buildViolation('validator.part_lot.single_part') ->atPath('storage_location')->addViolation(); - } + } } } }