From 1c1080923b45fa3208c81f1964415ea7c40fc350 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 17 Jan 2024 15:36:43 +0100 Subject: [PATCH] [Changed] phpStan - set level to 3, clean files by level --- .../Controller/BasketController.php | 18 +++++++----------- .../Controller/ThankYouController.php | 5 ++++- Modules/Application/Model/Basket.php | 2 +- Modules/Core/ViewConfig.php | 4 +++- phpstan.neon | 11 ++++++++--- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Modules/Application/Controller/BasketController.php b/Modules/Application/Controller/BasketController.php index 8e0bdff..e3fecb8 100644 --- a/Modules/Application/Controller/BasketController.php +++ b/Modules/Application/Controller/BasketController.php @@ -11,7 +11,7 @@ use oxSystemComponentException; class BasketController extends BasketController_parent { /** - * @throws oxSystemComponentException + * @return string */ public function render() { @@ -33,22 +33,18 @@ class BasketController extends BasketController_parent $aProducts = Registry::getRequest()->getRequestEscapedParameter('aproducts'); // collecting specified item - $sProductId = $sProductId ?? Registry::getRequest()->getRequestEscapedParameter('aid'); + $sProductId = Registry::getRequest()->getRequestEscapedParameter('aid'); if ($sProductId) { // additionally fetching current product info - $dAmount = $dAmount ?? Registry::getRequest()->getRequestEscapedParameter('am'); + $dAmount = Registry::getRequest()->getRequestEscapedParameter('am'); // select lists - $aSel = $aSel ?? Registry::getRequest()->getRequestEscapedParameter('sel'); + $aSel = Registry::getRequest()->getRequestEscapedParameter('sel'); - // persistent parameters - if (empty($aPersParam)) { + /** @var BasketComponent $oBasketComponent */ + $oBasketComponent = $this->getComponent('oxcmp_basket'); - /** @var BasketComponent $oBasketComponent */ - $oBasketComponent = $this->getComponent('oxcmp_basket'); - - $aPersParam = $oBasketComponent->__call('getPersistedParameters', []); - } + $aPersParam = $oBasketComponent->__call('getPersistedParameters', []); $sBasketItemId = Registry::getRequest()->getRequestEscapedParameter('bindex'); diff --git a/Modules/Application/Controller/ThankYouController.php b/Modules/Application/Controller/ThankYouController.php index 215503a..dd90187 100644 --- a/Modules/Application/Controller/ThankYouController.php +++ b/Modules/Application/Controller/ThankYouController.php @@ -3,6 +3,7 @@ namespace D3\GoogleAnalytics4\Modules\Application\Controller; use OxidEsales\Eshop\Application\Model\Country; +use OxidEsales\Eshop\Application\Model\Order; class ThankYouController extends ThankYouController_parent { @@ -11,7 +12,9 @@ class ThankYouController extends ThankYouController_parent */ public function d3GAGetUserCountry() { - $sCountryId = $this->getOrder()->getFieldData('oxbillcountryid'); + /** @var Order $oOrder */ + $oOrder = $this->getOrder(); + $sCountryId = $oOrder->getFieldData('oxbillcountryid'); /** @var Country $oCountry */ $oCountry = oxNew(Country::class); diff --git a/Modules/Application/Model/Basket.php b/Modules/Application/Model/Basket.php index 9c7fa61..2cde7ef 100644 --- a/Modules/Application/Model/Basket.php +++ b/Modules/Application/Model/Basket.php @@ -7,7 +7,7 @@ use OxidEsales\Eshop\Application\Model\Payment; class Basket extends Basket_parent { /** - * @return void + * @return string */ public function getPaymentOnPaymentId() :string { diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index c3fb415..0bca35c 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -15,6 +15,7 @@ namespace D3\GoogleAnalytics4\Modules\Core; use D3\GoogleAnalytics4\Application\Model\ManagerHandler; use D3\GoogleAnalytics4\Application\Model\ManagerTypes; use OxidEsales\Eshop\Application\Controller\FrontendController; +use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Core\Config; use OxidEsales\Eshop\Core\Registry; class ViewConfig extends ViewConfig_parent @@ -160,7 +161,8 @@ class ViewConfig extends ViewConfig_parent $oConfig = Registry::getConfig(); $oView = $oConfig->getTopActiveView(); - /** @var FrontendController $oShop */ + + /** @var User $oUser */ $oUser = $oConfig->getUser(); $cl = $this->getTopActiveClassName(); diff --git a/phpstan.neon b/phpstan.neon index 7894103..9c42940 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,10 +1,15 @@ parameters: scanFiles: - IntelliSenseHelper.php - - ../../oxid-esales/oxideshop-ce/source/oxfunctions.php - - ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php + - ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales/oxideshop-ce/source/bootstrap.php + - ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales/oxideshop-ce/source/oxfunctions.php + - ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales/oxideshop-ce/source/overridablefunctions.php + scanDirectories: + - ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales + ignoreErrors: + - '#.*is not subtype of Throwable.*#' paths: - ./ - level: 0 + level: 3 phpVersion: 70200 checkMissingIterableValueType: false