apply static code analysis fixes
Cette révision appartient à :
Parent
817f9e68a2
révision
8590fac16d
@ -38,7 +38,8 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"php": "^7.4",
|
||||
"friendsofphp/php-cs-fixer": "^3.9"
|
||||
"friendsofphp/php-cs-fixer": "^3.9",
|
||||
"phpstan/phpstan": "^1.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
14
phpstan.neon
Fichier normal
14
phpstan.neon
Fichier normal
@ -0,0 +1,14 @@
|
||||
parameters:
|
||||
scanFiles:
|
||||
- src/IntelliSenseHelper.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php
|
||||
- ../../d3/ordermanager/src/IntelliSenseHelper.php
|
||||
paths:
|
||||
- src
|
||||
level: 6
|
||||
phpVersion: 70300
|
||||
checkMissingIterableValueType: false
|
||||
ignoreErrors:
|
||||
- '#d3linkmobility_ordermanager_action::startAction\(\) has no return type specified#'
|
||||
- '#d3linkmobility_ordermanager_action::\$sTplName has no type specified#'
|
@ -39,7 +39,7 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||
{
|
||||
public $sTplName = 'd3linkmobility_ordermanager_action.tpl';
|
||||
public const ACTIVE_SWITCH = 'blActionLinkmobility_status';
|
||||
public $sTitleIdent = 'D3_LINKMOBILITY_ORDERMANAGER_ACTION';
|
||||
public string $sTitleIdent = 'D3_LINKMOBILITY_ORDERMANAGER_ACTION';
|
||||
|
||||
public const SOURCE_TEMPLATE = 'template';
|
||||
public const SOURCE_CMS = 'cms';
|
||||
@ -98,12 +98,9 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||
/** @var Language $oLang */
|
||||
$oLang = oxNew(Language::class);
|
||||
|
||||
$this->getManager()->getRemarkHandler()->addNote(
|
||||
sprintf(
|
||||
$oLang->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE', null, true),
|
||||
$this->getRecipientDescription()
|
||||
)
|
||||
);
|
||||
/** @var string $format */
|
||||
$format = $oLang->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE', null, true);
|
||||
$this->getManager()->getRemarkHandler()->addNote(sprintf($format, $this->getRecipientDescription()));
|
||||
|
||||
$this->startExecution();
|
||||
|
||||
@ -238,8 +235,9 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
* @return void
|
||||
*/
|
||||
public function startExecution()
|
||||
public function startExecution(): void
|
||||
{
|
||||
try {
|
||||
if ($this->canExecuteMethod() && $this->hasRequiredValues()) {
|
||||
@ -247,18 +245,18 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
|
||||
}
|
||||
} catch (emptyMesageException $e) {
|
||||
Registry::getLogger()->error($e->getMessage());
|
||||
$this->getManager()->getRemarkHandler()->addNote(
|
||||
Registry::getLang()->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_EMPTYMESSAGE', null, true)
|
||||
);
|
||||
/** @var string $note */
|
||||
$note = Registry::getLang()->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_EMPTYMESSAGE', null, true);
|
||||
$this->getManager()->getRemarkHandler()->addNote($note);
|
||||
} catch (noRecipientFoundException $e) {
|
||||
Registry::getLogger()->info(
|
||||
$this->getManager()->getFieldData('oxtitle')." => ".
|
||||
$this->getItem()->getFieldData('oxordernr').": ".
|
||||
$e->getMessage()
|
||||
);
|
||||
$this->getManager()->getRemarkHandler()->addNote(
|
||||
Registry::getLang()->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_NORECIPIENT', null, true)
|
||||
);
|
||||
/** @var string $note */
|
||||
$note = Registry::getLang()->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_NORECIPIENT', null, true);
|
||||
$this->getManager()->getRemarkHandler()->addNote($note);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class d3linkmobility_ordermanager_sender
|
||||
->getTemplateRenderer();
|
||||
$templateEngine = $renderer->getTemplateEngine();
|
||||
|
||||
/** @var $oBasket Basket */
|
||||
/** @var Basket $oBasket */
|
||||
$oBasket = $oManager->getCurrentItem()->d3getOrderBasket4OrderManager($oManager);
|
||||
|
||||
$oPayment = oxNew(Payment::class);
|
||||
@ -146,13 +146,19 @@ class d3linkmobility_ordermanager_sender
|
||||
{
|
||||
$iOrderLangId = $this->getManager()->getCurrentItem()->getFieldData('oxlang');
|
||||
$oLang = Registry::getLang();
|
||||
/** @var int $iCurrentTplLang */
|
||||
$iCurrentTplLang = $oLang->getTplLanguage();
|
||||
/** @var int $iCurrentBaseLang */
|
||||
$iCurrentBaseLang = $oLang->getBaseLanguage();
|
||||
$oLang->setTplLanguage($iOrderLangId);
|
||||
$oLang->setBaseLanguage($iOrderLangId);
|
||||
$content = '';
|
||||
|
||||
/** @var int $iCurrentCurrency */
|
||||
$iCurrentCurrency = Registry::getConfig()->getShopCurrency();
|
||||
$iOrderCurr = $this->getManager()->getCurrentItem()->getOrderCurrency()->id;
|
||||
/** @var \stdClass $oOrderCurr */
|
||||
$oOrderCurr = $this->getManager()->getCurrentItem()->getOrderCurrency();
|
||||
$iOrderCurr = $oOrderCurr->id;
|
||||
Registry::getConfig()->setActShopCurrency($iOrderCurr);
|
||||
|
||||
set_error_handler(
|
||||
@ -173,7 +179,7 @@ class d3linkmobility_ordermanager_sender
|
||||
$content = $templateEngine->render($this->getManager()->getValue('sLinkMobilityMessageFromTemplatename'));
|
||||
}
|
||||
|
||||
if (false === is_string($content) || false === (bool) strlen($content)) {
|
||||
if (false === (bool) strlen($content)) {
|
||||
throw oxNew(emptyMesageException::class, 'message content is empty', $this->getManager()->getFieldData('oxtitle'));
|
||||
}
|
||||
|
||||
@ -220,9 +226,9 @@ class d3linkmobility_ordermanager_sender
|
||||
try {
|
||||
$recipients[] = (oxNew(OrderRecipients::class, $this->getItem()))->getSmsRecipient();
|
||||
} catch (noRecipientFoundException $e) {
|
||||
$this->getManager()->getRemarkHandler()->addNote(
|
||||
Registry::getLang()->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_NORECIPIENT', null, true)
|
||||
);
|
||||
/** @var string $note */
|
||||
$note = Registry::getLang()->translateString('D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_NORECIPIENT', null, true);
|
||||
$this->getManager()->getRemarkHandler()->addNote($note);
|
||||
}
|
||||
}
|
||||
if ((bool) $this->getManager()->getValue('blLinkMobilityMessageToCustom') &&
|
||||
@ -233,17 +239,13 @@ class d3linkmobility_ordermanager_sender
|
||||
$recipients[] = oxNew(Recipient::class, $phoneNumber, $countryId);
|
||||
} catch (RecipientException $e) {
|
||||
Registry::getLogger()->info($e->getMessage(), [$phoneNumber, $countryId]);
|
||||
$this->getManager()->getRemarkHandler()->addNote(
|
||||
sprintf(
|
||||
Registry::getLang()->translateString(
|
||||
'D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_RECIPIENTERROR',
|
||||
null,
|
||||
true
|
||||
),
|
||||
$phoneNumber,
|
||||
$countryId
|
||||
)
|
||||
/** @var string $format */
|
||||
$format = Registry::getLang()->translateString(
|
||||
'D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE_RECIPIENTERROR',
|
||||
null,
|
||||
true
|
||||
);
|
||||
$this->getManager()->getRemarkHandler()->addNote(sprintf($format, $phoneNumber, $countryId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Chargement…
Référencer dans un nouveau ticket
Block a user