Skip to content

Commit 649ce83

Browse files
committed
Merge remote-tracking branch 'anzin/fix-deprecation-integration-part-3' into ph-delivery
2 parents 139bffd + 5e22c9d commit 649ce83

File tree

11 files changed

+35
-30
lines changed

11 files changed

+35
-30
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ script;
303303
script;
304304
endif;
305305

306-
if (strpos($block->getRowClickCallback(), 'order.') !== false):
306+
if ($block->getRowClickCallback() && strpos($block->getRowClickCallback(), 'order.') !== false):
307307
$scriptString .= <<<script
308308
309309
deps.push('Magento_Sales/order/create/form')

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ $_helper = $block->getData('outputHelper');
8787
data-product-sku="<?= $escaper->escapeHtml($_product->getSku()) ?>"
8888
action="<?= $escaper->escapeUrl($postParams['action']) ?>"
8989
method="post">
90-
<?php $optionsData = $block->getData('viewModel')->getOptionsData($_product); ?>
91-
<?php foreach ($optionsData as $optionItem): ?>
90+
<?php $options = $block->getData('viewModel')->getOptionsData($_product); ?>
91+
<?php foreach ($options as $optionItem): ?>
9292
<input type="hidden"
9393
name="<?= $escaper->escapeHtml($optionItem['name']) ?>"
9494
value="<?= $escaper->escapeHtml($optionItem['value']) ?>">
@@ -119,7 +119,7 @@ $_helper = $block->getData('outputHelper');
119119
<?php endif; ?>
120120
<?php endif; ?>
121121
</div>
122-
<?= strpos($pos, $viewMode . '-primary') ?
122+
<?= ($pos && strpos($pos, $viewMode . '-primary')) ?
123123
/* @noEscape */ $secureRenderer->renderStyleAsTag(
124124
$position,
125125
'product-item-info_' . $_product->getId() . ' div.actions-primary'
@@ -129,7 +129,7 @@ $_helper = $block->getData('outputHelper');
129129
<?= $addToBlock->setProduct($_product)->getChildHtml() ?>
130130
<?php endif; ?>
131131
</div>
132-
<?= strpos($pos, $viewMode . '-secondary') ?
132+
<?= ($pos && strpos($pos, $viewMode . '-secondary')) ?
133133
/* @noEscape */ $secureRenderer->renderStyleAsTag(
134134
$position,
135135
'product-item-info_' . $_product->getId() . ' div.actions-secondary'
@@ -150,7 +150,7 @@ $_helper = $block->getData('outputHelper');
150150
</div>
151151
</div>
152152
</div>
153-
<?= strpos($pos, $viewMode . '-actions') ?
153+
<?= ($pos && strpos($pos, $viewMode . '-actions')) ?
154154
/* @noEscape */ $secureRenderer->renderStyleAsTag(
155155
$position,
156156
'product-item-info_' . $_product->getId() . ' div.product-item-actions'
@@ -160,6 +160,7 @@ $_helper = $block->getData('outputHelper');
160160
</ol>
161161
</div>
162162
<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>
163+
<?php // phpcs:ignore Magento2.Legacy.PhtmlTemplate ?>
163164
<script type="text/x-magento-init">
164165
{
165166
"[data-role=tocart-form], .form.map.checkout": {

app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getTreeLoaderUrl()
115115

116116
$currentTreePath = $this->getRequest()->getParam('current_tree_path');
117117

118-
if (strlen($currentTreePath)) {
118+
if ($currentTreePath !== null && strlen($currentTreePath)) {
119119
$params['current_tree_path'] = $currentTreePath;
120120
}
121121

@@ -138,7 +138,7 @@ public function getRootNodeName()
138138
/**
139139
* Return tree node full path based on current path
140140
*
141-
* @return string
141+
* @return string[]
142142
*/
143143
public function getTreeCurrentPath()
144144
{
@@ -150,7 +150,7 @@ public function getTreeCurrentPath()
150150
$path = $this->_coreRegistry->registry('storage')->getSession()->getCurrentPath();
151151
}
152152

153-
if (strlen($path)) {
153+
if ($path) {
154154
$path = str_replace($this->_cmsWysiwygImages->getStorageRoot(), '', $path);
155155
$relative = [];
156156
foreach (explode('/', $path) as $dirName) {

app/code/Magento/Cron/Model/Schedule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function trySchedule()
129129
return false;
130130
}
131131
$configTimeZone = $this->timezoneConverter->getConfigTimezone();
132-
$storeDateTime = $this->dateTimeFactory->create(null, new \DateTimeZone($configTimeZone));
132+
$storeDateTime = $this->dateTimeFactory->create('now', new \DateTimeZone($configTimeZone));
133133
if (!is_numeric($time)) {
134134
//convert time from UTC to admin store timezone
135135
//we assume that all schedules in configuration (crontab.xml and DB tables) are in admin store timezone

app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Name.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public function render(\Magento\Framework\DataObject $row)
3636
*/
3737
protected function isUrlSecure($url)
3838
{
39-
return (strpos($url, 'http:') !== 0);
39+
return (is_string($url) && strpos($url, 'http:') !== 0);
4040
}
4141
}

app/code/Magento/Tax/Model/Calculation/Rate.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\Api\AttributeValueFactory;
1111
use Magento\Framework\Exception\CouldNotDeleteException;
1212
use Magento\Tax\Api\Data\TaxRateInterface;
13+
use Magento\Tax\Api\Data\TaxRateTitleInterface;
1314

1415
/**
1516
* Tax Rate Model
@@ -18,7 +19,7 @@
1819
*/
1920
class Rate extends \Magento\Framework\Model\AbstractExtensibleModel implements TaxRateInterface
2021
{
21-
/**
22+
/**#@+
2223
* Constants defined for keys of array, makes typos less likely
2324
*/
2425
public const KEY_ID = 'id';
@@ -32,9 +33,10 @@ class Rate extends \Magento\Framework\Model\AbstractExtensibleModel implements T
3233
public const KEY_PERCENTAGE_RATE = 'rate';
3334
public const KEY_CODE = 'code';
3435
public const KEY_TITLES = 'titles';
36+
/**#@-*/
3537

3638
/**
37-
* @var null
39+
* @var TaxRateTitleInterface[]
3840
*/
3941
protected $_titles = null;
4042

@@ -213,7 +215,9 @@ public function beforeDelete()
213215
}
214216

215217
/**
216-
* After rate delete redeclared for dispatch tax_settings_change_after event
218+
* After rate delete
219+
*
220+
* Redeclared for dispatch tax_settings_change_after event
217221
*
218222
* @return \Magento\Tax\Model\Calculation\Rate
219223
*/
@@ -327,10 +331,8 @@ public function getRegionName()
327331
}
328332

329333
/**
330-
* Get tax calculation rate id
331-
*
332-
* @codeCoverageIgnoreStart
333334
* @inheritdoc
335+
* @codeCoverageIgnoreStart
334336
*/
335337
public function getTaxCalculationRateId()
336338
{
@@ -503,7 +505,7 @@ public function setCode($code)
503505
/**
504506
* Set tax rate titles
505507
*
506-
* @param \Magento\Tax\Api\Data\TaxRateTitleInterface[] $titles
508+
* @param TaxRateTitleInterface[] $titles
507509
* @return $this
508510
*/
509511
public function setTitles(array $titles = null)

dev/tests/integration/testsuite/Magento/Paypal/Model/Api/NvpTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public function testCallRefundTransaction()
156156
[],
157157
$httpQuery
158158
);
159+
$this->httpClient->method('read')->willReturn('');
159160

160161
$this->nvpApi->callRefundTransaction();
161162
}

dev/tests/integration/testsuite/Magento/Security/Model/Plugin/AuthSessionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function testConsecutiveProcessProlong()
9595
);
9696
$adminSessionInfoId = $this->authSession->getAdminSessionInfoId();
9797
$prolongsDiff = log($this->securityConfig->getAdminSessionLifetime()) - 2; // X from comment above
98-
$dateInPast = $this->dateTime->formatDate($this->authSession->getUpdatedAt() - $prolongsDiff);
98+
$dateInPast = $this->dateTime->formatDate((int) ($this->authSession->getUpdatedAt() - $prolongsDiff));
9999
$this->adminSessionsManager->getCurrentSession()
100100
->setData(
101101
'updated_at',
@@ -127,7 +127,7 @@ public function testProcessProlong()
127127
);
128128
$adminSessionInfoId = $this->authSession->getAdminSessionInfoId();
129129
$prolongsDiff = 4 * log($this->securityConfig->getAdminSessionLifetime()) + 2; // X from comment above
130-
$dateInPast = $this->dateTime->formatDate($this->authSession->getUpdatedAt() - $prolongsDiff);
130+
$dateInPast = $this->dateTime->formatDate((int) ($this->authSession->getUpdatedAt() - $prolongsDiff));
131131
$this->adminSessionsManager->getCurrentSession()
132132
->setData(
133133
'updated_at',
@@ -171,7 +171,7 @@ public function testProcessProlongWithExpiredUser()
171171
// need to trigger a prolong
172172
$adminSessionInfoId = $this->authSession->getAdminSessionInfoId();
173173
$prolongsDiff = 4 * log($this->securityConfig->getAdminSessionLifetime()) + 2;
174-
$dateInPast = $this->dateTime->formatDate($this->authSession->getUpdatedAt() - $prolongsDiff);
174+
$dateInPast = $this->dateTime->formatDate((int) ($this->authSession->getUpdatedAt() - $prolongsDiff));
175175
$this->adminSessionsManager->getCurrentSession()
176176
->setData(
177177
'updated_at',

lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ public function formatDate($date = null, $format = \IntlDateFormatter::SHORT, $s
239239
{
240240
$formatTime = $showTime ? $format : \IntlDateFormatter::NONE;
241241

242-
if (!($date instanceof \DateTimeInterface)) {
243-
$date = new \DateTime($date);
242+
if (!$date instanceof \DateTimeInterface) {
243+
/** @phpstan-ignore-next-line */
244+
$date = new \DateTime($date ?? 'now');
244245
}
245246

246247
return $this->formatDateTime($date, $format, $formatTime);

setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
122122
}
123123

124124
$totalEndTime = microtime(true);
125-
$totalResultTime = $totalEndTime - $totalStartTime;
126-
125+
$totalResultTime = (int) ($totalEndTime - $totalStartTime);
127126
$output->writeln('<info>Total execution time: ' . gmdate('H:i:s', $totalResultTime) . '</info>');
128127
} catch (\Exception $e) {
129128
$output->writeln('<error>' . $e->getMessage() . '</error>');

0 commit comments

Comments
 (0)