Skip to content

Commit dfd621d

Browse files
committed
MC-16003: Escape translation strings.
Add strict_types and type hints.
1 parent a65175a commit dfd621d

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Backend\Block\Store;
89

@@ -581,14 +582,16 @@ public function getHintUrl()
581582
*
582583
* @return string
583584
*/
584-
public function getHintHtml()
585+
public function getHintHtml(): string
585586
{
586587
$html = '';
587588
$url = $this->getHintUrl();
588589
if ($url) {
589-
$html = '<div class="admin__field-tooltip tooltip">';
590-
$html .= '<a href="' . $this->escapeUrl($url) . '"' . ' onclick="this.target=\'_blank\'"' . ' title="' . $this->escapeHtmlAttr(__('What is this?'));
591-
$html .= '"' . 'class="admin__field-tooltip-action action-help"><span>' . $this->escapeHtmlAttr(__('What is this?')).'</span></a></span></div>';
590+
$html = '<div class="admin__field-tooltip tooltip"><a href="%s" onclick="this.target=\'_blank\'" title="%s"
591+
class="admin__field-tooltip-action action-help"><span>%s</span></a></span></div>';
592+
$title = $this->escapeHtmlAttr(__('What is this?'));
593+
$span= $this->escapeHtml(__('What is this?'));
594+
sprintf($html, $this->escapeUrl($url), $title, $span);
592595
}
593596
return $html;
594597
}

app/code/Magento/Customer/Block/Account/Dashboard/Address.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Customer\Block\Account\Dashboard;
79

810
use Magento\Customer\Api\Data\AddressInterface;

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View;
79

810
use Magento\Customer\Api\AccountManagementInterface;

app/code/Magento/Shipping/Block/Items.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
/**
89
* Sales order view items block
@@ -78,7 +79,7 @@ public function getPrintAllShipmentsUrl($order)
7879
* @param \Magento\Sales\Model\Order\Shipment $shipment
7980
* @return string
8081
*/
81-
public function getCommentsHtml($shipment)
82+
public function getCommentsHtml($shipment): string
8283
{
8384
$html = '';
8485
$comments = $this->getChildBlock('shipment_comments');

0 commit comments

Comments
 (0)