Skip to content

Replace obsolete "$this" with "$block" in shipment inventory template. #1409

@nmalevanec

Description

@nmalevanec

Preconditions

  1. Magento with MSI

Steps to reproduce

  1. Observe https://github.com/magento-engcom/msi/blob/14f70cd6393c62b0a821cd7d77bff5673871eb01/app/code/Magento/InventoryShippingAdminUi/view/adminhtml/templates/shipment/inventory.phtml#L19-L22

Expected result

  1. As access to members and methods of Block class through $this is obsolete in phtml templates, on line 21 should be ...$block->getSourceName($sourceCode)...

Actual result

  1. On line 21 used $this->getSourceName($sourceCode)

Data set: app/code/Magento/InventoryShippingAdminUi/view/adminhtml/templates/shipment/inventory.phtml
Access to members and methods of Block class through $this is obsolete in phtml templates. Use only $block instead of $this.
Failed asserting that '<?php\n

/**\n
 * Copyright © Magento, Inc. All rights reserved.\n
 * See COPYING.txt for license details.\n
 */\n
\n
// @codingStandardsIgnoreFile\n
\n
/** @var \Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment\Inventory $block */\n
\n
$sourceCode = $block->getSourceCode();\n
?>\n
\n
<?php if ($sourceCode): ?>\n
<section class="admin__page-section inventory">\n
    <div class="admin__page-section-title">\n
        <span class="title"><?= $block->escapeHtml(__('Inventory')) ?></span>\n
    </div>\n
    <div class="admin__page-section-content">\n
        <?= $block->escapeHtml(__('Source:')) ?>\n
        <?= $block->escapeHtml($this->getSourceName($sourceCode)) ?>\n
    </div>\n
</section>\n
<input name="sourceCode" type="hidden" value="<?= /* @escapeNotVerified */ $sourceCode ?>">\n
<?php endif; ?>\n

' does not match PCRE pattern "/this->(?!helper)\S*/iS".
/var/www/html/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php:26
/var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:56
/var/www/html/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php:29

/var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:115
/var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:70
/var/www/html/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php:29

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions