diff --git a/Classes/Controller/Backend/Order/DocumentController.php b/Classes/Controller/Backend/Order/DocumentController.php index 19ae1aa2..3df52aa9 100644 --- a/Classes/Controller/Backend/Order/DocumentController.php +++ b/Classes/Controller/Backend/Order/DocumentController.php @@ -72,8 +72,8 @@ public function downloadAction(Item $orderItem, string $pdfType): ResponseInterf { $getter = 'get' . ucfirst($pdfType) . 'Pdfs'; $pdfs = $orderItem->$getter(); - /** @var File $originalPdf */ - $originalPdf = end($pdfs->toArray())->getOriginalResource(); + $pdfs = $pdfs->toArray(); + $originalPdf = end($pdfs)->getOriginalResource(); if ($originalPdf) { return $this->responseFactory->createResponse() diff --git a/Classes/Controller/Cart/CartController.php b/Classes/Controller/Cart/CartController.php index 08f06adc..e9949b01 100755 --- a/Classes/Controller/Cart/CartController.php +++ b/Classes/Controller/Cart/CartController.php @@ -24,7 +24,10 @@ class CartController extends ActionController { - protected $defaultViewObjectName = CartTemplateView::class; + public function __construct() + { + $this->defaultViewObjectName = CartTemplateView::class; + } protected function initializeView(ViewInterface $view): void { diff --git a/Classes/Controller/Cart/OrderController.php b/Classes/Controller/Cart/OrderController.php index f305493f..f6cfd03d 100644 --- a/Classes/Controller/Cart/OrderController.php +++ b/Classes/Controller/Cart/OrderController.php @@ -33,7 +33,7 @@ class OrderController extends ActionController { - protected function getErrorFlashMessage() + protected function getErrorFlashMessage(): bool|string { return LocalizationUtility::translate( 'tx_cart.error.validation', @@ -166,7 +166,6 @@ protected function setDynamicValidation( array $validatorConf ): void { // build custom validation chain - /** @var ValidatorResolver $validatorResolver */ $validatorResolver = GeneralUtility::makeInstance( ValidatorResolver::class ); diff --git a/Classes/Controller/Cart/ProductController.php b/Classes/Controller/Cart/ProductController.php index 57916546..f3eca424 100644 --- a/Classes/Controller/Cart/ProductController.php +++ b/Classes/Controller/Cart/ProductController.php @@ -24,14 +24,6 @@ class ProductController extends ActionController { public const AJAX_CART_TYPE_NUM = '2278001'; - /** - * @var EventDispatcherInterface - */ - protected $eventDispatcher; - - /** - * @param EventDispatcherInterface|null $eventDispatcher - */ public function __construct( EventDispatcherInterface $eventDispatcher = null ) { diff --git a/Classes/Domain/Model/Cart/BeVariant.php b/Classes/Domain/Model/Cart/BeVariant.php index 8a056a83..ee1ffbdd 100644 --- a/Classes/Domain/Model/Cart/BeVariant.php +++ b/Classes/Domain/Model/Cart/BeVariant.php @@ -97,7 +97,6 @@ public function toArray(): array $innerVariantArr = []; foreach ($this->beVariants as $variant) { - /** @var BeVariant $variant */ $innerVariantArr[] = [$variant->getId() => $variant->toArray()]; } @@ -535,7 +534,6 @@ protected function calcGross(): void if ($this->beVariants) { $sum = 0.0; foreach ($this->beVariants as $beVariant) { - /** @var BeVariant $beVariant */ $sum += $beVariant->getGross(); } $this->gross = $sum; @@ -621,10 +619,7 @@ public function getAdditional(string $key) return $this->additional[$key]; } - /** - * @param string $key - */ - public function setAdditional($key, mixed $value): void + public function setAdditional(string $key, mixed $value): void { $this->additional[$key] = $value; } diff --git a/Classes/Domain/Model/Cart/Cart.php b/Classes/Domain/Model/Cart/Cart.php index fbb59c7a..1a465f5d 100644 --- a/Classes/Domain/Model/Cart/Cart.php +++ b/Classes/Domain/Model/Cart/Cart.php @@ -66,10 +66,10 @@ class Cart protected string $shippingCountry = ''; + /** + * @var TaxClass[] $taxClasses + */ public function __construct( - /** - * @var TaxClass[] - */ protected array $taxClasses, protected bool $isNetCart = false, protected string $currencyCode = 'EUR', diff --git a/Classes/Domain/Model/Cart/Product.php b/Classes/Domain/Model/Cart/Product.php index c77e4c82..5095ac41 100644 --- a/Classes/Domain/Model/Cart/Product.php +++ b/Classes/Domain/Model/Cart/Product.php @@ -140,7 +140,6 @@ public function addBeVariant(BeVariant $newVariant): void public function changeVariantsQuantity(array $variantQuantity): void { foreach ($variantQuantity as $variantId => $quantity) { - /** @var BeVariant $variant */ $variant = $this->beVariants[$variantId]; if (ctype_digit((string)$quantity)) { @@ -172,7 +171,6 @@ public function getBeVariantById(string $variantId): ?BeVariant public function removeBeVariants(array $variantsArray): int { foreach ($variantsArray as $variantId => $value) { - /** @var BeVariant $variant */ $variant = $this->beVariants[$variantId]; if ($variant) { if (is_array($value)) { @@ -554,7 +552,6 @@ protected function calcGross(): void if ($this->beVariants) { $sum = 0.0; foreach ($this->beVariants as $variant) { - /** @var BeVariant $variant */ $sum += $variant->getGross(); } $this->gross = $sum; @@ -583,7 +580,6 @@ protected function calcNet(): void if ($this->beVariants) { $sum = 0.0; foreach ($this->beVariants as $variant) { - /** @var BeVariant $variant */ $sum += $variant->getNet(); } $this->net = $sum; @@ -602,7 +598,6 @@ protected function reCalc(): void if ($this->beVariants) { $quantity = 0; foreach ($this->beVariants as $variant) { - /** @var BeVariant $variant */ $quantity += $variant->getQuantity(); } diff --git a/Classes/Domain/Validator/OrderItemValidator.php b/Classes/Domain/Validator/OrderItemValidator.php index 86c513a3..c57d9df3 100644 --- a/Classes/Domain/Validator/OrderItemValidator.php +++ b/Classes/Domain/Validator/OrderItemValidator.php @@ -63,7 +63,6 @@ protected function getPropertyValue(object $object, string $propertyName): mixed */ protected function checkProperty(mixed $value, \Traversable $validators, string $propertyName): void { - /** @var Result $result */ $result = null; foreach ($validators as $validator) { if ($validator instanceof ObjectValidatorInterface) { diff --git a/Classes/Event/CheckProductAvailabilityEvent.php b/Classes/Event/CheckProductAvailabilityEvent.php index 28068233..5d23c297 100644 --- a/Classes/Event/CheckProductAvailabilityEvent.php +++ b/Classes/Event/CheckProductAvailabilityEvent.php @@ -77,9 +77,6 @@ public function setMessages(array $messages): void $this->messages = $messages; } - /** - * @param FlashMessage $message - */ public function addMessage(FlashMessage $message): void { $this->messages[] = $message; diff --git a/Classes/EventListener/Order/Create/Number.php b/Classes/EventListener/Order/Create/Number.php index 663c9bf4..ba1727c4 100644 --- a/Classes/EventListener/Order/Create/Number.php +++ b/Classes/EventListener/Order/Create/Number.php @@ -19,20 +19,11 @@ abstract class Number { - /** - * @var PersistenceManager - */ - protected $persistenceManager; + protected PersistenceManager $persistenceManager; - /** - * @var OrderItemRepository - */ - protected $orderItemRepository; + protected OrderItemRepository $orderItemRepository; - /** - * @var array - */ - protected $options; + protected array $options; abstract protected function getRegistryName(NumberGeneratorEventInterface $event): string; diff --git a/Classes/EventListener/Order/Create/PersistOrder/Item.php b/Classes/EventListener/Order/Create/PersistOrder/Item.php index 5c646788..8dd4d45b 100644 --- a/Classes/EventListener/Order/Create/PersistOrder/Item.php +++ b/Classes/EventListener/Order/Create/PersistOrder/Item.php @@ -17,6 +17,7 @@ use Extcode\Cart\Domain\Repository\Order\ShippingAddressRepository; use Extcode\Cart\Event\Order\PersistOrderEvent; use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Context\UserAspect; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; @@ -38,10 +39,11 @@ public function __invoke(PersistOrderEvent $event): void $orderItem->setPid($storagePid); - /** @var $userAspect */ $userAspect = GeneralUtility::makeInstance(Context::class)->getAspect('frontend.user'); - - if ($userAspect->isLoggedIn()) { + if ( + $userAspect instanceof UserAspect && + $userAspect->isLoggedIn() + ) { $frontendUserRepository = GeneralUtility::makeInstance( FrontendUserRepository::class ); diff --git a/Classes/EventListener/Order/Create/PersistOrder/Products.php b/Classes/EventListener/Order/Create/PersistOrder/Products.php index 942ab564..cbd3536b 100644 --- a/Classes/EventListener/Order/Create/PersistOrder/Products.php +++ b/Classes/EventListener/Order/Create/PersistOrder/Products.php @@ -85,10 +85,6 @@ protected function addProduct(Product $cartProduct): void protected function addProductVariants(Product $product): void { foreach ($product->getBeVariants() as $variant) { - /** - * Cart Variant - * @var BeVariant $variant - */ if ($variant->getBeVariants()) { $this->addVariantsOfVariant($variant, 1); } else { @@ -116,9 +112,6 @@ protected function addProductAdditional( \Extcode\Cart\Domain\Model\Order\Product $product, array $feVariant ): void { - /** - * @var ProductAdditional $productAdditional - */ $productAdditional = GeneralUtility::makeInstance( ProductAdditional::class, $productAdditionalType, @@ -138,10 +131,6 @@ protected function addVariantsOfVariant(BeVariant $variant, int $level): void $level += 1; foreach ($variant->getBeVariants() as $variantInner) { - /** - * Cart Variant Inner - * @var BeVariant $variantInner - */ if ($variantInner->getBeVariants()) { $this->addVariantsOfVariant($variantInner, $level); } else { diff --git a/Classes/Hooks/ItemsProcFunc.php b/Classes/Hooks/ItemsProcFunc.php index dbc18a31..49b4a663 100644 --- a/Classes/Hooks/ItemsProcFunc.php +++ b/Classes/Hooks/ItemsProcFunc.php @@ -24,8 +24,7 @@ class ItemsProcFunc { - /** @var TemplateLayout $templateLayoutsUtility */ - protected $templateLayoutsUtility; + protected TemplateLayout $templateLayoutsUtility; public function __construct() { @@ -34,8 +33,6 @@ public function __construct() /** * Itemsproc function to extend the selection of templateLayouts in the plugin - * - * @param array &$config configuration array */ public function user_templateLayout(array &$config): void { @@ -99,12 +96,8 @@ protected function getExtKey($listType) /** * Reduce the template layouts by the ones that are not allowed in given colPos - * - * @param array $templateLayouts - * @param int $currentColPos - * @return array */ - protected function reduceTemplateLayouts($templateLayouts, $currentColPos) + protected function reduceTemplateLayouts(array $templateLayouts, int $currentColPos): array { $currentColPos = (int)$currentColPos; $restrictions = []; @@ -132,11 +125,8 @@ protected function reduceTemplateLayouts($templateLayouts, $currentColPos) /** * Get page id, if negative, then it is a "after record" - * - * @param int $pid - * @return int */ - protected function getPageId($pid) + protected function getPageId(int $pid): int { $pid = (int)$pid; diff --git a/Classes/Utility/CartUtility.php b/Classes/Utility/CartUtility.php index a496ae1c..a9881f6e 100644 --- a/Classes/Utility/CartUtility.php +++ b/Classes/Utility/CartUtility.php @@ -10,7 +10,6 @@ */ use Extcode\Cart\Domain\Model\Cart\Cart; -use Extcode\Cart\Domain\Model\Cart\Service; use Extcode\Cart\Event\Cart\UpdateCountryEvent; use Extcode\Cart\Service\PaymentMethodsServiceInterface; use Extcode\Cart\Service\SessionHandler; @@ -98,7 +97,6 @@ public function getNewCart(array $configurations): Cart $taxClasses = $this->taxClassService->getTaxClasses($defaultCountry); - /** @var Cart $cart */ $cart = GeneralUtility::makeInstance( Cart::class, $taxClasses, @@ -125,10 +123,6 @@ protected function setShipping(Cart $cart): void $shippings = $this->shippingMethodsService->getShippingMethods($cart); foreach ($shippings as $shipping) { - /** - * Shipping - * @var Service $shipping - */ if ($shipping->isPreset()) { if (!$shipping->isAvailable()) { $fallBackId = $shipping->getFallBackId(); @@ -145,10 +139,6 @@ protected function setPayment(Cart $cart): void $payments = $this->paymentMethodsService->getPaymentMethods($cart); foreach ($payments as $payment) { - /** - * Payment - * @var Service $payment - */ if ($payment->isPreset()) { if (!$payment->isAvailable()) { $fallBackId = $payment->getFallBackId(); diff --git a/Classes/Utility/TemplateLayout.php b/Classes/Utility/TemplateLayout.php index 7bd41893..549d0b33 100644 --- a/Classes/Utility/TemplateLayout.php +++ b/Classes/Utility/TemplateLayout.php @@ -17,13 +17,8 @@ class TemplateLayout implements SingletonInterface { /** * Get available template layouts for a certain page - * - * @param int $pageUid - * @param string $extKey - * @param string $pluginName - * @return array */ - public function getAvailableTemplateLayouts($pageUid, $extKey, $pluginName) + public function getAvailableTemplateLayouts(int $pageUid, string $extKey, string $pluginName): array { $templateLayouts = []; $pluginName = GeneralUtility::camelCaseToLowerCaseUnderscored($pluginName); @@ -57,12 +52,8 @@ public function getAvailableTemplateLayouts($pageUid, $extKey, $pluginName) /** * Get template layouts defined in TsConfig - * - * @param $pageUid - * @param string $pluginName - * @return array */ - protected function getTemplateLayoutsFromTsConfig($pageUid, $extKey, $pluginName) + protected function getTemplateLayoutsFromTsConfig(int $pageUid, string $extKey, string $pluginName): array { $templateLayouts = []; $pagesTsConfig = BackendUtility::getPagesTSconfig($pageUid); diff --git a/Classes/ViewHelpers/FieldNameViewHelper.php b/Classes/ViewHelpers/FieldNameViewHelper.php index aeb223d1..6e2475bd 100644 --- a/Classes/ViewHelpers/FieldNameViewHelper.php +++ b/Classes/ViewHelpers/FieldNameViewHelper.php @@ -51,12 +51,7 @@ public function render() return $fieldName; } - /** - * @param BeVariant $variant - * - * @return string - */ - protected function getVariantFieldName($variant) + protected function getVariantFieldName(BeVariant $variant): string { $fieldName = ''; diff --git a/Classes/ViewHelpers/Format/CurrencyViewHelper.php b/Classes/ViewHelpers/Format/CurrencyViewHelper.php index 86bdecda..3fa1ad3d 100644 --- a/Classes/ViewHelpers/Format/CurrencyViewHelper.php +++ b/Classes/ViewHelpers/Format/CurrencyViewHelper.php @@ -13,15 +13,9 @@ class CurrencyViewHelper extends AbstractViewHelper { - /** - * @var ConfigurationManager - */ - protected $configurationManager; - - public function __construct(ConfigurationManager $configurationManager) - { - $this->configurationManager = $configurationManager; - } + public function __construct( + protected readonly ConfigurationManager $configurationManager + ) {} /** * Output is escaped already. We must not escape children, to avoid double encoding. @@ -82,7 +76,7 @@ public function initializeArguments(): void /** * @return string the formatted amount. */ - public function render() + public function render(): string { if ($this->hasArgument('currencySign')) { $currencySign = $this->arguments['currencySign']; diff --git a/Classes/ViewHelpers/MapModelPropertiesToTableColumnsViewHelper.php b/Classes/ViewHelpers/MapModelPropertiesToTableColumnsViewHelper.php index d173da6d..595e9d81 100644 --- a/Classes/ViewHelpers/MapModelPropertiesToTableColumnsViewHelper.php +++ b/Classes/ViewHelpers/MapModelPropertiesToTableColumnsViewHelper.php @@ -9,7 +9,6 @@ * LICENSE file that was distributed with this source code. */ -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Reflection\ObjectAccess; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -17,14 +16,17 @@ class MapModelPropertiesToTableColumnsViewHelper extends AbstractViewHelper { /** - * @var ConfigurationManager + * @var array */ - protected $configurationManager; + protected array $configuration; - /** - * @var array - */ - protected $configuration; + public function __construct( + protected readonly ConfigurationManager $configurationManager + ) { + $this->configuration = $this->configurationManager->getConfiguration( + ConfigurationManager::CONFIGURATION_TYPE_FRAMEWORK + ); + } public function initializeArguments(): void { @@ -51,18 +53,14 @@ public function initializeArguments(): void } /** - * render - * - * @return array + * @return array */ - public function render() + public function render(): array { $class = $this->arguments['class']; $table = $this->arguments['table']; $data = $this->arguments['data']; - $this->getConfiguration(); - if (isset($this->configuration['persistence']['classes'][$class]['mapping']) && $this->configuration['persistence']['classes'][$class]['mapping']['tableName'] == $table ) { @@ -85,14 +83,4 @@ public function render() } return $data; } - - protected function getConfiguration() - { - $this->configurationManager = GeneralUtility::makeInstance( - ConfigurationManager::class - ); - $this->configuration = $this->configurationManager->getConfiguration( - ConfigurationManager::CONFIGURATION_TYPE_FRAMEWORK - ); - } } diff --git a/Classes/ViewHelpers/MetaTagViewHelper.php b/Classes/ViewHelpers/MetaTagViewHelper.php index b6dd1103..01c91e6e 100644 --- a/Classes/ViewHelpers/MetaTagViewHelper.php +++ b/Classes/ViewHelpers/MetaTagViewHelper.php @@ -26,10 +26,7 @@ */ class MetaTagViewHelper extends AbstractViewHelper { - /** - * @var string - */ - protected $tagName = 'meta'; + protected string $tagName = 'meta'; public function initializeArguments(): void {