From f64d63f547aa3c8a220bc919621353fb83200cab Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Mon, 26 Aug 2024 14:54:36 +0200 Subject: [PATCH] Use native type declarations (#567) * Use native type declarations * Fix GeoCoordinates param order * Remove unnecessary @inheritdoc php docs --- src/Command/AssetCopyrightCommand.php | 7 +- src/Command/DataCommand.php | 38 +++----- src/Controller/AccountController.php | 89 ++++++------------- src/Controller/BaseController.php | 11 --- src/Controller/CartController.php | 42 ++------- src/Controller/CheckoutController.php | 15 ++-- src/Controller/ContentController.php | 32 ++----- src/Controller/DefaultController.php | 6 -- src/Controller/PaymentController.php | 30 ++----- src/Controller/ProductController.php | 54 +++++------ src/Controller/Web2printController.php | 14 +-- .../ProductInterestSegmentBuilder.php | 33 ++----- src/Document/Areabrick/AbstractAreabrick.php | 6 -- src/Document/Areabrick/EmailImage.php | 3 - src/Document/Areabrick/EmailNews.php | 3 - src/Document/Areabrick/EmailTeaser.php | 3 - src/Document/Areabrick/EmailWysiwyg.php | 3 - src/Document/Areabrick/GalleryCarousel.php | 3 - src/Document/Areabrick/GalleryFolder.php | 3 - .../Areabrick/GallerySingleImages.php | 3 - src/Document/Areabrick/HeroGrid.php | 3 - src/Document/Areabrick/HeroTeaser.php | 3 - src/Document/Areabrick/HorizontalLine.php | 3 - src/Document/Areabrick/IconTeaserRow.php | 3 - src/Document/Areabrick/ImageHotspotMarker.php | 3 - src/Document/Areabrick/ImageMetadata.php | 3 - src/Document/Areabrick/Pdf.php | 3 - .../Areabrick/PersonalizedProductTeaser.php | 3 - src/Document/Areabrick/PrintKeyVisual.php | 3 - src/Document/Areabrick/PrintPageBreak.php | 3 - src/Document/Areabrick/PrintProductRow.php | 3 - src/Document/Areabrick/PrintProductTable.php | 3 - src/Document/Areabrick/PrintTitlePage.php | 3 - src/Document/Areabrick/PrintToc.php | 3 - src/Document/Areabrick/PrintWysiwyg.php | 3 - src/Document/Areabrick/ProductGrid.php | 3 - src/Document/Areabrick/ProductTeaser.php | 3 - src/Document/Areabrick/StandardTeaser.php | 3 - src/Document/Areabrick/TextAccordion.php | 3 - .../Areabrick/TimeSliderFeaturette.php | 3 - src/Document/Areabrick/Wysiwyg.php | 3 - src/Document/Areabrick/WysiwygWithImages.php | 3 - .../Cart/PriceModificator/Shipping.php | 10 +-- src/Ecommerce/CheckoutManager/Confirm.php | 9 -- .../IndexService/Config/MySqlConfig.php | 10 --- src/Ecommerce/IndexService/SegmentGetter.php | 15 +--- .../AuthenticationLoginListener.php | 8 +- .../AuthenticationLogoutListener.php | 5 -- src/EventListener/CheckoutEventListener.php | 41 ++------- src/EventListener/NameSettingListener.php | 2 +- src/EventListener/PimcoreAdminListener.php | 6 +- src/Form/CarSubmitFormType.php | 5 +- src/Form/DeliveryAddressFormType.php | 23 +---- src/Form/LoginFormType.php | 15 +--- src/Form/RegistrationFormHandler.php | 9 +- src/Form/RegistrationFormType.php | 10 +-- .../Activity/LoginActivity.php | 23 ++--- .../Activity/OrderActivity.php | 27 ++---- .../PasswordRecoveryInterface.php | 34 ++----- src/Model/Product/AbstractProduct.php | 8 +- src/Model/Product/AccessoryPart.php | 11 +-- src/Model/Product/AdminStyle/Car.php | 5 +- .../CalculatedValue/AccessoryPartName.php | 6 -- .../CalculatedValue/QualityCalculator.php | 21 +---- src/Model/Product/Car.php | 20 +---- src/Model/Product/Category.php | 7 +- src/Services/NewsletterDoubleOptInService.php | 38 ++------ src/Services/PasswordRecoveryService.php | 37 ++------ src/Services/SegmentTrackingHelperService.php | 47 ++-------- .../Processors/AbsoluteURLProcessor.php | 8 +- .../Extension/CategoryFilterExtension.php | 8 +- src/Twig/Extension/Country.php | 2 +- src/Twig/Extension/Currency.php | 17 +--- src/Twig/Extension/GeneralFilterExtension.php | 34 +------ .../Extension/LanguageSwitcherExtension.php | 45 +++------- src/Twig/Extension/NavigationExtension.php | 45 ++-------- src/Twig/Extension/NewsExtension.php | 22 +---- src/Twig/Extension/PrintCatalogExtension.php | 73 +-------------- src/Twig/Extension/ProductPageExtension.php | 37 +------- src/Twig/Extension/UniqidExtension.php | 5 +- .../AbstractProductLinkGenerator.php | 39 ++------ .../LinkGenerator/NewsLinkGenerator.php | 37 ++------ .../LinkGenerator/ProductLinkGenerator.php | 14 +-- .../Navigation/BreadcrumbHelperService.php | 88 +++++------------- src/Website/Tool/PimcoreUrl.php | 11 +-- src/Website/Tool/Text.php | 19 +--- src/Workflow/SupportsStrategy.php | 7 +- 87 files changed, 256 insertions(+), 1171 deletions(-) diff --git a/src/Command/AssetCopyrightCommand.php b/src/Command/AssetCopyrightCommand.php index ee50da0d..518d2a55 100644 --- a/src/Command/AssetCopyrightCommand.php +++ b/src/Command/AssetCopyrightCommand.php @@ -22,15 +22,12 @@ class AssetCopyrightCommand extends AbstractCommand { - public function configure() + public function configure(): void { $this->setName('app:asset-copyright'); } - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { $assets = new Asset\Listing(); //$assets->setCondition('id = 219'); diff --git a/src/Command/DataCommand.php b/src/Command/DataCommand.php index 1891c84d..f2e25e19 100644 --- a/src/Command/DataCommand.php +++ b/src/Command/DataCommand.php @@ -17,7 +17,7 @@ use Pimcore\Console\AbstractCommand; use Pimcore\Model\DataObject\AccessoryPart; -use Pimcore\Model\DataObject\Data\Geopoint; +use Pimcore\Model\DataObject\Data\GeoCoordinates; use Pimcore\Model\DataObject\Data\QuantityValue; use Pimcore\Model\DataObject\Objectbrick\Data\SaleInformation; use Pimcore\Model\DataObject\QuantityValue\Unit; @@ -26,25 +26,25 @@ class DataCommand extends AbstractCommand { - protected $priceRange = [ + protected array $priceRange = [ 'from' => 57, 'to' => 900 ]; - protected $availabilityTypes = [ + protected array $availabilityTypes = [ 'couple-weeks', 'couple-days', 'instant' ]; - protected $conditionTypes = [ + protected array $conditionTypes = [ 'broken', 'reworked', 'used', 'new' //not for cars ]; - protected $locations = [ + protected array $locations = [ [47.8156617813774, 13.049333095550539], [48.197161014477935, 16.335082054138187], [48.143553854307555, 11.556630134582521], @@ -52,15 +52,12 @@ class DataCommand extends AbstractCommand [48.78339883980666, 9.180042743682863] ]; - public function configure() + public function configure(): void { $this->setName('app:data-command'); } - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { $listing = new AccessoryPart\Listing(); foreach ($listing as $object) { @@ -90,7 +87,7 @@ public function execute(InputInterface $input, OutputInterface $output) // // $geoPoint = $this->locations[rand(0,4)]; // -// $object->setLocation(new Geopoint($geoPoint[1], $geoPoint[0])); +// $object->setLocation(new GeoCoordinates($geoPoint[0], $geoPoint[1])); // // $object->setObjectType('actual-car'); // @@ -103,7 +100,7 @@ public function execute(InputInterface $input, OutputInterface $output) return 0; } - protected function updateAccessoryKey(AccessoryPart $object) + protected function updateAccessoryKey(AccessoryPart $object): void { $key = ''; @@ -117,7 +114,7 @@ protected function updateAccessoryKey(AccessoryPart $object) $object->setKey($key); } - protected function updateAccessorySalesInformation(AccessoryPart $object) + protected function updateAccessorySalesInformation(AccessoryPart $object): void { $saleInformation = $object->getSaleInformation()->getSaleInformation(); @@ -132,7 +129,7 @@ protected function updateAccessorySalesInformation(AccessoryPart $object) $saleInformation->setMilage(new QuantityValue(rand(30000, 300000), Unit::getByAbbreviation('km'))); } - protected function updateAccessoryERPInformation(AccessoryPart $part) + protected function updateAccessoryERPInformation(AccessoryPart $part): void { if (empty($part->getErpNumber())) { $part->setErpNumber(crc32($part->getId())); @@ -149,12 +146,7 @@ protected function updateAccessoryERPInformation(AccessoryPart $part) $part->setOwner($owners[rand(0, count($owners) - 1)]); } - /** - * @param int $min - * @param int $max - * @return float - */ - protected function generatePrice($min, $max) + protected function generatePrice(int $min, int $max): float { $price = rand($min, $max); @@ -164,11 +156,7 @@ protected function generatePrice($min, $max) return $price; } - /** - * @param string $condition - * @return float - */ - protected function generateCarPrice($condition) + protected function generateCarPrice(string $condition): float { $priceRangeArray = [ 'broken' => [1500, 7500], diff --git a/src/Controller/AccountController.php b/src/Controller/AccountController.php index 60f79bfa..084cee4f 100644 --- a/src/Controller/AccountController.php +++ b/src/Controller/AccountController.php @@ -49,21 +49,15 @@ class AccountController extends BaseController { use PasswordMaxLengthTrait; + /** * @Route("/account/login", name="account-login") - * - * @param AuthenticationUtils $authenticationUtils - * @param Request $request - * @param UserInterface|null $user - * - * @return Response|RedirectResponse */ public function loginAction( AuthenticationUtils $authenticationUtils, Request $request, UserInterface $user = null - ) { - + ): RedirectResponse|Response { //redirect user to index page if logged in if ($user && $this->isGranted('ROLE_USER')) { return $this->redirectToRoute('account-index'); @@ -96,24 +90,10 @@ public function loginAction( } /** - * * This could be further separated into services, but was kept as single method for demonstration purposes as the * registration process is different on every project. * * @Route("/account/register", name="account-register") - * - * @param Request $request - * @param CustomerProviderInterface $customerProvider - * @param LoginManagerInterface $loginManager - * @param RegistrationFormHandler $registrationFormHandler - * @param AuthenticationLoginListener $authenticationLoginListener - * @param Translator $translator - * @param Service $consentService - * @param UrlGeneratorInterface $urlGenerator - * @param NewsletterDoubleOptInService $newsletterDoubleOptInService - * @param UserInterface|null $user - * - * @return Response|RedirectResponse */ public function registerAction( Request $request, @@ -126,8 +106,7 @@ public function registerAction( UrlGeneratorInterface $urlGenerator, NewsletterDoubleOptInService $newsletterDoubleOptInService, UserInterface $user = null - ) { - + ): RedirectResponse|Response { //redirect user to index page if logged in if ($user && $this->isGranted('ROLE_USER')) { return $this->redirectToRoute('account-index'); @@ -206,13 +185,9 @@ public function registerAction( * Index page for account - it is restricted to ROLE_USER via security annotation * * @Route("/account/index", name="account-index") - * - * @param UserInterface|null $user - * - * @return Response */ #[IsGranted('ROLE_USER')] - public function indexAction(UserInterface $user = null) + public function indexAction(UserInterface $user = null): Response { $orderManager = Factory::getInstance()->getOrderManager(); $orderList = $orderManager->createOrderList(); @@ -228,19 +203,16 @@ public function indexAction(UserInterface $user = null) /** * @Route("/account/update-marketing", name="account-update-marketing-permission") * - * @param Request $request - * @param Service $consentService - * @param Translator $translator - * @param NewsletterDoubleOptInService $newsletterDoubleOptInService - * @param UserInterface|null $user - * - * @return RedirectResponse - * * @throws \Exception */ #[IsGranted('ROLE_USER')] - public function updateMarketingPermissionAction(Request $request, Service $consentService, Translator $translator, NewsletterDoubleOptInService $newsletterDoubleOptInService, UserInterface $user = null) - { + public function updateMarketingPermissionAction( + Request $request, + Service $consentService, + Translator $translator, + NewsletterDoubleOptInService $newsletterDoubleOptInService, + UserInterface $user = null + ): RedirectResponse { if ($user instanceof Customer) { $currentNewsletterPermission = $user->getNewsletter()->getConsent(); if (!$currentNewsletterPermission && $request->get('newsletter')) { @@ -268,15 +240,12 @@ public function updateMarketingPermissionAction(Request $request, Service $conse /** * @Route("/account/confirm-newsletter", name="account-confirm-newsletter") - * - * @param Request $request - * @param NewsletterDoubleOptInService $newsletterDoubleOptInService - * @param Translator $translator - * - * @return RedirectResponse */ - public function confirmNewsletterAction(Request $request, NewsletterDoubleOptInService $newsletterDoubleOptInService, Translator $translator) - { + public function confirmNewsletterAction( + Request $request, + NewsletterDoubleOptInService $newsletterDoubleOptInService, + Translator $translator + ): RedirectResponse { $token = $request->get('token'); $customer = $newsletterDoubleOptInService->handleDoubleOptInConfirmation($token); if ($customer) { @@ -291,16 +260,13 @@ public function confirmNewsletterAction(Request $request, NewsletterDoubleOptInS /** * @Route("/account/send-password-recovery", name="account-password-send-recovery") * - * @param Request $request - * @param PasswordRecoveryService $service - * @param Translator $translator - * - * @return Response - * * @throws \Exception */ - public function sendPasswordRecoveryMailAction(Request $request, PasswordRecoveryService $service, Translator $translator) - { + public function sendPasswordRecoveryMailAction( + Request $request, + PasswordRecoveryService $service, + Translator $translator + ): Response { if ($request->isMethod(Request::METHOD_POST)) { try { $service->sendRecoveryMail( @@ -324,15 +290,12 @@ public function sendPasswordRecoveryMailAction(Request $request, PasswordRecover /** * @Route("/account/reset-password", name="account-reset-password") - * - * @param Request $request - * @param PasswordRecoveryService $service - * @param Translator $translator - * - * @return Response|RedirectResponse */ - public function resetPasswordAction(Request $request, PasswordRecoveryService $service, Translator $translator) - { + public function resetPasswordAction( + Request $request, + PasswordRecoveryService $service, + Translator $translator + ): RedirectResponse|Response { $token = $request->get('token'); $customer = $service->getCustomerByToken($token); $error = null; diff --git a/src/Controller/BaseController.php b/src/Controller/BaseController.php index 0300976a..ac84c5e3 100644 --- a/src/Controller/BaseController.php +++ b/src/Controller/BaseController.php @@ -22,12 +22,6 @@ class BaseController extends FrontendController { - /** - * @param Request $request - * @param DataObject $object - * - * @return bool - */ protected function verifyPreviewRequest(Request $request, DataObject $object): bool { if (Tool::isElementRequestByAdmin($request, $object)) { @@ -37,11 +31,6 @@ protected function verifyPreviewRequest(Request $request, DataObject $object): b return false; } - /** - * @param Request $request - * - * @return array - */ protected function getAllParameters(Request $request): array { return array_merge($request->request->all(), $request->query->all()); diff --git a/src/Controller/CartController.php b/src/Controller/CartController.php index 992d57fb..d96342aa 100644 --- a/src/Controller/CartController.php +++ b/src/Controller/CartController.php @@ -34,20 +34,11 @@ class CartController extends FrontendController { const DEFAULT_CART_NAME = 'cart'; - /** - * @var Factory - */ - protected $factory; - - public function __construct(Factory $factory) + public function __construct(protected Factory $factory) { - $this->factory = $factory; } - /** - * @return CartInterface - */ - protected function getCart() + protected function getCart(): CartInterface { $cartManager = $this->factory->getCartManager(); @@ -89,15 +80,12 @@ public function addToCartAction(Request $request, Factory $ecommerceFactory): Re /** * @Route("/cart", name="shop-cart-detail") - * - * @param Request $request - * @param BreadcrumbHelperService $breadcrumbHelperService - * @param Factory $ecommerceFactory - * - * @return Response */ - public function cartListingAction(Request $request, BreadcrumbHelperService $breadcrumbHelperService, Factory $ecommerceFactory) - { + public function cartListingAction( + Request $request, + BreadcrumbHelperService $breadcrumbHelperService, + Factory $ecommerceFactory + ): Response { $cart = $this->getCart(); if ($request->getMethod() == Request::METHOD_POST) { @@ -163,15 +151,9 @@ public function removeFromCartAction(Request $request, Factory $ecommerceFactory /** * @Route("/cart/apply-voucher", name="shop-cart-apply-voucher") * - * @param Request $request - * @param Translator $translator - * @param Factory $ecommerceFactory - * - * @return RedirectResponse - * * @throws \Exception */ - public function applyVoucherAction(Request $request, Translator $translator, Factory $ecommerceFactory) + public function applyVoucherAction(Request $request, Translator $translator, Factory $ecommerceFactory): RedirectResponse { if ($token = strip_tags($request->get('voucher-code'))) { $cart = $this->getCart(); @@ -198,14 +180,8 @@ public function applyVoucherAction(Request $request, Translator $translator, Fac /** * @Route("/cart/remove-voucher", name="shop-cart-remove-voucher") - * - * @param Request $request - * @param Translator $translator - * @param Factory $ecommerceFactory - * - * @return RedirectResponse */ - public function removeVoucherAction(Request $request, Translator $translator, Factory $ecommerceFactory) + public function removeVoucherAction(Request $request, Translator $translator, Factory $ecommerceFactory): RedirectResponse { if ($token = strip_tags($request->get('voucher-code'))) { $cart = $this->getCart(); diff --git a/src/Controller/CheckoutController.php b/src/Controller/CheckoutController.php index 4f45350a..b775cd0b 100644 --- a/src/Controller/CheckoutController.php +++ b/src/Controller/CheckoutController.php @@ -29,16 +29,13 @@ class CheckoutController extends FrontendController { /** * @Route("/checkout-address", name="shop-checkout-address") - * - * @param Factory $factory - * @param Request $request - * @param BreadcrumbHelperService $breadcrumbHelperService - * @param Factory $ecommerceFactory - * - * @return Response|RedirectResponse */ - public function checkoutAddressAction(Factory $factory, Request $request, BreadcrumbHelperService $breadcrumbHelperService, Factory $ecommerceFactory) - { + public function checkoutAddressAction( + Factory $factory, + Request $request, + BreadcrumbHelperService $breadcrumbHelperService, + Factory $ecommerceFactory + ): RedirectResponse|Response { $cartManager = $factory->getCartManager(); $cart = $cartManager->getOrCreateCartByName('cart'); diff --git a/src/Controller/ContentController.php b/src/Controller/ContentController.php index fc0cd107..4a6820c8 100644 --- a/src/Controller/ContentController.php +++ b/src/Controller/ContentController.php @@ -31,7 +31,7 @@ class ContentController extends BaseController { #[Template('content/default.html.twig')] - public function defaultAction() + public function defaultAction(): array { return []; } @@ -41,13 +41,10 @@ public function defaultAction() * used to set custom response headers on the auto-rendered response. At this point, the headers * are not really set as we don't have a response yet, but they will be added to the final response * by the ResponseHeaderListener. - * - * - * @return Response */ #[ResponseHeader(key: "X-Custom-Header", values: ["Foo", "Bar"])] #[ResponseHeader(key: "X-Custom-Header", values: ["Bazinga"], replace: true)] - public function portalAction() + public function portalAction(): Response { // you can also set the header via code $this->addResponseHeader('X-Custom-Header3', ['foo', 'bar']); @@ -57,31 +54,20 @@ public function portalAction() ]); } - /** - * @return Response - */ - public function editableRoundupAction() + public function editableRoundupAction(): Response { return $this->render('content/editable_roundup.html.twig'); } - /** - * @return Response - */ - public function thumbnailsAction() + public function thumbnailsAction(): Response { return $this->render('content/thumbnails.html.twig'); } /** - * @param Request $request - * @param Translator $translator - * - * @return Response - * * @throws \Exception */ - public function carSubmitAction(Request $request, Translator $translator) + public function carSubmitAction(Request $request, Translator $translator): Response { $form = $this->createForm(CarSubmitFormType::class); $form->handleRequest($request); @@ -111,13 +97,7 @@ public function carSubmitAction(Request $request, Translator $translator) ]); } - /** - * @param Request $request - * @param Factory $ecommerceFactory - * - * @return Response - */ - public function tenantSwitchesAction(Request $request, Factory $ecommerceFactory) + public function tenantSwitchesAction(Request $request, Factory $ecommerceFactory): Response { $environment = $ecommerceFactory->getEnvironment(); diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index bbddfbd4..7d025c2d 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -25,18 +25,12 @@ class DefaultController extends BaseController { /** * @Route("/examples", name="examples") - * - * @return Response */ public function examplesAction(): Response { return $this->render('default/examples.html.twig'); } - /** - * - * @return array - */ #[Template('default/default.html.twig')] public function defaultAction(): array { diff --git a/src/Controller/PaymentController.php b/src/Controller/PaymentController.php index 881fa67d..abbfd432 100644 --- a/src/Controller/PaymentController.php +++ b/src/Controller/PaymentController.php @@ -33,13 +33,8 @@ class PaymentController extends FrontendController { /** * @Route("/checkout-payment", name="shop-checkout-payment") - * - * @param Factory $factory - * @param BreadcrumbHelperService $breadcrumbHelperService - * - * @return Response */ - public function checkoutPaymentAction(Factory $factory, BreadcrumbHelperService $breadcrumbHelperService) + public function checkoutPaymentAction(Factory $factory, BreadcrumbHelperService $breadcrumbHelperService): Response { $cartManager = $factory->getCartManager(); $breadcrumbHelperService->enrichCheckoutPage(); @@ -69,13 +64,8 @@ public function checkoutPaymentAction(Factory $factory, BreadcrumbHelperService /** * @Route("/checkout-start-payment", name="shop-checkout-start-payment") - * - * @param Request $request - * @param Factory $factory - * - * @return JsonResponse */ - public function startPaymentAction(Request $request, Factory $factory, LoggerInterface $logger) + public function startPaymentAction(Factory $factory): JsonResponse { $cartManager = $factory->getCartManager(); $cart = $cartManager->getOrCreateCartByName('cart'); @@ -99,11 +89,9 @@ public function startPaymentAction(Request $request, Factory $factory, LoggerInt } /** - * @Route("/payment-error", name = "shop-checkout-payment-error" ) - * - * @return RedirectResponse + * @Route("/payment-error", name = "shop-checkout-payment-error") */ - public function paymentErrorAction(Request $request, LoggerInterface $logger) + public function paymentErrorAction(): RedirectResponse { $this->addFlash('danger', 'Payment error'); @@ -112,16 +100,8 @@ public function paymentErrorAction(Request $request, LoggerInterface $logger) /** * @Route("/payment-commit-order", name="shop-commit-order") - * - * @param Request $request - * @param Factory $factory - * @param LoggerInterface $logger - * @param Translator $translator - * - * @return RedirectResponse - * */ - public function commitOrderAction(Request $request, Factory $factory, LoggerInterface $logger, Translator $translator) + public function commitOrderAction(Request $request, Factory $factory): RedirectResponse { $cartManager = $factory->getCartManager(); $cart = $cartManager->getOrCreateCartByName('cart'); diff --git a/src/Controller/ProductController.php b/src/Controller/ProductController.php index 9ac57f5b..61433a22 100644 --- a/src/Controller/ProductController.php +++ b/src/Controller/ProductController.php @@ -44,14 +44,7 @@ class ProductController extends BaseController { - /** - * @param Request $request - * @param AbstractObject $object - * @param UrlSlug $urlSlug - * - * @return Response - */ - public function productDetailSlugAction(Request $request, AbstractObject $object, UrlSlug $urlSlug) + public function productDetailSlugAction(AbstractObject $object): Response { return $this->forward('App\Controller\ProductController::detailAction', ['product' => $object]); } @@ -59,15 +52,7 @@ public function productDetailSlugAction(Request $request, AbstractObject $object /** * @Route("/shop/{path}{productname}~p{product}", name="shop-detail", defaults={"path"=""}, requirements={"path"=".*?", "productname"="[\w-]+", "product"="\d+"}) * - * @param Request $request - * @param HeadTitle $headTitleHelper - * @param BreadcrumbHelperService $breadcrumbHelperService - * @param Factory $ecommerceFactory - * @param SegmentTrackingHelperService $segmentTrackingHelperService * @param Concrete $product built-in parameter conversion, please see https://github.com/pimcore/pimcore/pull/5554 - * @param ProductLinkGenerator $productLinkGenerator - * - * @return Response * * @throws \Exception */ @@ -79,7 +64,7 @@ public function detailAction( SegmentTrackingHelperService $segmentTrackingHelperService, Concrete $product, ProductLinkGenerator $productLinkGenerator - ) { + ): Response { if (!( $product && ($product->isPublished() && (($product instanceof Car && $product->getObjectType() == Car::OBJECT_TYPE_ACTUAL_CAR) || $product instanceof AccessoryPart) || $this->verifyPreviewRequest($request, $product)) ) @@ -132,22 +117,22 @@ public function detailAction( return $this->render('product/detail_accessory.html.twig', $paramBag); } + + throw new NotFoundHttpException('Unsupported Product type.'); } /** * @Route("/shop/{path}{categoryname}~c{category}", name="shop-category", defaults={"path"=""}, requirements={"path"=".*?", "categoryname"="[\w-]+", "category"="\d+"}) - * - * @param Request $request - * @param HeadTitle $headTitleHelper - * @param BreadcrumbHelperService $breadcrumbHelperService - * @param Factory $ecommerceFactory - * @param SegmentTrackingHelperService $segmentTrackingHelperService - * @param ListHelper $listHelper - * - * @return Response */ - public function listingAction(Request $request, HeadTitle $headTitleHelper, BreadcrumbHelperService $breadcrumbHelperService, Factory $ecommerceFactory, SegmentTrackingHelperService $segmentTrackingHelperService, ListHelper $listHelper, PaginatorInterface $paginator) - { + public function listingAction( + Request $request, + HeadTitle $headTitleHelper, + BreadcrumbHelperService $breadcrumbHelperService, + Factory $ecommerceFactory, + SegmentTrackingHelperService $segmentTrackingHelperService, + ListHelper $listHelper, + PaginatorInterface $paginator + ): Response { $params = array_merge($request->query->all(), $request->attributes->all()); //needed to make sure category filter filters for active category @@ -239,8 +224,17 @@ public function productTeaserAction(Request $request, Factory $ecommerceFactory) /** * @Route("/search", name="search", methods={"GET"}) */ - public function searchAction(Request $request, ListHelper $listHelper, Factory $ecommerceFactory, ProductLinkGenerator $productLinkGenerator, Translator $translator, BreadcrumbHelperService $breadcrumbHelperService, HeadTitle $headTitleHelper, Placeholder $placeholder, PaginatorInterface $paginator): Response - { + public function searchAction( + Request $request, + ListHelper $listHelper, + Factory $ecommerceFactory, + ProductLinkGenerator $productLinkGenerator, + Translator $translator, + BreadcrumbHelperService $breadcrumbHelperService, + HeadTitle $headTitleHelper, + Placeholder $placeholder, + PaginatorInterface $paginator + ): Response { $params = $request->query->all(); $params['category'] = Category::getById((int) ($params['category'] ?? -1)); diff --git a/src/Controller/Web2printController.php b/src/Controller/Web2printController.php index 6b90a380..1368ebcc 100644 --- a/src/Controller/Web2printController.php +++ b/src/Controller/Web2printController.php @@ -26,12 +26,7 @@ class Web2printController extends BaseController { - /** - * @param Request $request - * - * @return Response - */ - public function defaultAction(Request $request) + public function defaultAction(Request $request): Response { $paramsBag = [ 'document' => $this->document @@ -51,14 +46,9 @@ public function defaultAction(Request $request) } /** - * - * @param Request $request - * - * @return Response - * * @throws \Exception */ - public function containerAction(Request $request) + public function containerAction(Request $request): Response { $paramsBag = [ 'document' => $this->document diff --git a/src/CustomerManagementFramework/SegmentBuilder/ProductInterestSegmentBuilder.php b/src/CustomerManagementFramework/SegmentBuilder/ProductInterestSegmentBuilder.php index dbca826b..8bf2b0ee 100644 --- a/src/CustomerManagementFramework/SegmentBuilder/ProductInterestSegmentBuilder.php +++ b/src/CustomerManagementFramework/SegmentBuilder/ProductInterestSegmentBuilder.php @@ -30,42 +30,25 @@ */ class ProductInterestSegmentBuilder extends AbstractSegmentBuilder { - /** - * @var SegmentGetter - */ - protected $segmentGetter; - /** * ProductInterestSegmentBuilder constructor. - * - * @param SegmentGetter $segmentGetter */ - public function __construct(SegmentGetter $segmentGetter) + public function __construct(protected SegmentGetter $segmentGetter) { - $this->segmentGetter = $segmentGetter; } /** * prepares data and configurations which could be reused for all buildSegment(CustomerInterface $customer) calls - * - * @param SegmentManagerInterface $segmentManager - * - * @return void */ - public function prepare(SegmentManagerInterface $segmentManager) + public function prepare(SegmentManagerInterface $segmentManager): void { // nothing to do } /** * update calculated segment(s) for given customer - * - * @param CustomerInterface $customer - * @param SegmentManagerInterface $segmentManager - * - * @return void */ - public function calculateSegments(CustomerInterface $customer, SegmentManagerInterface $segmentManager) + public function calculateSegments(CustomerInterface $customer, SegmentManagerInterface $segmentManager): void { if (!$customer->getProfilingConsent()->getConsent()) { return; @@ -101,18 +84,12 @@ public function calculateSegments(CustomerInterface $customer, SegmentManagerInt }); } - /** - * @return string - */ - public function getName() + public function getName(): string { return 'ProductCategorySegmentBuilder'; } - /** - * @return bool - */ - public function executeOnCustomerSave() + public function executeOnCustomerSave(): bool { //only for demo purposes on true, should be false in production environment return true; diff --git a/src/Document/Areabrick/AbstractAreabrick.php b/src/Document/Areabrick/AbstractAreabrick.php index e65be57a..e00ed1c8 100644 --- a/src/Document/Areabrick/AbstractAreabrick.php +++ b/src/Document/Areabrick/AbstractAreabrick.php @@ -19,17 +19,11 @@ abstract class AbstractAreabrick extends AbstractTemplateAreabrick { - /** - * @inheritDoc - */ public function getTemplateLocation(): string { return static::TEMPLATE_LOCATION_GLOBAL; } - /** - * @inheritDoc - */ public function getTemplateSuffix(): string { return static::TEMPLATE_SUFFIX_TWIG; diff --git a/src/Document/Areabrick/EmailImage.php b/src/Document/Areabrick/EmailImage.php index 9e85372e..a23cd65f 100644 --- a/src/Document/Areabrick/EmailImage.php +++ b/src/Document/Areabrick/EmailImage.php @@ -17,9 +17,6 @@ class EmailImage extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'E-Mail Image'; diff --git a/src/Document/Areabrick/EmailNews.php b/src/Document/Areabrick/EmailNews.php index 91653c7d..8bb5dfea 100644 --- a/src/Document/Areabrick/EmailNews.php +++ b/src/Document/Areabrick/EmailNews.php @@ -17,9 +17,6 @@ class EmailNews extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'E-Mail News'; diff --git a/src/Document/Areabrick/EmailTeaser.php b/src/Document/Areabrick/EmailTeaser.php index ff68f078..6e1177fa 100644 --- a/src/Document/Areabrick/EmailTeaser.php +++ b/src/Document/Areabrick/EmailTeaser.php @@ -17,9 +17,6 @@ class EmailTeaser extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'E-Mail Teaser'; diff --git a/src/Document/Areabrick/EmailWysiwyg.php b/src/Document/Areabrick/EmailWysiwyg.php index 46ceabb9..c18544ac 100644 --- a/src/Document/Areabrick/EmailWysiwyg.php +++ b/src/Document/Areabrick/EmailWysiwyg.php @@ -17,9 +17,6 @@ class EmailWysiwyg extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'E-Mail WYSIWYG'; diff --git a/src/Document/Areabrick/GalleryCarousel.php b/src/Document/Areabrick/GalleryCarousel.php index 068799f6..e806435b 100644 --- a/src/Document/Areabrick/GalleryCarousel.php +++ b/src/Document/Areabrick/GalleryCarousel.php @@ -17,9 +17,6 @@ class GalleryCarousel extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Gallery (Carousel)'; diff --git a/src/Document/Areabrick/GalleryFolder.php b/src/Document/Areabrick/GalleryFolder.php index 4a8b350e..5940bbc0 100644 --- a/src/Document/Areabrick/GalleryFolder.php +++ b/src/Document/Areabrick/GalleryFolder.php @@ -17,9 +17,6 @@ class GalleryFolder extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Gallery (Folder)'; diff --git a/src/Document/Areabrick/GallerySingleImages.php b/src/Document/Areabrick/GallerySingleImages.php index 66e55a2f..bc7dd5d3 100644 --- a/src/Document/Areabrick/GallerySingleImages.php +++ b/src/Document/Areabrick/GallerySingleImages.php @@ -17,9 +17,6 @@ class GallerySingleImages extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Gallery (Single)'; diff --git a/src/Document/Areabrick/HeroGrid.php b/src/Document/Areabrick/HeroGrid.php index 8a780f58..a73336f6 100644 --- a/src/Document/Areabrick/HeroGrid.php +++ b/src/Document/Areabrick/HeroGrid.php @@ -17,9 +17,6 @@ class HeroGrid extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Hero Grid'; diff --git a/src/Document/Areabrick/HeroTeaser.php b/src/Document/Areabrick/HeroTeaser.php index 98dc04ae..454273a8 100644 --- a/src/Document/Areabrick/HeroTeaser.php +++ b/src/Document/Areabrick/HeroTeaser.php @@ -17,9 +17,6 @@ class HeroTeaser extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Hero Teaser'; diff --git a/src/Document/Areabrick/HorizontalLine.php b/src/Document/Areabrick/HorizontalLine.php index e0fe7927..5ae91213 100644 --- a/src/Document/Areabrick/HorizontalLine.php +++ b/src/Document/Areabrick/HorizontalLine.php @@ -17,9 +17,6 @@ class HorizontalLine extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Horiz. Line'; diff --git a/src/Document/Areabrick/IconTeaserRow.php b/src/Document/Areabrick/IconTeaserRow.php index a44e9fc2..411c63d8 100644 --- a/src/Document/Areabrick/IconTeaserRow.php +++ b/src/Document/Areabrick/IconTeaserRow.php @@ -17,9 +17,6 @@ class IconTeaserRow extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Icon Teaser'; diff --git a/src/Document/Areabrick/ImageHotspotMarker.php b/src/Document/Areabrick/ImageHotspotMarker.php index bccc9e21..b66b8149 100644 --- a/src/Document/Areabrick/ImageHotspotMarker.php +++ b/src/Document/Areabrick/ImageHotspotMarker.php @@ -17,9 +17,6 @@ class ImageHotspotMarker extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Image Hotspot & Marker'; diff --git a/src/Document/Areabrick/ImageMetadata.php b/src/Document/Areabrick/ImageMetadata.php index 4d4ab650..e0f9da3d 100644 --- a/src/Document/Areabrick/ImageMetadata.php +++ b/src/Document/Areabrick/ImageMetadata.php @@ -21,9 +21,6 @@ class ImageMetadata extends AbstractAreabrick implements EditableDialogBoxInterface { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Image w. Metadata'; diff --git a/src/Document/Areabrick/Pdf.php b/src/Document/Areabrick/Pdf.php index f5d32893..9035ae71 100644 --- a/src/Document/Areabrick/Pdf.php +++ b/src/Document/Areabrick/Pdf.php @@ -17,9 +17,6 @@ class Pdf extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'PDF'; diff --git a/src/Document/Areabrick/PersonalizedProductTeaser.php b/src/Document/Areabrick/PersonalizedProductTeaser.php index f43b8906..8edb2175 100644 --- a/src/Document/Areabrick/PersonalizedProductTeaser.php +++ b/src/Document/Areabrick/PersonalizedProductTeaser.php @@ -65,9 +65,6 @@ public function __construct(VisitorInfoStorage $visitorInfoStorage, SegmentTrack $this->ecommerceFactory = $ecommerceFactory; } - /** - * {@inheritdoc} - */ public function getName(): string { return 'Personalized Product Teaser'; diff --git a/src/Document/Areabrick/PrintKeyVisual.php b/src/Document/Areabrick/PrintKeyVisual.php index 43296ba4..e45b9f5b 100644 --- a/src/Document/Areabrick/PrintKeyVisual.php +++ b/src/Document/Areabrick/PrintKeyVisual.php @@ -17,9 +17,6 @@ class PrintKeyVisual extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Print KeyVisual'; diff --git a/src/Document/Areabrick/PrintPageBreak.php b/src/Document/Areabrick/PrintPageBreak.php index c660fa21..89af0f77 100644 --- a/src/Document/Areabrick/PrintPageBreak.php +++ b/src/Document/Areabrick/PrintPageBreak.php @@ -17,9 +17,6 @@ class PrintPageBreak extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Print PageBreak'; diff --git a/src/Document/Areabrick/PrintProductRow.php b/src/Document/Areabrick/PrintProductRow.php index 2db5c823..7d17f297 100644 --- a/src/Document/Areabrick/PrintProductRow.php +++ b/src/Document/Areabrick/PrintProductRow.php @@ -17,9 +17,6 @@ class PrintProductRow extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Print Product Row'; diff --git a/src/Document/Areabrick/PrintProductTable.php b/src/Document/Areabrick/PrintProductTable.php index 128252fe..d82da7a1 100644 --- a/src/Document/Areabrick/PrintProductTable.php +++ b/src/Document/Areabrick/PrintProductTable.php @@ -17,9 +17,6 @@ class PrintProductTable extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Print Product Table'; diff --git a/src/Document/Areabrick/PrintTitlePage.php b/src/Document/Areabrick/PrintTitlePage.php index 24c8c8f6..7697178e 100644 --- a/src/Document/Areabrick/PrintTitlePage.php +++ b/src/Document/Areabrick/PrintTitlePage.php @@ -17,9 +17,6 @@ class PrintTitlePage extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Print Title Page'; diff --git a/src/Document/Areabrick/PrintToc.php b/src/Document/Areabrick/PrintToc.php index b1f24150..73efea27 100644 --- a/src/Document/Areabrick/PrintToc.php +++ b/src/Document/Areabrick/PrintToc.php @@ -17,9 +17,6 @@ class PrintToc extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Print Table Of Contents'; diff --git a/src/Document/Areabrick/PrintWysiwyg.php b/src/Document/Areabrick/PrintWysiwyg.php index 9b374de0..5c1bd11c 100644 --- a/src/Document/Areabrick/PrintWysiwyg.php +++ b/src/Document/Areabrick/PrintWysiwyg.php @@ -17,9 +17,6 @@ class PrintWysiwyg extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Print WYSIWYG'; diff --git a/src/Document/Areabrick/ProductGrid.php b/src/Document/Areabrick/ProductGrid.php index 377b7fb6..4135d86a 100644 --- a/src/Document/Areabrick/ProductGrid.php +++ b/src/Document/Areabrick/ProductGrid.php @@ -21,9 +21,6 @@ class ProductGrid extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Product Grid'; diff --git a/src/Document/Areabrick/ProductTeaser.php b/src/Document/Areabrick/ProductTeaser.php index 8765e35d..c297fe8b 100644 --- a/src/Document/Areabrick/ProductTeaser.php +++ b/src/Document/Areabrick/ProductTeaser.php @@ -17,9 +17,6 @@ class ProductTeaser extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Product Teaser'; diff --git a/src/Document/Areabrick/StandardTeaser.php b/src/Document/Areabrick/StandardTeaser.php index f6883d68..f81d0343 100644 --- a/src/Document/Areabrick/StandardTeaser.php +++ b/src/Document/Areabrick/StandardTeaser.php @@ -17,9 +17,6 @@ class StandardTeaser extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Standard Teaser'; diff --git a/src/Document/Areabrick/TextAccordion.php b/src/Document/Areabrick/TextAccordion.php index 190a238a..e71ec954 100644 --- a/src/Document/Areabrick/TextAccordion.php +++ b/src/Document/Areabrick/TextAccordion.php @@ -17,9 +17,6 @@ class TextAccordion extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Text Accordion'; diff --git a/src/Document/Areabrick/TimeSliderFeaturette.php b/src/Document/Areabrick/TimeSliderFeaturette.php index e26f2e95..ebd49513 100644 --- a/src/Document/Areabrick/TimeSliderFeaturette.php +++ b/src/Document/Areabrick/TimeSliderFeaturette.php @@ -17,9 +17,6 @@ class TimeSliderFeaturette extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'Time Slider Featurette'; diff --git a/src/Document/Areabrick/Wysiwyg.php b/src/Document/Areabrick/Wysiwyg.php index 12ef976e..66c0c361 100644 --- a/src/Document/Areabrick/Wysiwyg.php +++ b/src/Document/Areabrick/Wysiwyg.php @@ -17,9 +17,6 @@ class Wysiwyg extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'WYSIWYG'; diff --git a/src/Document/Areabrick/WysiwygWithImages.php b/src/Document/Areabrick/WysiwygWithImages.php index 56fd2a68..24dbd7e7 100644 --- a/src/Document/Areabrick/WysiwygWithImages.php +++ b/src/Document/Areabrick/WysiwygWithImages.php @@ -17,9 +17,6 @@ class WysiwygWithImages extends AbstractAreabrick { - /** - * {@inheritdoc} - */ public function getName(): string { return 'WYSIWYG w. Images'; diff --git a/src/Ecommerce/Cart/PriceModificator/Shipping.php b/src/Ecommerce/Cart/PriceModificator/Shipping.php index 7ff78a6b..6dc4f0cd 100644 --- a/src/Ecommerce/Cart/PriceModificator/Shipping.php +++ b/src/Ecommerce/Cart/PriceModificator/Shipping.php @@ -28,15 +28,9 @@ class Shipping extends CartPriceModificator\Shipping { - /** - * @var Decimal - */ - protected $baseCharge; + protected Decimal $baseCharge; - /** - * @var Decimal - */ - protected $carCharge; + protected Decimal $carCharge; protected function processOptions(array $options): void { diff --git a/src/Ecommerce/CheckoutManager/Confirm.php b/src/Ecommerce/CheckoutManager/Confirm.php index 381b96cf..378f1c9e 100644 --- a/src/Ecommerce/CheckoutManager/Confirm.php +++ b/src/Ecommerce/CheckoutManager/Confirm.php @@ -25,17 +25,11 @@ class Confirm extends AbstractStep implements CheckoutStepInterface */ const PRIVATE_NAMESPACE = 'confirm'; - /** - * @inheritdoc - */ public function getName(): string { return 'confirm'; } - /** - * @inheritdoc - */ public function commit($data): bool { $this->cart->setCheckoutData(self::PRIVATE_NAMESPACE, json_encode($data)); @@ -43,9 +37,6 @@ public function commit($data): bool return true; } - /** - * @inheritdoc - */ public function getData(): mixed { $data = json_decode((string) $this->cart->getCheckoutData(self::PRIVATE_NAMESPACE)); diff --git a/src/Ecommerce/IndexService/Config/MySqlConfig.php b/src/Ecommerce/IndexService/Config/MySqlConfig.php index 1a3e8aaf..fc9205b2 100644 --- a/src/Ecommerce/IndexService/Config/MySqlConfig.php +++ b/src/Ecommerce/IndexService/Config/MySqlConfig.php @@ -22,26 +22,16 @@ class MySqlConfig extends DefaultMysql { - /** - * @return string - */ public function getTablename(): string { return 'shop_productindex'; } - /** - * @return string - */ public function getRelationTablename(): string { return 'shop_productindex_relations'; } - /** - * @param IndexableInterface $object - * @return bool - */ public function inIndex(IndexableInterface $object): bool { return $object instanceof Car || $object instanceof AccessoryPart; diff --git a/src/Ecommerce/IndexService/SegmentGetter.php b/src/Ecommerce/IndexService/SegmentGetter.php index 64c1487d..33f1f278 100644 --- a/src/Ecommerce/IndexService/SegmentGetter.php +++ b/src/Ecommerce/IndexService/SegmentGetter.php @@ -26,25 +26,14 @@ class SegmentGetter implements GetterInterface const SEGMENT_GROUP_CAR_CLASS = 'Interest Car Class'; const SEGMENT_GROUP_BODY_STYLE = 'Interest Body Style'; - /** - * @var SegmentManagerInterface - */ - protected $segmentManager; - /** * SegmentGetter constructor. - * - * @param SegmentManagerInterface $segmentManager */ - public function __construct(SegmentManagerInterface $segmentManager) + public function __construct(protected SegmentManagerInterface $segmentManager) { - $this->segmentManager = $segmentManager; } - /** - * {@inheritdoc} - */ - public function get($object, ?array $config = null): mixed + public function get($object, ?array $config = null): array { $segments = []; diff --git a/src/EventListener/AuthenticationLoginListener.php b/src/EventListener/AuthenticationLoginListener.php index 1ed16f40..598681a5 100644 --- a/src/EventListener/AuthenticationLoginListener.php +++ b/src/EventListener/AuthenticationLoginListener.php @@ -54,10 +54,6 @@ public function __construct( * This is called when an interactive authentication attempt succeeds. This * is called by authentication listeners inheriting from * AbstractAuthenticationListener. - * - * @param LoginSuccessEvent $event - * - * @return void */ public function onLoginSuccess(LoginSuccessEvent $event): void { @@ -75,7 +71,7 @@ public function onLoginSuccess(LoginSuccessEvent $event): void $this->doEcommerceFrameworkLogin($user); } - public function doEcommerceFrameworkLogin(CustomerInterface $customer) + public function doEcommerceFrameworkLogin(CustomerInterface $customer): void { if ($customer) { @@ -95,7 +91,7 @@ public function doEcommerceFrameworkLogin(CustomerInterface $customer) $userCart->save(); } } else { - $this->environment->setCurrentUserId(null); + $this->environment->setCurrentUserId(-1); } // track login activity diff --git a/src/EventListener/AuthenticationLogoutListener.php b/src/EventListener/AuthenticationLogoutListener.php index b8936cb9..31f32e0f 100644 --- a/src/EventListener/AuthenticationLogoutListener.php +++ b/src/EventListener/AuthenticationLogoutListener.php @@ -40,11 +40,6 @@ public function __construct( ) { } - /** - * @param Request $request - * - * @return RedirectResponse|Response - */ public function onLogoutSuccess(Request $request): RedirectResponse|Response { // unset user in environment diff --git a/src/EventListener/CheckoutEventListener.php b/src/EventListener/CheckoutEventListener.php index 98e8d6e3..8cc4d72f 100644 --- a/src/EventListener/CheckoutEventListener.php +++ b/src/EventListener/CheckoutEventListener.php @@ -28,40 +28,20 @@ class CheckoutEventListener { - /** - * @var Factory - */ - protected $ecommerceFactory; - - /** - * @var ActivityManagerInterface - */ - protected $activityManager; - - /** - * @var LocaleServiceInterface - */ - protected $localeService; - /** * CheckoutEventListener constructor. - * - * @param Factory $ecommerceFactory - * @param ActivityManagerInterface $activityManager */ - public function __construct(Factory $ecommerceFactory, ActivityManagerInterface $activityManager, LocaleServiceInterface $localeService) - { - $this->ecommerceFactory = $ecommerceFactory; - $this->activityManager = $activityManager; - $this->localeService = $localeService; + public function __construct( + protected Factory $ecommerceFactory, + protected ActivityManagerInterface $activityManager, + protected LocaleServiceInterface $localeService + ) { } /** - * @param OrderManagerEvent $event - * * @throws \Exception */ - public function onUpdateOrder(OrderManagerEvent $event) + public function onUpdateOrder(OrderManagerEvent $event): void { $cart = $event->getCart(); @@ -106,10 +86,7 @@ public function onUpdateOrder(OrderManagerEvent $event) } } - /** - * @param SendConfirmationMailEvent $event - */ - public function sendConfirmationMail(SendConfirmationMailEvent $event) + public function sendConfirmationMail(SendConfirmationMailEvent $event): void { $order = $event->getOrder(); @@ -127,11 +104,9 @@ public function sendConfirmationMail(SendConfirmationMailEvent $event) } /** - * @param CommitOrderProcessorEvent $event - * * @throws \Pimcore\Bundle\EcommerceFrameworkBundle\Exception\UnsupportedException */ - public function postCommitOrder(CommitOrderProcessorEvent $event) + public function postCommitOrder(CommitOrderProcessorEvent $event): void { $order = $event->getOrder(); if ($this->activityManager && $order->getCustomer()) { diff --git a/src/EventListener/NameSettingListener.php b/src/EventListener/NameSettingListener.php index eced4802..e8b40615 100644 --- a/src/EventListener/NameSettingListener.php +++ b/src/EventListener/NameSettingListener.php @@ -22,7 +22,7 @@ class NameSettingListener { - public function onPreAdd(DataObjectEvent $event) + public function onPreAdd(DataObjectEvent $event): void { $object = $event->getObject(); diff --git a/src/EventListener/PimcoreAdminListener.php b/src/EventListener/PimcoreAdminListener.php index c92b6d0d..47495dfc 100644 --- a/src/EventListener/PimcoreAdminListener.php +++ b/src/EventListener/PimcoreAdminListener.php @@ -20,7 +20,7 @@ class PimcoreAdminListener { - public function addCSSFiles(PathsEvent $event) + public function addCSSFiles(PathsEvent $event): void { $event->setPaths( array_merge( @@ -32,7 +32,7 @@ public function addCSSFiles(PathsEvent $event) ); } - public function addJSFiles(PathsEvent $event) + public function addJSFiles(PathsEvent $event): void { $event->setPaths( array_merge( @@ -44,7 +44,7 @@ public function addJSFiles(PathsEvent $event) ); } - public function onResolveElementAdminStyle(ElementAdminStyleEvent $event) + public function onResolveElementAdminStyle(ElementAdminStyleEvent $event): void { $element = $event->getElement(); // decide which default styles you want to override diff --git a/src/Form/CarSubmitFormType.php b/src/Form/CarSubmitFormType.php index 97192556..59ab3510 100644 --- a/src/Form/CarSubmitFormType.php +++ b/src/Form/CarSubmitFormType.php @@ -40,10 +40,7 @@ class CarSubmitFormType extends AbstractType { - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $manufacturers = new Manufacturer\Listing(); $manufacturerChoices = []; diff --git a/src/Form/DeliveryAddressFormType.php b/src/Form/DeliveryAddressFormType.php index dd6dc2bf..2634fe2f 100644 --- a/src/Form/DeliveryAddressFormType.php +++ b/src/Form/DeliveryAddressFormType.php @@ -27,20 +27,11 @@ class DeliveryAddressFormType extends AbstractType { - /** - * @var LocaleService - */ - protected $locale; - - public function __construct(LocaleService $locale) + public function __construct(protected LocaleService $locale) { - $this->locale = $locale; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $regionArray = $this->locale->getDisplayRegions(); @@ -85,10 +76,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - /** - * @inheritDoc - */ - public function getBlockPrefix() + public function getBlockPrefix(): string { // we need to set this to an empty string as we want _username as input name // instead of login_form[_username] to work with the form authenticator out @@ -96,10 +84,7 @@ public function getBlockPrefix() return ''; } - /** - * @inheritDoc - */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { } } diff --git a/src/Form/LoginFormType.php b/src/Form/LoginFormType.php index cc80a924..2427effa 100644 --- a/src/Form/LoginFormType.php +++ b/src/Form/LoginFormType.php @@ -40,10 +40,7 @@ class LoginFormType extends AbstractType { - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('_username', EmailType::class, [ @@ -67,10 +64,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - /** - * @inheritDoc - */ - public function getBlockPrefix() + public function getBlockPrefix(): string { // we need to set this to an empty string as we want _username as input name // instead of login_form[_username] to work with the form authenticator out @@ -78,10 +72,7 @@ public function getBlockPrefix() return ''; } - /** - * @inheritDoc - */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { } } diff --git a/src/Form/RegistrationFormHandler.php b/src/Form/RegistrationFormHandler.php index 49802c78..5a6f3fc2 100644 --- a/src/Form/RegistrationFormHandler.php +++ b/src/Form/RegistrationFormHandler.php @@ -39,10 +39,6 @@ protected function getCustomerMapping(): array /** * Builds initial form data - * - * @param CustomerInterface $customer - * - * @return array */ public function buildFormData(CustomerInterface $customer): array { @@ -63,11 +59,8 @@ public function buildFormData(CustomerInterface $customer): array /** * Maps form values to customer - * - * @param CustomerInterface $customer - * @param Form $form */ - public function updateCustomerFromForm(CustomerInterface $customer, Form $form) + public function updateCustomerFromForm(CustomerInterface $customer, Form $form): void { if (!$form->isSubmitted() || !$form->isValid()) { throw new \RuntimeException('Form must be submitted and valid to apply form data'); diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php index 41958972..f9587827 100644 --- a/src/Form/RegistrationFormType.php +++ b/src/Form/RegistrationFormType.php @@ -42,10 +42,7 @@ class RegistrationFormType extends AbstractType { - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('email', EmailType::class, [ @@ -104,10 +101,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - /** - * @inheritDoc - */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefined('hidePassword'); } diff --git a/src/Model/CustomerManagementFramework/Activity/LoginActivity.php b/src/Model/CustomerManagementFramework/Activity/LoginActivity.php index e9c9ee3c..915c740c 100644 --- a/src/Model/CustomerManagementFramework/Activity/LoginActivity.php +++ b/src/Model/CustomerManagementFramework/Activity/LoginActivity.php @@ -27,18 +27,12 @@ class LoginActivity extends AbstractActivity */ protected $customer; - /** - * @var int - */ - protected $activityDate; + protected int $activityDate; /** * LoginActivity constructor. - * - * @param CustomerInterface $customer - * @param int $activityDate */ - public function __construct(CustomerInterface $customer, $activityDate = null) + public function __construct(CustomerInterface $customer, int $activityDate = null) { if (is_null($activityDate)) { $activityDate = time(); @@ -50,28 +44,21 @@ public function __construct(CustomerInterface $customer, $activityDate = null) /** * Return the type of the activity (i.e. Booking, Login...) - * - * @return string */ - public function cmfGetType() + public function cmfGetType(): string { return self::TYPE; } /** * Returns an array representation of this activity. - * - * @return array */ - public function cmfToArray() + public function cmfToArray(): array { return ['customer' => $this->getCustomer()->getId(), 'date' => $this->activityDate]; } - /** - * @return bool - */ - public function cmfWebserviceUpdateAllowed() + public function cmfWebserviceUpdateAllowed(): bool { return false; } diff --git a/src/Model/CustomerManagementFramework/Activity/OrderActivity.php b/src/Model/CustomerManagementFramework/Activity/OrderActivity.php index 784d27e7..d4eb933a 100644 --- a/src/Model/CustomerManagementFramework/Activity/OrderActivity.php +++ b/src/Model/CustomerManagementFramework/Activity/OrderActivity.php @@ -29,16 +29,10 @@ class OrderActivity extends AbstractActivity */ protected $customer; - /** - * @var AbstractOrder - */ - protected $order; + protected AbstractOrder $order; /** - * LoginActivity constructor. - * - * @param CustomerInterface $customer - * @param int $activityDate + * OrderActivity constructor. */ public function __construct(CustomerInterface $customer, AbstractOrder $order) { @@ -48,20 +42,16 @@ public function __construct(CustomerInterface $customer, AbstractOrder $order) /** * Return the type of the activity (i.e. Booking, Login...) - * - * @return string */ - public function cmfGetType() + public function cmfGetType(): string { return self::TYPE; } /** * Returns an array representation of this activity. - * - * @return array */ - public function cmfToArray() + public function cmfToArray(): array { return [ 'customerId' => $this->getCustomer()->getId(), @@ -71,15 +61,12 @@ public function cmfToArray() ]; } - /** - * @return bool - */ - public function cmfWebserviceUpdateAllowed() + public function cmfWebserviceUpdateAllowed(): bool { return false; } - public static function cmfGetOverviewData(ActivityStoreEntryInterface $entry) + public static function cmfGetOverviewData(ActivityStoreEntryInterface $entry): array { $attributes = $entry->getAttributes(); @@ -101,7 +88,7 @@ public static function cmfGetOverviewData(ActivityStoreEntryInterface $entry) return $data; } - public static function cmfGetDetailviewData(ActivityStoreEntryInterface $entry) + public static function cmfGetDetailviewData(ActivityStoreEntryInterface $entry): array { $attributes = $entry->getAttributes(); diff --git a/src/Model/CustomerManagementFramework/PasswordRecoveryInterface.php b/src/Model/CustomerManagementFramework/PasswordRecoveryInterface.php index 6cf195d9..5e63e184 100644 --- a/src/Model/CustomerManagementFramework/PasswordRecoveryInterface.php +++ b/src/Model/CustomerManagementFramework/PasswordRecoveryInterface.php @@ -16,48 +16,32 @@ namespace App\Model\CustomerManagementFramework; use Carbon\Carbon; -use CustomerManagementFrameworkBundle\Model\CustomerInterface; interface PasswordRecoveryInterface { /** - * @param string|null $token - * - * @return CustomerInterface + * @return $this */ - public function setPasswordRecoveryToken(?string $token); + public function setPasswordRecoveryToken(?string $token): static; - /** - * @return string - */ public function getPasswordRecoveryToken(): ?string; /** - * @param Carbon|null $tokenDate - * - * @return CustomerInterface + * @return $this */ - public function setPasswordRecoveryTokenDate(?\Carbon\Carbon $tokenDate); + public function setPasswordRecoveryTokenDate(?Carbon $tokenDate): static; - /** - * @return Carbon|null - */ - public function getPasswordRecoveryTokenDate(): ?\Carbon\Carbon; + public function getPasswordRecoveryTokenDate(): ?Carbon; /** - * @return CustomerInterface + * @return $this */ - public function save(); + public function save(): static; - /** - * @return string|null - */ public function getEmail(): ?string; /** - * @param string|null $password - * - * @return CustomerInterface + * @return $this */ - public function setPassword(?string $password); + public function setPassword(?string $password): static; } diff --git a/src/Model/Product/AbstractProduct.php b/src/Model/Product/AbstractProduct.php index 62acdc28..d9c63c0c 100644 --- a/src/Model/Product/AbstractProduct.php +++ b/src/Model/Product/AbstractProduct.php @@ -19,9 +19,6 @@ abstract class AbstractProduct extends \Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractProduct { - /** - * @return Hotspotimage|null - */ public function getMainImage(): ?Hotspotimage { return null; @@ -37,10 +34,7 @@ public function getPriceSystemName(): string return 'default'; } - /** - * @return string|null - */ - public function getPrice() + public function getPrice(): ?string { $saleInformationBrick = $this->getSaleInformation(); $saleInformation = $saleInformationBrick->getSaleInformation(); diff --git a/src/Model/Product/AccessoryPart.php b/src/Model/Product/AccessoryPart.php index 8482c9cd..a954e621 100644 --- a/src/Model/Product/AccessoryPart.php +++ b/src/Model/Product/AccessoryPart.php @@ -20,9 +20,6 @@ class AccessoryPart extends \Pimcore\Model\DataObject\AccessoryPart { - /** - * @return string - */ public function getOSName(): ?string { return $this->getGeneratedName(); @@ -37,9 +34,6 @@ public function getProductName($language = null) ; } - /** - * @return int|string - */ public function getOSProductNumber(): ?string { return $this->getErpNumber(); @@ -50,9 +44,6 @@ public function getOSIndexType(): string return self::OBJECT_TYPE_VARIANT; } - /** - * @return Hotspotimage|null - */ public function getMainImage(): ?Hotspotimage { return $this->getImage(); @@ -73,7 +64,7 @@ public function getCategories(): array * * @throws \Exception */ - public function getCompatibleToProductIds() + public function getCompatibleToProductIds(): array { $paths = []; foreach ($this->getCompatibleTo() as $compatible) { diff --git a/src/Model/Product/AdminStyle/Car.php b/src/Model/Product/AdminStyle/Car.php index 04d0f0c9..4fe12b5e 100644 --- a/src/Model/Product/AdminStyle/Car.php +++ b/src/Model/Product/AdminStyle/Car.php @@ -21,10 +21,9 @@ class Car extends AdminStyle { - /** @var ElementInterface */ - protected $element; + protected ElementInterface $element; - public function __construct($element) + public function __construct(ElementInterface $element) { parent::__construct($element); diff --git a/src/Model/Product/CalculatedValue/AccessoryPartName.php b/src/Model/Product/CalculatedValue/AccessoryPartName.php index c8a5d786..3e66e187 100644 --- a/src/Model/Product/CalculatedValue/AccessoryPartName.php +++ b/src/Model/Product/CalculatedValue/AccessoryPartName.php @@ -28,12 +28,6 @@ public function compute(Concrete $object, CalculatedValue $context): string return $this->getCalculatedValueForEditMode($object, $context); } - /** - * @param $object - * @param $context CalculatedValue - * - * @return string - */ public function getCalculatedValueForEditMode(Concrete $object, CalculatedValue $context): string { if ($object instanceof AccessoryPart) { diff --git a/src/Model/Product/CalculatedValue/QualityCalculator.php b/src/Model/Product/CalculatedValue/QualityCalculator.php index a40d43c6..5fc25029 100644 --- a/src/Model/Product/CalculatedValue/QualityCalculator.php +++ b/src/Model/Product/CalculatedValue/QualityCalculator.php @@ -24,23 +24,11 @@ class QualityCalculator implements DynamicTextLabelInterface, CalculatorClassInterface { - /** - * @param $object Concrete - * @param $context CalculatedValue - * - * @return string - */ public function compute(Concrete $object, CalculatedValue $context): string { return $this->getCalculatedValueForEditMode($object, $context); } - /** - * @param $object - * @param $context CalculatedValue - * - * @return string - */ public function getCalculatedValueForEditMode(Concrete $object, CalculatedValue $context): string { if ($object instanceof Car) { @@ -74,14 +62,7 @@ public function getCalculatedValueForEditMode(Concrete $object, CalculatedValue } } - /** - * @param $data - * @param $object - * @param $params - * - * @return string - */ - public function renderLayoutText($data, $object, $params): string + public function renderLayoutText(string $data, ?Concrete $object, array $params): string { if ($object instanceof Car) { $quality = []; diff --git a/src/Model/Product/Car.php b/src/Model/Product/Car.php index 1d4a5e62..6da3d4b9 100644 --- a/src/Model/Product/Car.php +++ b/src/Model/Product/Car.php @@ -28,18 +28,11 @@ public function getOSName(): ?string return ($this->getManufacturer() ? ($this->getManufacturer()->getName() . ' ') : null) . $this->getName(); } - /** - * @param string|null $language - * @return string|null - */ - public function getProductName($language = null) + public function getProductName(string $language = null): ?string { return $this->getName($language); } - /** - * @return string - */ public function getSubText(): string { $textParts = []; @@ -51,9 +44,6 @@ public function getSubText(): string return "" . implode(", ", array_filter($textParts)) . ''; } - /** - * @return string|null - */ public function getOSProductNumber(): ?string { return $this->getId(); @@ -78,9 +68,6 @@ public function getOSParentId(): int return parent::getOSParentId(); } - /** - * @return Hotspotimage|null - */ public function getMainImage(): ?Hotspotimage { $gallery = $this->getGallery(); @@ -120,9 +107,6 @@ public function getAdditionalImages(): array return $items; } - /** - * @return Category|null - */ public function getMainCategory(): ?Category { $categories = $this->getCategories(); @@ -132,8 +116,6 @@ public function getMainCategory(): ?Category } /** - * @return Listing - * * @throws \Exception */ public function getAccessories(): Listing diff --git a/src/Model/Product/Category.php b/src/Model/Product/Category.php index 4dc296b0..6a400d85 100644 --- a/src/Model/Product/Category.php +++ b/src/Model/Product/Category.php @@ -20,13 +20,8 @@ class Category extends \Pimcore\Model\DataObject\Category /** * returns parent categories for this category * stops at given stop category, otherwise stops at topmost category of object tree - * - * @param Category|null $stopCategory - * @param bool $includeStopCategory - * - * @return array */ - public function getParentCategoryList(self $stopCategory = null, $includeStopCategory = false): array + public function getParentCategoryList(self $stopCategory = null, bool $includeStopCategory = false): array { $parentCategories = []; diff --git a/src/Services/NewsletterDoubleOptInService.php b/src/Services/NewsletterDoubleOptInService.php index 33440eac..7e13298b 100644 --- a/src/Services/NewsletterDoubleOptInService.php +++ b/src/Services/NewsletterDoubleOptInService.php @@ -25,35 +25,19 @@ class NewsletterDoubleOptInService { - /** - * @var UrlGeneratorInterface - */ - protected $urlGenerator; - - /** - * @var CustomerProviderInterface - */ - protected $customerProvider; - /** * NewsletterDoubleOptInService constructor. - * - * @param UrlGeneratorInterface $urlGenerator - * @param CustomerProviderInterface $customerProvider */ - public function __construct(UrlGeneratorInterface $urlGenerator, CustomerProviderInterface $customerProvider) - { - $this->urlGenerator = $urlGenerator; - $this->customerProvider = $customerProvider; + public function __construct( + protected UrlGeneratorInterface $urlGenerator, + protected CustomerProviderInterface $customerProvider + ) { } /** - * @param Customer $customer - * @param Email $emailDocument - * * @throws \Exception */ - public function sendDoubleOptInMail(Customer $customer, Email $emailDocument) + public function sendDoubleOptInMail(Customer $customer, Email $emailDocument): void { if (!$customer->getNewsletterConfirmed()) { $token = md5($customer->getId() . time() . uniqid()); @@ -75,11 +59,6 @@ public function sendDoubleOptInMail(Customer $customer, Email $emailDocument) } } - /** - * @param string $token - * - * @return PasswordRecoveryInterface|null - */ public function getCustomerByToken(string $token): ?CustomerInterface { $customerList = $this->customerProvider->getList(); @@ -89,12 +68,7 @@ public function getCustomerByToken(string $token): ?CustomerInterface return $customerList->current(); } - /** - * @param string $token - * - * @return Customer|null - */ - public function handleDoubleOptInConfirmation(string $token): ?Customer + public function handleDoubleOptInConfirmation(string $token): ?CustomerInterface { $customer = $this->getCustomerByToken($token); if ($customer) { diff --git a/src/Services/PasswordRecoveryService.php b/src/Services/PasswordRecoveryService.php index dc6dbf06..efca1b78 100644 --- a/src/Services/PasswordRecoveryService.php +++ b/src/Services/PasswordRecoveryService.php @@ -25,34 +25,16 @@ class PasswordRecoveryService { - /** - * @var CustomerProviderInterface - */ - protected $customerProvider; - - /** - * @var UrlGeneratorInterface - */ - protected $urlGenerator; - /** * PasswordRecoveryService constructor. - * - * @param CustomerProviderInterface $customerProvider - * @param UrlGeneratorInterface $urlGenerator */ - public function __construct(CustomerProviderInterface $customerProvider, UrlGeneratorInterface $urlGenerator) - { - $this->customerProvider = $customerProvider; - $this->urlGenerator = $urlGenerator; + public function __construct( + protected CustomerProviderInterface $customerProvider, + protected UrlGeneratorInterface $urlGenerator + ) { } /** - * @param string $email - * @param Email $emailDocument - * - * @return CustomerInterface|null - * * @throws \Exception */ public function sendRecoveryMail(string $email, Email $emailDocument): ?CustomerInterface @@ -86,11 +68,6 @@ public function sendRecoveryMail(string $email, Email $emailDocument): ?Customer return null; } - /** - * @param string $token - * - * @return PasswordRecoveryInterface|null - */ public function getCustomerByToken(string $token): ?CustomerInterface { $customerList = $this->customerProvider->getList(); @@ -105,11 +82,7 @@ public function getCustomerByToken(string $token): ?CustomerInterface return null; } - /** - * @param string $token - * @param string $newPassword - */ - public function setPassword(string $token, string $newPassword) + public function setPassword(string $token, string $newPassword): void { $customer = $this->getCustomerByToken($token); $customer->setPassword($newPassword); diff --git a/src/Services/SegmentTrackingHelperService.php b/src/Services/SegmentTrackingHelperService.php index d3e4012e..7c59abed 100644 --- a/src/Services/SegmentTrackingHelperService.php +++ b/src/Services/SegmentTrackingHelperService.php @@ -24,46 +24,18 @@ class SegmentTrackingHelperService { - /** - * @var VisitorInfoStorage - */ - protected $visitorInfoStorage; - - /** - * @var SegmentTracker - */ - protected $segmentTracker; - - /** - * @var SegmentGetter - */ - protected $segmentGetter; - - /** - * @var SegmentManagerInterface - */ - protected $segmentManager; - /** * SegmentTrackingHelperService constructor. - * - * @param VisitorInfoStorage $visitorInfoStorage - * @param SegmentTracker $segmentTracker - * @param SegmentGetter $segmentGetter - * @param SegmentManagerInterface $segmentManager */ - public function __construct(VisitorInfoStorage $visitorInfoStorage, SegmentTracker $segmentTracker, SegmentGetter $segmentGetter, SegmentManagerInterface $segmentManager) - { - $this->visitorInfoStorage = $visitorInfoStorage; - $this->segmentTracker = $segmentTracker; - $this->segmentGetter = $segmentGetter; - $this->segmentManager = $segmentManager; + public function __construct( + protected VisitorInfoStorage $visitorInfoStorage, + protected SegmentTracker $segmentTracker, + protected SegmentGetter $segmentGetter, + protected SegmentManagerInterface $segmentManager + ) { } - /** - * @param AbstractProduct $product - */ - public function trackSegmentsForProduct(AbstractProduct $product) + public function trackSegmentsForProduct(AbstractProduct $product): void { if ($this->visitorInfoStorage->hasVisitorInfo()) { $segments = $this->segmentGetter->get($product); @@ -73,10 +45,7 @@ public function trackSegmentsForProduct(AbstractProduct $product) } } - /** - * @param Category $category - */ - public function trackSegmentsForCategory(Category $category) + public function trackSegmentsForCategory(Category $category): void { if ($this->visitorInfoStorage->hasVisitorInfo()) { $segments = $this->segmentManager->getSegmentsForElement($category); diff --git a/src/Sitemaps/Processors/AbsoluteURLProcessor.php b/src/Sitemaps/Processors/AbsoluteURLProcessor.php index 20658f9b..8145c65f 100644 --- a/src/Sitemaps/Processors/AbsoluteURLProcessor.php +++ b/src/Sitemaps/Processors/AbsoluteURLProcessor.php @@ -26,14 +26,8 @@ class AbsoluteURLProcessor implements ProcessorInterface { - /** - * @var UrlGeneratorInterface - */ - private $urlGenerator; - - public function __construct(UrlGeneratorInterface $urlGenerator) + public function __construct(private UrlGeneratorInterface $urlGenerator) { - $this->urlGenerator = $urlGenerator; } public function process(Url $url, ElementInterface $element, GeneratorContextInterface $context): ?Url diff --git a/src/Twig/Extension/CategoryFilterExtension.php b/src/Twig/Extension/CategoryFilterExtension.php index 4acf3018..71da357d 100644 --- a/src/Twig/Extension/CategoryFilterExtension.php +++ b/src/Twig/Extension/CategoryFilterExtension.php @@ -22,16 +22,10 @@ class CategoryFilterExtension extends AbstractExtension { - protected CategoryLinkGenerator $categoryLinkGenerator; - - public function __construct(CategoryLinkGenerator $categoryLinkGenerator) + public function __construct(protected CategoryLinkGenerator $categoryLinkGenerator) { - $this->categoryLinkGenerator = $categoryLinkGenerator; } - /** - * @return TwigFunction[] - */ public function getFunctions(): array { return [ diff --git a/src/Twig/Extension/Country.php b/src/Twig/Extension/Country.php index afff0feb..5a01d2cb 100644 --- a/src/Twig/Extension/Country.php +++ b/src/Twig/Extension/Country.php @@ -24,7 +24,7 @@ class Country extends AbstractExtension /** * @return TwigFilter[] */ - public function getFilters() + public function getFilters(): array { return [ new TwigFilter('country', function ($code, $displayLocale = null) { diff --git a/src/Twig/Extension/Currency.php b/src/Twig/Extension/Currency.php index f6370a60..5ea9b6dd 100644 --- a/src/Twig/Extension/Currency.php +++ b/src/Twig/Extension/Currency.php @@ -21,32 +21,21 @@ class Currency extends AbstractExtension { - /** - * @var IntlFormatter - */ - protected $formatter; - - public function __construct(IntlFormatter $formatter) + public function __construct(protected IntlFormatter $formatter) { - $this->formatter = $formatter; } /** * @return TwigFilter[] */ - public function getFilters() + public function getFilters(): array { return [ new TwigFilter('currency', [$this, 'format']) ]; } - /** - * @param float $value - * @param string $currency - * @return string - */ - public function format($value, $currency = 'EUR') + public function format(float $value, string $currency = 'EUR'): string { return $this->formatter->formatCurrency($value, $currency); } diff --git a/src/Twig/Extension/GeneralFilterExtension.php b/src/Twig/Extension/GeneralFilterExtension.php index e158194d..63d880d6 100644 --- a/src/Twig/Extension/GeneralFilterExtension.php +++ b/src/Twig/Extension/GeneralFilterExtension.php @@ -21,25 +21,14 @@ class GeneralFilterExtension extends AbstractExtension { - /** - * @var Translator - */ - protected $translator; - /** * GeneralFilterExtension constructor. - * - * @param Translator $translator */ - public function __construct(Translator $translator) + public function __construct(protected Translator $translator) { - $this->translator = $translator; } - /** - * @return TwigFunction[] - */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('app_general_filter_translate', [$this, 'translateValues']), @@ -48,11 +37,7 @@ public function getFunctions() ]; } - /** - * @param array $values - * @return array - */ - public function translateValues($values) + public function translateValues(array $values): array { foreach ($values as &$modifyingValue) { $modifyingValue['translated'] = $this->translator->trans(mb_strtolower('attribute.' . $modifyingValue['value'])); @@ -61,12 +46,6 @@ public function translateValues($values) return $values; } - /** - * @param array $values - * @param string|null $fieldname - * - * @return array - */ public function sort(array $values, string $fieldname = null): array { @usort($values, function ($left, $right) use ($fieldname) { @@ -93,13 +72,6 @@ public function sort(array $values, string $fieldname = null): array return $values; } - /** - * @param array $values - * @param string $fieldname - * @param array $objects - * - * @return array - */ public function sortObjects(array $values, string $fieldname, array $objects): array { @usort($values, function ($left, $right) use ($fieldname, $objects) { diff --git a/src/Twig/Extension/LanguageSwitcherExtension.php b/src/Twig/Extension/LanguageSwitcherExtension.php index 7591053e..7708c744 100644 --- a/src/Twig/Extension/LanguageSwitcherExtension.php +++ b/src/Twig/Extension/LanguageSwitcherExtension.php @@ -32,25 +32,14 @@ class LanguageSwitcherExtension extends AbstractExtension { - /** - * @var Service|Service\Dao - */ - private $documentService; - - private UrlGeneratorInterface $urlGenerator; - private RequestStack $requestStack; - private CategoryLinkGenerator $categoryLinkGenerator; - private NewsLinkGenerator $newsLinkGenerator; - private ProductLinkGenerator $productLinkGenerator; - - public function __construct(Service $documentService, UrlGeneratorInterface $urlGenerator, RequestStack $requestStack, CategoryLinkGenerator $categoryLinkGenerator, NewsLinkGenerator $newsLinkGenerator, ProductLinkGenerator $productLinkGenerator) - { - $this->documentService = $documentService; - $this->urlGenerator = $urlGenerator; - $this->requestStack = $requestStack; - $this->categoryLinkGenerator = $categoryLinkGenerator; - $this->newsLinkGenerator = $newsLinkGenerator; - $this->productLinkGenerator = $productLinkGenerator; + public function __construct( + private Service $documentService, + private UrlGeneratorInterface $urlGenerator, + private RequestStack $requestStack, + private CategoryLinkGenerator $categoryLinkGenerator, + private NewsLinkGenerator $newsLinkGenerator, + private ProductLinkGenerator $productLinkGenerator + ) { } public function getLocalizedLinks(Document $document): array @@ -105,7 +94,7 @@ public function getLocalizedLinks(Document $document): array if (!is_object($object)) { $object = DataObject::getById($object); } - + $linkGeneratorService = $this->$generator; if ($linkGeneratorService instanceof LinkGeneratorInterface) { $target = $linkGeneratorService->generate($object, ['locale' => \Locale::getPrimaryLanguage($language)]); @@ -121,11 +110,7 @@ public function getLocalizedLinks(Document $document): array return $links; } - /** - * @param string $language - * @return string - */ - public function getLanguageFlag($language) + public function getLanguageFlag(string $language): string { $flag = ''; if (Tool::isValidLanguage($language)) { @@ -136,9 +121,6 @@ public function getLanguageFlag($language) return $flag; } - /** - * @inheritDoc - */ public function getFunctions(): array { return [ @@ -147,12 +129,7 @@ public function getFunctions(): array ]; } - /** - * @param string $language - * - * @return string - */ - public static function getLanguageFlagFile($language) + public static function getLanguageFlagFile(string $language): string { $basePath = '/bundles/pimcoreadmin/img/flags'; $code = strtolower($language); diff --git a/src/Twig/Extension/NavigationExtension.php b/src/Twig/Extension/NavigationExtension.php index f128ecbd..6dfe6b6f 100644 --- a/src/Twig/Extension/NavigationExtension.php +++ b/src/Twig/Extension/NavigationExtension.php @@ -29,35 +29,14 @@ class NavigationExtension extends AbstractExtension { const NAVIGATION_EXTENSION_POINT_PROPERTY = 'navigation_extension_point'; - /** - * @var CategoryLinkGenerator - */ - protected $categoryLinkGenerator; - - /** - * @var Navigation - */ - protected $navigationHelper; - - /** - * @var Placeholder - */ - protected $placeholderHelper; - - /** - * @param Navigation $navigationHelper - */ - public function __construct(Navigation $navigationHelper, Placeholder $placeholderHelper, CategoryLinkGenerator $categoryLinkGenerator) - { - $this->navigationHelper = $navigationHelper; - $this->categoryLinkGenerator = $categoryLinkGenerator; - $this->placeholderHelper = $placeholderHelper; + public function __construct( + protected Navigation $navigationHelper, + protected Placeholder $placeholderHelper, + protected CategoryLinkGenerator $categoryLinkGenerator + ) { } - /** - * @return array|TwigFunction[] - */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('app_navigation_data_links', [$this, 'getDataLinks']), @@ -65,13 +44,7 @@ public function getFunctions() ]; } - /** - * @param Document $document - * @param Document $startNode - * - * @return \Pimcore\Navigation\Container - */ - public function getDataLinks(Document $document, Document $startNode) + public function getDataLinks(Document $document, Document $startNode): Container { $navigation = $this->navigationHelper->build([ 'active' => $document, @@ -104,10 +77,6 @@ public function getDataLinks(Document $document, Document $startNode) } /** - * @param Container $navigation - * - * @return Container - * * @throws \Exception */ public function enrichBreadcrumbs(Container $navigation): Container diff --git a/src/Twig/Extension/NewsExtension.php b/src/Twig/Extension/NewsExtension.php index 050a2395..bcf754e5 100644 --- a/src/Twig/Extension/NewsExtension.php +++ b/src/Twig/Extension/NewsExtension.php @@ -22,38 +22,22 @@ class NewsExtension extends AbstractExtension { - /** - * @var NewsLinkGenerator - */ - protected $newsLinkGenerator; - /** * NewsExtension constructor. - * - * @param NewsLinkGenerator $newsLinkGenerator */ - public function __construct(NewsLinkGenerator $newsLinkGenerator) + public function __construct(protected NewsLinkGenerator $newsLinkGenerator) { - $this->newsLinkGenerator = $newsLinkGenerator; } - /** - * @return TwigFunction[] - */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('app_news_detaillink', [$this, 'generateLink']), ]; } - /** - * @param News $news - * - * @return string - */ public function generateLink(News $news): string { - return $this->newsLinkGenerator->generate($news, []); + return $this->newsLinkGenerator->generate($news); } } diff --git a/src/Twig/Extension/PrintCatalogExtension.php b/src/Twig/Extension/PrintCatalogExtension.php index 1bed6775..d3c1cfb7 100644 --- a/src/Twig/Extension/PrintCatalogExtension.php +++ b/src/Twig/Extension/PrintCatalogExtension.php @@ -31,32 +31,14 @@ class PrintCatalogExtension extends AbstractExtension { - /** - * @var Translator - */ - protected $translator; - - /** - * @var Placeholder - */ - protected $placeholderHelper; - /** * PrintCatalogExtension constructor. - * - * @param Translator $translator - * @param Placeholder $placeholderHelper */ - public function __construct(Translator $translator, Placeholder $placeholderHelper) + public function __construct(protected Translator $translator, protected Placeholder $placeholderHelper) { - $this->translator = $translator; - $this->placeholderHelper = $placeholderHelper; } - /** - * @return TwigFunction[] - */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('app_print_output_spec_value', [$this, 'getSpecValue']), @@ -86,12 +68,6 @@ public function getSpecValue(\stdClass $outputElement, string $thumbnailName = n } } - /** - * @param Image $image - * @param string $thumbnailName - * - * @return string - */ protected function printImage(Image $image, string $thumbnailName): string { $src = $thumbnailName ? $image->getThumbnail($thumbnailName) : $image->getFullPath(); @@ -99,12 +75,6 @@ protected function printImage(Image $image, string $thumbnailName): string return "image"; } - /** - * @param \Pimcore\Model\DataObject\Data\ImageGallery $imageGallery - * @param string $thumbnailName - * - * @return string - */ protected function printImageGallery(\Pimcore\Model\DataObject\Data\ImageGallery $imageGallery, string $thumbnailName): string { $firstItem = $imageGallery->current(); @@ -115,12 +85,6 @@ protected function printImageGallery(\Pimcore\Model\DataObject\Data\ImageGallery return ''; } - /** - * @param \Pimcore\Model\DataObject\Data\Hotspotimage $hotspotimage - * @param string $thumbnailName - * - * @return string - */ protected function printHotspotImage(\Pimcore\Model\DataObject\Data\Hotspotimage $hotspotimage, string $thumbnailName): string { $image = $hotspotimage->getImage(); @@ -129,21 +93,11 @@ protected function printHotspotImage(\Pimcore\Model\DataObject\Data\Hotspotimage } } - /** - * @param string $value - * - * @return string - */ protected function printSelectValue(string $value): string { return $this->translator->trans('attribute.' . strtolower($value)); } - /** - * @param array|null $value - * - * @return string - */ protected function printMultiSelectValue(?array $value = null): string { $result = []; @@ -156,11 +110,6 @@ protected function printMultiSelectValue(?array $value = null): string return implode(', ', $result); } - /** - * @param array $value - * - * @return string - */ protected function printManyToManyObjects(array $value): string { $result = []; @@ -175,11 +124,6 @@ protected function printManyToManyObjects(array $value): string return implode(', ', $result); } - /** - * @param AbstractElement|null $element - * - * @return string - */ protected function printManyToOne(?AbstractElement $element = null): string { if ($element && method_exists($element, 'getName')) { @@ -189,11 +133,7 @@ protected function printManyToOne(?AbstractElement $element = null): string return ''; } - /** - * @param string|null $name - * @param string|null $registerType - */ - public function createRegisterTitleStyling(?string $name, ?string $registerType = '') + public function createRegisterTitleStyling(?string $name, ?string $registerType = ''): void { $key = $this->getRegisterName($name); @@ -222,12 +162,7 @@ public function createRegisterTitleStyling(?string $name, ?string $registerType } } - /** - * @param string|null $name - * - * @return string - */ - public function getRegisterName(?string $name) + public function getRegisterName(?string $name): string { return Text::toUrl($name); } diff --git a/src/Twig/Extension/ProductPageExtension.php b/src/Twig/Extension/ProductPageExtension.php index 14704820..0d1f14d4 100644 --- a/src/Twig/Extension/ProductPageExtension.php +++ b/src/Twig/Extension/ProductPageExtension.php @@ -24,63 +24,32 @@ class ProductPageExtension extends AbstractExtension { - /** - * @var ProductLinkGenerator - */ - protected $productLinkGenerator; - - /** - * @var Translator - */ - protected $translator; - /** * ProductPageExtension constructor. - * - * @param ProductLinkGenerator $productLinkGenerator - * @param Translator $translator */ - public function __construct(ProductLinkGenerator $productLinkGenerator, Translator $translator) + public function __construct(protected ProductLinkGenerator $productLinkGenerator, protected Translator $translator) { - $this->productLinkGenerator = $productLinkGenerator; - $this->translator = $translator; } - /** - * @return TwigFunction[] - */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('app_product_detaillink', [$this, 'generateLink']), ]; } - /** - * @return TwigFilter[] - */ - public function getFilters() + public function getFilters(): array { return [ new TwigFilter('colorname', [$this, 'getColorName']) ]; } - /** - * @param ProductInterface $product - * - * @return string - */ public function generateLink(ProductInterface $product): string { return $this->productLinkGenerator->generateWithMockup($product, []); } - /** - * @param array|null $colorNames - * - * @return string - */ public function getColorName(?array $colorNames = []): string { $translatedColors = []; diff --git a/src/Twig/Extension/UniqidExtension.php b/src/Twig/Extension/UniqidExtension.php index e37d1891..c092a9a0 100644 --- a/src/Twig/Extension/UniqidExtension.php +++ b/src/Twig/Extension/UniqidExtension.php @@ -22,10 +22,7 @@ class UniqidExtension extends AbstractExtension { - /** - * {@inheritdoc} - */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('uniqid', function (string $prefix = '', bool $moreEntropy = false) { diff --git a/src/Website/LinkGenerator/AbstractProductLinkGenerator.php b/src/Website/LinkGenerator/AbstractProductLinkGenerator.php index 3932eada..716b156d 100644 --- a/src/Website/LinkGenerator/AbstractProductLinkGenerator.php +++ b/src/Website/LinkGenerator/AbstractProductLinkGenerator.php @@ -27,45 +27,22 @@ abstract class AbstractProductLinkGenerator implements LinkGeneratorInterface { const ROOT_CATEGORY_PROPERTY_NAME = 'root_category'; - /** - * @var DocumentResolver - */ - protected $documentResolver; + protected ?Document $document = null; - /** - * @var RequestStack - */ - protected $requestStack; - - /** - * @var PimcoreUrl - */ - protected $pimcoreUrl; - - /** - * @var Document|null - */ - protected $document; - - public function __construct(DocumentResolver $documentResolver, RequestStack $requestStack, PimcoreUrl $pimcoreUrl) - { - $this->documentResolver = $documentResolver; - $this->requestStack = $requestStack; - $this->pimcoreUrl = $pimcoreUrl; + public function __construct( + protected DocumentResolver $documentResolver, + protected RequestStack $requestStack, + protected PimcoreUrl $pimcoreUrl + ) { } - /** - * @param Category|null $category - * @param Category|null $rootCategory - * @return string - */ - public function getNavigationPath(?Category $category, ?Category $rootCategory = null, $locale = null) + public function getNavigationPath(?Category $category, ?Category $rootCategory = null, string $locale = null) { if (empty($rootCategory)) { if (!$this->document) { try { $this->document = $this->documentResolver->getDocument($this->requestStack->getCurrentRequest()); - } catch (\Exception $e) { + } catch (\Exception) { // nothing to do } } diff --git a/src/Website/LinkGenerator/NewsLinkGenerator.php b/src/Website/LinkGenerator/NewsLinkGenerator.php index 7fe03b86..f8daa149 100644 --- a/src/Website/LinkGenerator/NewsLinkGenerator.php +++ b/src/Website/LinkGenerator/NewsLinkGenerator.php @@ -33,40 +33,15 @@ class NewsLinkGenerator implements LinkGeneratorInterface { const DEFAULT_DOCUMENT = 'news_default_document'; - /** - * @var DocumentResolver - */ - protected $documentResolver; - - /** - * @var RequestStack - */ - protected $requestStack; - - /** - * @var PimcoreUrl - */ - protected $pimcoreUrl; - - /** - * @var LocaleServiceInterface - */ - protected $localeService; - /** * NewsLinkGenerator constructor. - * - * @param DocumentResolver $documentResolver - * @param RequestStack $requestStack - * @param PimcoreUrl $pimcoreUrl - * @param LocaleServiceInterface $localeService */ - public function __construct(DocumentResolver $documentResolver, RequestStack $requestStack, PimcoreUrl $pimcoreUrl, LocaleServiceInterface $localeService) - { - $this->documentResolver = $documentResolver; - $this->requestStack = $requestStack; - $this->pimcoreUrl = $pimcoreUrl; - $this->localeService = $localeService; + public function __construct( + protected DocumentResolver $documentResolver, + protected RequestStack $requestStack, + protected PimcoreUrl $pimcoreUrl, + protected LocaleServiceInterface $localeService + ) { } public function generate(object $object, array $params = []): string diff --git a/src/Website/LinkGenerator/ProductLinkGenerator.php b/src/Website/LinkGenerator/ProductLinkGenerator.php index 46d1f48e..32cf29c1 100644 --- a/src/Website/LinkGenerator/ProductLinkGenerator.php +++ b/src/Website/LinkGenerator/ProductLinkGenerator.php @@ -37,24 +37,12 @@ public function generate(object $object, array $params = []): string return $this->doGenerate($object, $params); } - /** - * @param ProductInterface $object - * @param array $params - * - * @return string - */ public function generateWithMockup(ProductInterface $object, array $params = []): string { return $this->doGenerate($object, $params); } - /** - * @param $object - * @param $params - * - * @return string - */ - protected function doGenerate($object, $params): string + protected function doGenerate(ProductInterface $object, array $params): string { return DataObject\Service::useInheritedValues(true, function () use ($object, $params) { if (!empty($object->getUrlSlug())) { diff --git a/src/Website/Navigation/BreadcrumbHelperService.php b/src/Website/Navigation/BreadcrumbHelperService.php index 4c504828..e212a428 100644 --- a/src/Website/Navigation/BreadcrumbHelperService.php +++ b/src/Website/Navigation/BreadcrumbHelperService.php @@ -28,58 +28,24 @@ class BreadcrumbHelperService { - /** - * @var RequestStack - */ - protected $requestStack; - - /** - * @var Placeholder - */ - protected $placeholderHelper; - - /** - * @var CategoryLinkGenerator - */ - protected $categoryLinkGenerator; - - /** - * @var Translator - */ - protected $translator; - - /** - * @var UrlGeneratorInterface - */ - protected $urlGenerator; - /** * BreadcrumbHelperService constructor. - * - * @param RequestStack $requestStack - * @param Placeholder $placeholderHelper - * @param CategoryLinkGenerator $categoryLinkGenerator - * @param Translator $translator - * @param UrlGeneratorInterface $urlGenerator */ - public function __construct(RequestStack $requestStack, Placeholder $placeholderHelper, CategoryLinkGenerator $categoryLinkGenerator, Translator $translator, UrlGeneratorInterface $urlGenerator) - { - $this->requestStack = $requestStack; - $this->placeholderHelper = $placeholderHelper; - $this->categoryLinkGenerator = $categoryLinkGenerator; - $this->translator = $translator; - $this->urlGenerator = $urlGenerator; + public function __construct( + protected RequestStack $requestStack, + protected Placeholder $placeholderHelper, + protected CategoryLinkGenerator $categoryLinkGenerator, + protected Translator $translator, + protected UrlGeneratorInterface $urlGenerator + ) { } - /** - * @return Document - */ protected function getCurrentDocument(): Document { return $this->requestStack->getCurrentRequest()->attributes->get('contentDocument'); } - public function enrichProductDetailPage(AbstractObject $product) + public function enrichProductDetailPage(AbstractObject $product): void { $document = $this->getCurrentDocument(); @@ -108,27 +74,24 @@ public function enrichProductDetailPage(AbstractObject $product) ]); } - public function enrichCategoryPage(Category $category) + public function enrichCategoryPage(Category $category): void { $document = $this->getCurrentDocument(); - - if ($category) { - $parentId = $document->getId(); - $parentCategories = $category->getParentCategoryList($document->getProperty(AbstractProductLinkGenerator::ROOT_CATEGORY_PROPERTY_NAME)); - $parentCategories[] = $category; - foreach ($parentCategories as $index => $parentCategory) { - $this->placeholderHelper->__invoke('addBreadcrumb')->append([ - 'parentId' => $parentId, - 'id' => 'category-' . $parentCategory->getId(), - 'url' => $this->categoryLinkGenerator->generate($parentCategory, [], true), - 'label' => $parentCategory->getName() - ]); - $parentId = 'category-' . $parentCategory->getId(); - } + $parentId = $document->getId(); + $parentCategories = $category->getParentCategoryList($document->getProperty(AbstractProductLinkGenerator::ROOT_CATEGORY_PROPERTY_NAME)); + $parentCategories[] = $category; + foreach ($parentCategories as $parentCategory) { + $this->placeholderHelper->__invoke('addBreadcrumb')->append([ + 'parentId' => $parentId, + 'id' => 'category-' . $parentCategory->getId(), + 'url' => $this->categoryLinkGenerator->generate($parentCategory, [], true), + 'label' => $parentCategory->getName() + ]); + $parentId = 'category-' . $parentCategory->getId(); } } - public function enrichCartPage() + public function enrichCartPage(): void { $document = $this->getCurrentDocument(); @@ -140,7 +103,7 @@ public function enrichCartPage() ]); } - public function enrichCheckoutPage() + public function enrichCheckoutPage(): void { $document = $this->getCurrentDocument(); @@ -159,10 +122,7 @@ public function enrichCheckoutPage() ]); } - /** - * @param News $news - */ - public function enrichNewsPage(News $news) + public function enrichNewsPage(News $news): void { $document = $this->getCurrentDocument(); $this->placeholderHelper->__invoke('addBreadcrumb')->append([ @@ -173,7 +133,7 @@ public function enrichNewsPage(News $news) ]); } - public function enrichGenericDynamicPage($label) + public function enrichGenericDynamicPage(string $label): void { $document = $this->getCurrentDocument(); $this->placeholderHelper->__invoke('addBreadcrumb')->append([ diff --git a/src/Website/Tool/PimcoreUrl.php b/src/Website/Tool/PimcoreUrl.php index b12d601c..915eeb47 100644 --- a/src/Website/Tool/PimcoreUrl.php +++ b/src/Website/Tool/PimcoreUrl.php @@ -17,16 +17,7 @@ class PimcoreUrl extends \Pimcore\Twig\Extension\Templating\PimcoreUrl { - /** - * @param array $urlOptions - * @param null $name - * @param bool $reset - * @param bool $encode - * @param bool $relative - * - * @return string - */ - public function __invoke(array $urlOptions = [], $name = null, $reset = false, $encode = true, $relative = false): string + public function __invoke(array $urlOptions = [], string $name = null, bool $reset = false, bool $encode = true, bool $relative = false): string { // merge all parameters from request to parameters if (!$reset && $this->requestHelper->hasMainRequest()) { diff --git a/src/Website/Tool/Text.php b/src/Website/Tool/Text.php index 209883fe..f9822bca 100644 --- a/src/Website/Tool/Text.php +++ b/src/Website/Tool/Text.php @@ -17,11 +17,7 @@ class Text { - /** - * @param string $string - * @return string - */ - public static function getStringAsOneLine($string) + public static function getStringAsOneLine(string $string): string { $string = str_replace("\r\n", ' ', $string); $string = str_replace("\n", ' ', $string); @@ -32,12 +28,7 @@ public static function getStringAsOneLine($string) return $string; } - /** - * @param string $string - * @param int $length - * @return string - */ - public static function cutStringRespectingWhitespace($string, $length) + public static function cutStringRespectingWhitespace(string $string, int $length): string { if ($length < strlen($string)) { $text = substr($string, 0, $length); @@ -50,11 +41,7 @@ public static function cutStringRespectingWhitespace($string, $length) return $string; } - /** - * @param string $text - * @return string - */ - public static function toUrl($text) + public static function toUrl(string $text): string { // to ASCII $text = trim(transliterator_transliterate('Any-Latin; Latin-ASCII; [^\u001F-\u007f] remove', $text)); diff --git a/src/Workflow/SupportsStrategy.php b/src/Workflow/SupportsStrategy.php index 50c1a8f9..a6d581b3 100644 --- a/src/Workflow/SupportsStrategy.php +++ b/src/Workflow/SupportsStrategy.php @@ -21,12 +21,7 @@ class SupportsStrategy implements WorkflowSupportStrategyInterface { - /** - * @param WorkflowInterface $workflow - * @param object $subject - * @return bool - */ - public function supports(WorkflowInterface $workflow, $subject): bool + public function supports(WorkflowInterface $workflow, object $subject): bool { if ($workflow->getName() == 'product_data_enrichment') { if ($subject instanceof Car && strpos($subject->getFullPath(), '/upload/new') === 0) {