Skip to content

Commit 42e7576

Browse files
authored
Merge pull request magento#4359 from magento-obsessive-owls/MC-16618
[Owls] Eliminate @escapeNotVerified in Sales-related Modules
2 parents b223107 + cfd13de commit 42e7576

File tree

129 files changed

+1782
-1914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1782
-1914
lines changed

app/code/Magento/AdminNotification/Model/Feed.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\AdminNotification\Model;
77

8+
use Magento\Framework\Escaper;
9+
use Magento\Framework\App\ObjectManager;
810
use Magento\Framework\Config\ConfigOptionsListConstants;
911

1012
/**
@@ -26,7 +28,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel
2628
const XML_LAST_UPDATE_PATH = 'system/adminnotification/last_update';
2729

2830
/**
29-
* @var \Magento\Framework\Escaper
31+
* @var Escaper
3032
*/
3133
private $escaper;
3234

@@ -82,7 +84,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel
8284
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
8385
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
8486
* @param array $data
85-
* @param \Magento\Framework\Escaper|null $escaper
87+
* @param Escaper|null $escaper
8688
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8789
*/
8890
public function __construct(
@@ -97,7 +99,7 @@ public function __construct(
9799
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
98100
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
99101
array $data = [],
100-
\Magento\Framework\Escaper $escaper = null
102+
Escaper $escaper = null
101103
) {
102104
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
103105
$this->_backendConfig = $backendConfig;
@@ -106,8 +108,8 @@ public function __construct(
106108
$this->_deploymentConfig = $deploymentConfig;
107109
$this->productMetadata = $productMetadata;
108110
$this->urlBuilder = $urlBuilder;
109-
$this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
110-
\Magento\Framework\Escaper::class
111+
$this->escaper = $escaper ?? ObjectManager::getInstance()->get(
112+
Escaper::class
111113
);
112114
}
113115

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
*/
1313
namespace Magento\Catalog\Block\Adminhtml\Product;
1414

15+
use Magento\Framework\Escaper;
16+
1517
/**
1618
* Class Edit
1719
*/
1820
class Edit extends \Magento\Backend\Block\Widget
1921
{
2022
/**
21-
* @var \Magento\Framework\Escaper
23+
* @var Escaper
2224
*/
2325
private $escaper;
2426

@@ -55,7 +57,7 @@ class Edit extends \Magento\Backend\Block\Widget
5557
* @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory
5658
* @param \Magento\Framework\Registry $registry
5759
* @param \Magento\Catalog\Helper\Product $productHelper
58-
* @param \Magento\Framework\Escaper $escaper
60+
* @param Escaper $escaper
5961
* @param array $data
6062
*/
6163
public function __construct(
@@ -64,7 +66,7 @@ public function __construct(
6466
\Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory,
6567
\Magento\Framework\Registry $registry,
6668
\Magento\Catalog\Helper\Product $productHelper,
67-
\Magento\Framework\Escaper $escaper,
69+
Escaper $escaper,
6870
array $data = []
6971
) {
7072
$this->_productHelper = $productHelper;

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<testCaseId value="MC-14715"/>
1616
<severity value="CRITICAL"/>
1717
<group value="mtf_migrated"/>
18+
<skip>
19+
<issueId value="MC-16684"/>
20+
</skip>
1821
</annotations>
1922

2023
<before>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<testCaseId value="MC-14719"/>
1616
<severity value="CRITICAL"/>
1717
<group value="mtf_migrated"/>
18+
<skip>
19+
<issueId value="MC-16684"/>
20+
</skip>
1821
</annotations>
1922

2023
<before>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<testCaseId value="MC-14716"/>
1616
<severity value="CRITICAL"/>
1717
<group value="mtf_migrated"/>
18+
<skip>
19+
<issueId value="MC-16684"/>
20+
</skip>
1821
</annotations>
1922

2023
<before>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<testCaseId value="MC-14728"/>
1616
<severity value="CRITICAL"/>
1717
<group value="mtf_migrated"/>
18+
<skip>
19+
<issueId value="MC-16684"/>
20+
</skip>
1821
</annotations>
1922

2023
<before>

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
*/
66
namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer;
77

8+
use Magento\Framework\Escaper;
9+
use Magento\Framework\App\ObjectManager;
10+
811
/**
912
* Adminhtml newsletter queue grid block action item renderer
1013
*/
1114
class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
1215
{
1316
/**
14-
* @var \Magento\Framework\Escaper
17+
* @var Escaper
1518
*/
1619
private $escaper;
1720

@@ -26,17 +29,17 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstract
2629
* @param \Magento\Backend\Block\Context $context
2730
* @param \Magento\Framework\Registry $registry
2831
* @param array $data
29-
* @param \Magento\Framework\Escaper|null $escaper
32+
* @param Escaper|null $escaper
3033
*/
3134
public function __construct(
3235
\Magento\Backend\Block\Context $context,
3336
\Magento\Framework\Registry $registry,
3437
array $data = [],
35-
\Magento\Framework\Escaper $escaper = null
38+
Escaper $escaper = null
3639
) {
3740
$this->_coreRegistry = $registry;
38-
$this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
39-
\Magento\Framework\Escaper::class
41+
$this->escaper = $escaper ?? ObjectManager::getInstance()->get(
42+
Escaper::class
4043
);
4144
parent::__construct($context, $data);
4245
}

app/code/Magento/Customer/Model/Address/Validator/Country.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Customer\Model\Address\ValidatorInterface;
1010
use Magento\Directory\Helper\Data;
1111
use Magento\Directory\Model\AllowedCountries;
12+
use Magento\Framework\Escaper;
13+
use Magento\Framework\App\ObjectManager;
1214
use Magento\Store\Model\ScopeInterface;
1315

1416
/**
@@ -17,7 +19,7 @@
1719
class Country implements ValidatorInterface
1820
{
1921
/**
20-
* @var \Magento\Framework\Escaper
22+
* @var Escaper
2123
*/
2224
private $escaper;
2325

@@ -34,17 +36,17 @@ class Country implements ValidatorInterface
3436
/**
3537
* @param Data $directoryData
3638
* @param AllowedCountries $allowedCountriesReader
37-
* @param \Magento\Framework\Escaper|null $escaper
39+
* @param Escaper|null $escaper
3840
*/
3941
public function __construct(
4042
Data $directoryData,
4143
AllowedCountries $allowedCountriesReader,
42-
\Magento\Framework\Escaper $escaper = null
44+
Escaper $escaper = null
4345
) {
4446
$this->directoryData = $directoryData;
4547
$this->allowedCountriesReader = $allowedCountriesReader;
46-
$this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
47-
\Magento\Framework\Escaper::class
48+
$this->escaper = $escaper ?? ObjectManager::getInstance()->get(
49+
Escaper::class
4850
);
4951
}
5052

app/code/Magento/Directory/Model/ResourceModel/Country.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
*/
66
namespace Magento\Directory\Model\ResourceModel;
77

8+
use Magento\Framework\Model\ResourceModel\Db\Context;
9+
use Magento\Framework\Escaper;
10+
use Magento\Framework\App\ObjectManager;
11+
812
/**
913
* Country Resource Model
1014
*
@@ -14,22 +18,22 @@
1418
class Country extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1519
{
1620
/**
17-
* @var \Magento\Framework\Escaper
21+
* @var Escaper
1822
*/
1923
private $escaper;
2024

2125
/**
22-
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
26+
* @param Context $context
2327
* @param null|string $connectionName
24-
* @param \Magento\Framework\Escaper|null $escaper
28+
* @param Escaper|null $escaper
2529
*/
2630
public function __construct(
27-
\Magento\Framework\Model\ResourceModel\Db\Context $context,
31+
Context $context,
2832
?string $connectionName = null,
29-
\Magento\Framework\Escaper $escaper = null
33+
Escaper $escaper = null
3034
) {
31-
$this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
32-
\Magento\Framework\Escaper::class
35+
$this->escaper = $escaper ?? ObjectManager::getInstance()->get(
36+
Escaper::class
3337
);
3438
parent::__construct($context, $connectionName);
3539
}

app/code/Magento/Reports/Block/Adminhtml/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid
9292
* @param Data $backendHelper
9393
* @param array $data
9494
* @param DecoderInterface|null $urlDecoder
95-
* @param Parameters $parameters
95+
* @param Parameters|null $parameters
9696
*/
9797
public function __construct(
9898
Context $context,

app/code/Magento/Sales/view/adminhtml/templates/items/column/name.phtml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,32 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
7+
// phpcs:disable Magento2.Templates.ThisInTemplate
98
?>
109
<?php
11-
/**
12-
* @see \Magento\Sales\Block\Adminhtml\Items\Column\Name
13-
*/
10+
/* @var $block \Magento\Sales\Block\Adminhtml\Items\Column\Name */
1411
?>
15-
16-
<?php if ($_item = $block->getItem()): ?>
17-
<div id="order_item_<?= $block->escapeHtml($_item->getId()) ?>_title"
12+
<?php if ($_item = $block->getItem()) : ?>
13+
<div id="order_item_<?= (int) $_item->getId() ?>_title"
1814
class="product-title">
1915
<?= $block->escapeHtml($_item->getName()) ?>
2016
</div>
2117
<div class="product-sku-block">
22-
<span><?= $block->escapeHtml(__('SKU'))?>:</span> <?= implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($block->getSku()))) ?>
18+
<span><?= $block->escapeHtml(__('SKU'))?>:</span> <?= /* @noEscape */ implode('<br />', $this->helper(\Magento\Catalog\Helper\Data::class)->splitSku($block->escapeHtml($block->getSku()))) ?>
2319
</div>
2420

25-
<?php if ($block->getOrderOptions()): ?>
21+
<?php if ($block->getOrderOptions()) : ?>
2622
<dl class="item-options">
27-
<?php foreach ($block->getOrderOptions() as $_option): ?>
23+
<?php foreach ($block->getOrderOptions() as $_option) : ?>
2824
<dt><?= $block->escapeHtml($_option['label']) ?>:</dt>
2925
<dd>
30-
<?php if (isset($_option['custom_view']) && $_option['custom_view']): ?>
31-
<?= /* @escapeNotVerified */ $block->getCustomizedOptionValue($_option) ?>
32-
<?php else: ?>
26+
<?php if (isset($_option['custom_view']) && $_option['custom_view']) : ?>
27+
<?= /* @noEscape */ $block->getCustomizedOptionValue($_option) ?>
28+
<?php else : ?>
3329
<?php $_option = $block->getFormattedOption($_option['value']); ?>
3430
<?php $dots = 'dots' . uniqid(); ?>
35-
<?= $block->escapeHtml($_option['value']) ?><?php if (isset($_option['remainder']) && $_option['remainder']): ?> <span id="<?= /* @noEscape */ $dots; ?>"> ...</span>
36-
<?php $id = 'id' . uniqid(); ?>
31+
<?= $block->escapeHtml($_option['value']) ?><?php if (isset($_option['remainder']) && $_option['remainder']) : ?> <span id="<?= /* @noEscape */ $dots; ?>"> ...</span>
32+
<?php $id = 'id' . uniqid(); ?>
3733
<span id="<?= /* @noEscape */ $id; ?>"><?= $block->escapeHtml($_option['remainder']) ?></span>
3834
<script>
3935
require(['prototype'], function() {

app/code/Magento/Sales/view/adminhtml/templates/items/column/qty.phtml

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,41 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
10-
<?php if ($item = $block->getItem()): ?>
11-
<table class="qty-table">
12-
<tr>
13-
<th><?= $block->escapeHtml(__('Ordered')); ?></th>
14-
<td><?= /* @noEscape */ $item->getQtyOrdered()*1 ?></td>
15-
</tr>
16-
17-
<?php if ((float) $item->getQtyInvoiced()): ?>
7+
<?php if ($item = $block->getItem()) : ?>
8+
<table class="qty-table">
189
<tr>
19-
<th><?= $block->escapeHtml(__('Invoiced')); ?></th>
20-
<td><?= /* @noEscape */ $item->getQtyInvoiced()*1 ?></td>
10+
<th><?= $block->escapeHtml(__('Ordered')); ?></th>
11+
<td><?= (int) $item->getQtyOrdered() ?></td>
2112
</tr>
22-
<?php endif; ?>
2313

24-
<?php if ((float) $item->getQtyShipped()): ?>
25-
<tr>
26-
<th><?= $block->escapeHtml(__('Shipped')); ?></th>
27-
<td><?= /* @noEscape */ $item->getQtyShipped()*1 ?></td>
28-
</tr>
29-
<?php endif; ?>
14+
<?php if ((float)$item->getQtyInvoiced()) : ?>
15+
<tr>
16+
<th><?= $block->escapeHtml(__('Invoiced')); ?></th>
17+
<td><?= (int) $item->getQtyInvoiced() ?></td>
18+
</tr>
19+
<?php endif; ?>
3020

31-
<?php if ((float) $item->getQtyRefunded()): ?>
32-
<tr>
33-
<th><?= $block->escapeHtml(__('Refunded')); ?></th>
34-
<td><?= /* @noEscape */ $item->getQtyRefunded()*1 ?></td>
35-
</tr>
36-
<?php endif; ?>
21+
<?php if ((float)$item->getQtyShipped()) : ?>
22+
<tr>
23+
<th><?= $block->escapeHtml(__('Shipped')); ?></th>
24+
<td><?= (int) $item->getQtyShipped() ?></td>
25+
</tr>
26+
<?php endif; ?>
3727

38-
<?php if ((float) $item->getQtyCanceled()): ?>
39-
<tr>
40-
<th><?= $block->escapeHtml(__('Canceled')); ?></th>
41-
<td><?= /* @noEscape */ $item->getQtyCanceled()*1 ?></td>
42-
</tr>
43-
<?php endif; ?>
28+
<?php if ((float)$item->getQtyRefunded()) : ?>
29+
<tr>
30+
<th><?= $block->escapeHtml(__('Refunded')); ?></th>
31+
<td><?= (int) $item->getQtyRefunded() ?></td>
32+
</tr>
33+
<?php endif; ?>
34+
35+
<?php if ((float)$item->getQtyCanceled()) : ?>
36+
<tr>
37+
<th><?= $block->escapeHtml(__('Canceled')); ?></th>
38+
<td><?= (int) $item->getQtyCanceled() ?></td>
39+
</tr>
40+
<?php endif; ?>
4441

45-
</table>
42+
</table>
4643
<?php endif; ?>

app/code/Magento/Sales/view/adminhtml/templates/items/price/row.phtml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php
118
/** @var \Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn $block */
12-
139
$_item = $block->getItem();
1410
?>
15-
1611
<div class="price-excl-tax">
17-
<?= /* @escapeNotVerified */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
12+
<?= /* @noEscape */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
1813
</div>

0 commit comments

Comments
 (0)