Skip to content

Code Quality Fix: Invalid @var usage #40137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ protected function _getConfigUrl()
) {
$output = $this->_urlBuilder->getUrl('adminhtml/system_config/edit', ['section' => 'web']);
} else {
/** @var $dataCollection \Magento\Config\Model\ResourceModel\Config\Data\Collection */
/** @var \Magento\Config\Model\ResourceModel\Config\Data\Collection $dataCollection */
$dataCollection = $this->_configValueFactory->create()->getCollection();
$dataCollection->addValueFilter(\Magento\Store\Model\Store::BASE_URL_PLACEHOLDER);

/** @var $data \Magento\Framework\App\Config\ValueInterface */
/** @var \Magento\Framework\App\Config\ValueInterface $data */
foreach ($dataCollection as $data) {
if ($data->getScope() == 'stores') {
$code = $this->_storeManager->getStore($data->getScopeId())->getCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private function _isFileAccessible()
{
$unsecureBaseURL = $this->_config->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default');

/** @var $http Curl */
/** @var Curl $http */
$http = $this->_curlFactory->create();
$http->setOptions(['timeout' => $this->_verificationTimeOut]);
$http->write(Request::METHOD_POST, $unsecureBaseURL . $this->_filePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
{
if ($this->_backendAuthSession->isLoggedIn()) {
$feedModel = $this->_feedFactory->create();
/* @var $feedModel \Magento\AdminNotification\Model\Feed */
/** @var \Magento\AdminNotification\Model\Feed $feedModel */
$feedModel->checkUpdate();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class="admin__action-dropdown-menu"
data-mark-as-read-url="<?= $escaper->escapeUrl($block->getUrl('adminhtml/notification/ajaxMarkAsRead')) ?>">
<?php foreach ($block->getLatestUnreadNotifications() as $notification): ?>
<?php /** @var $notification \Magento\AdminNotification\Model\Inbox */ ?>
<?php /** @var \Magento\AdminNotification\Model\Inbox $notification */ ?>
<li class="notifications-entry<?php if ($notification->getSeverity() == 1): ?> notifications-critical<?php endif; ?>"
data-notification-id="<?= $escaper->escapeHtmlAttr($notification->getId()) ?>"
data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public function execute()
}
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
/** @var $attrFilterBlock \Magento\ImportExport\Block\Adminhtml\Export\Filter */
/** @var \Magento\ImportExport\Block\Adminhtml\Export\Filter $attrFilterBlock */
$attrFilterBlock = $resultLayout->getLayout()->getBlock('export.filter');
/** @var $export \Magento\ImportExport\Model\Export */
/** @var \Magento\ImportExport\Model\Export $export */
$export = $this->_objectManager->create(\Magento\ImportExport\Model\Export::class);
$export->setData($data);
$attrFilterBlock->prepareCollection($this->filtersProvider->getFilters($export));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function saveRel(\Magento\Authorization\Model\Rules $rule)
/** Give basic admin permissions to any admin */
$postedResources[] = AbstractAction::ADMIN_RESOURCE;
$acl = $this->_aclBuilder->getAcl();
/** @var $resource \Magento\Framework\Acl\AclResource */
/** @var \Magento\Framework\Acl\AclResource $resource */
foreach ($acl->getResources() as $resourceId) {
$row['permission'] = in_array($resourceId, $postedResources) ? 'allow' : 'deny';
$row['resource_id'] = $resourceId;
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/App/AbstractAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ protected function getMessageManager()
*/
protected function _setActiveMenu($itemId)
{
/** @var $menuBlock \Magento\Backend\Block\Menu */
/** @var \Magento\Backend\Block\Menu $menuBlock */
$menuBlock = $this->_view->getLayout()->getBlock('menu');
$menuBlock->setActive($itemId);
$parents = $menuBlock->getMenuModel()->getParentItems($itemId);
foreach ($parents as $item) {
/** @var $item \Magento\Backend\Model\Menu\Item */
/** @var \Magento\Backend\Model\Menu\Item $item */
$this->_view->getPage()->getConfig()->getTitle()->prepend($item->getTitle());
}
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function _construct()
protected function _prepareCollection()
{
$collection = $this->_collectionFactory->create();
/* @var $collection \Magento\Reports\Model\ResourceModel\Order\Collection */
/** @var \Magento\Reports\Model\ResourceModel\Order\Collection $collection */
$collection->groupByCustomer()->addOrdersCount()->joinCustomerName();

$storeFilter = 0;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Dashboard/Totals.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function _prepareLayout()
$firstPeriod = array_key_first($this->period->getDatePeriods());
$period = $this->getRequest()->getParam('period', $firstPeriod);

/* @var $collection Collection */
/** @var Collection $collection */
$collection = $this->_collectionFactory->create()->addCreateAtPeriodFilter(
$period
)->calculateTotals(
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Backend/Block/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function renderMenu($menu, $level = 0)
{
$output = '<ul ' . (0 == $level ? 'id="nav" role="menubar"' : '') . ' >';

/** @var $menuItem \Magento\Backend\Model\Menu\Item */
/** @var \Magento\Backend\Model\Menu\Item $menuItem */
foreach ($this->_getMenuIterator($menu) as $menuItem) {
$output .= '<li ' . $this->_renderMouseEvent(
$menuItem
Expand Down Expand Up @@ -309,7 +309,7 @@ protected function _countItems($items)
{
$total = count($items);
foreach ($items as $item) {
/** @var $item \Magento\Backend\Model\Menu\Item */
/** @var \Magento\Backend\Model\Menu\Item $item */
if ($item->hasChildren()) {
$total += $this->_countItems($item->getChildren());
}
Expand Down Expand Up @@ -400,7 +400,7 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
$outputStart = '<ul ' . (0 == $level ? 'id="nav" role="menubar"' : 'role="menu"') . ' >';
$output = '';

/** @var $menuItem \Magento\Backend\Model\Menu\Item */
/** @var \Magento\Backend\Model\Menu\Item $menuItem */
foreach ($this->_getMenuIterator($menu) as $menuItem) {
$menuId = $menuItem->getId();
$itemName = substr($menuId, strrpos($menuId, '::') + 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
*/
public function getHintHtml()
{
/** @var $storeSwitcher \Magento\Backend\Block\Store\Switcher */
/** @var \Magento\Backend\Block\Store\Switcher $storeSwitcher */
$storeSwitcher = $this->_layout->getBlockSingleton(\Magento\Backend\Block\Store\Switcher::class);
return $storeSwitcher->getHintHtml();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
*/
public function getHintHtml()
{
/** @var $storeSwitcher \Magento\Backend\Block\Store\Switcher */
/** @var \Magento\Backend\Block\Store\Switcher $storeSwitcher */
$storeSwitcher = $this->_layout->getBlockSingleton(\Magento\Backend\Block\Store\Switcher::class);
return $storeSwitcher->getHintHtml();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function _prepareForm()
);
}

/** @var $label \Magento\Framework\View\Design\Theme\Label */
/** @var \Magento\Framework\View\Design\Theme\Label $label */
$label = $this->_labelFactory->create();
$options = $label->getLabelsCollection(__('-- Please Select --'));
$fieldset->addField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
$websiteModel->setData($postData['website']);
}
$fieldset = $form->addFieldset('website_fieldset', ['legend' => __('Web Site Information')]);
/* @var $fieldset \Magento\Framework\Data\Form */
/** @var \Magento\Framework\Data\Form $fieldset */

$fieldset->addField(
'website_name',
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Widget/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected function _setFieldset($attributes, $fieldset, $exclude = [])
{
$this->_addElementTypes($fieldset);
foreach ($attributes as $attribute) {
/* @var $attribute \Magento\Eav\Model\Entity\Attribute */
/** @var \Magento\Eav\Model\Entity\Attribute $attribute */
if (!$this->_isAttributeVisible($attribute)) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function addFieldMap($fieldId, $fieldName)
public function addFieldDependence($fieldName, $fieldNameFrom, $refField)
{
if (!is_object($refField)) {
/** @var $refField \Magento\Config\Model\Config\Structure\Element\Dependency\Field */
/** @var \Magento\Config\Model\Config\Structure\Element\Dependency\Field $refField */
$refField = $this->_fieldFactory->create(
['fieldData' => ['value' => (string)$refField], 'fieldPrefix' => '']
);
Expand Down Expand Up @@ -159,7 +159,7 @@ protected function _getDependsJson()
$result = [];
foreach ($this->_depends as $to => $row) {
foreach ($row as $from => $field) {
/** @var $field \Magento\Config\Model\Config\Structure\Element\Dependency\Field */
/** @var \Magento\Config\Model\Config\Structure\Element\Dependency\Field $field */
$result[$this->_fields[$to]][$this->_fields[$from]] = [
'values' => $field->getValues(),
'negative' => $field->isNegative(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getValue($index = null)
$datetimeTo = $value['to'];

//calculate end date considering timezone specification
/** @var $datetimeTo \DateTime */
/** @var \DateTime $datetimeTo */
$datetimeTo->setTimezone(
new \DateTimeZone(
$this->_scopeConfig->getValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getOptions()
{
$options = $this->getColumn()->getOptions();
if (empty($options) || !is_array($options)) {
/** @var $label \Magento\Framework\View\Design\Theme\Label */
/** @var \Magento\Framework\View\Design\Theme\Label $label */
$label = $this->_labelFactory->create();
$options = $label->getLabelsCollection();
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Widget/Grid/ColumnSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ public function updateItemByFirstMultiRow(\Magento\Framework\DataObject $item)
{
$multiRows = $this->getMultipleRows($item);
if (is_object($multiRows) && $multiRows instanceof \Magento\Framework\Data\Collection) {
/** @var $multiRows \Magento\Framework\Data\Collection */
/** @var \Magento\Framework\Data\Collection $multiRows */
$item->addData($multiRows->getFirstItem()->getData());
} elseif (is_array($multiRows)) {
$firstItem = $multiRows[0];
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Backend/Block/Widget/Grid/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ protected function _getExportTotals()
*/
public function _exportIterateCollection($callback, array $args)
{
/** @var $originalCollection \Magento\Framework\Data\Collection */
/** @var \Magento\Framework\Data\Collection $originalCollection */
$originalCollection = $this->getParentBlock()->getPreparedCollection();
$count = null;
$page = 1;
Expand Down Expand Up @@ -526,13 +526,13 @@ protected function _getRowCollection(?\Magento\Framework\Data\Collection $baseCo
}
$collection = $this->_collectionFactory->create();

/** @var $item \Magento\Framework\DataObject */
/** @var \Magento\Framework\DataObject $item */
foreach ($baseCollection as $item) {
if ($item->getIsEmpty()) {
continue;
}
if ($item->hasChildren() && count($item->getChildren()) > 0) {
/** @var $subItem \Magento\Framework\DataObject */
/** @var \Magento\Framework\DataObject $subItem */
foreach ($item->getChildren() as $subItem) {
$tmpItem = clone $item;
$tmpItem->unsChildren();
Expand All @@ -554,7 +554,7 @@ protected function _getRowCollection(?\Magento\Framework\Data\Collection $baseCo
*/
public function _getPreparedCollection()
{
/** @var $collection \Magento\Framework\Data\Collection */
/** @var \Magento\Framework\Data\Collection $collection */
$collection = $this->getParentBlock()->getPreparedCollection();
$collection->setPageSize(0);
$collection->load();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public function prepareMassactionColumn()
$gridBlock = $this->getParentBlock();
$massactionColumn->setSelected($this->getSelected())->setGrid($gridBlock)->setId($columnId);

/** @var $columnSetBlock ColumnSet */
/** @var ColumnSet $columnSetBlock */
$columnSetBlock = $gridBlock->getColumnSet();
$childNames = $columnSetBlock->getChildNames();
$siblingElement = count($childNames) ? current($childNames) : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FlushAll extends \Magento\Backend\Controller\Adminhtml\Cache implements Ht
public function execute()
{
$this->_eventManager->dispatch('adminhtml_cache_flush_all');
/** @var $cacheFrontend \Magento\Framework\Cache\FrontendInterface */
/** @var \Magento\Framework\Cache\FrontendInterface $cacheFrontend */
foreach ($this->_cacheFrontendPool as $cacheFrontend) {
$cacheFrontend->getBackend()->clean();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FlushSystem extends \Magento\Backend\Controller\Adminhtml\Cache implements
*/
public function execute()
{
/** @var $cacheFrontend \Magento\Framework\Cache\FrontendInterface */
/** @var \Magento\Framework\Cache\FrontendInterface $cacheFrontend */
foreach ($this->_cacheFrontendPool as $cacheFrontend) {
$cacheFrontend->clean();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function execute()
/** @var Raw $resultRaw */
$resultRaw = $this->resultRawFactory->create();
if ($gaData && $gaHash) {
/** @var $helper Data */
/** @var Data $helper */
$helper = $this->_objectManager->get(Data::class);
$newHash = $helper->getChartDataHash($gaData);
if (Security::compareStrings($newHash, $gaHash)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function execute()
$passwordConfirmation = (string)$this->getRequest()->getParam('password_confirmation');
$interfaceLocale = (string)$this->getRequest()->getParam('interface_locale', false);

/** @var $user \Magento\User\Model\User */
/** @var \Magento\User\Model\User $user */
$user = $this->_objectManager->create(\Magento\User\Model\User::class)->load($userId);

$user->setId($userId)
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Cron/CleanCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
*/
public function execute()
{
/** @var $cacheFrontend \Magento\Framework\Cache\FrontendInterface */
/** @var \Magento\Framework\Cache\FrontendInterface $cacheFrontend */
foreach ($this->cacheFrontendPool as $cacheFrontend) {
// Magento cache frontend does not support the 'old' cleaning mode, that's why backend is used directly
$cacheFrontend->getBackend()->clean(\Zend_Cache::CLEANING_MODE_OLD);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Menu/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function processCommand(\Magento\Backend\Model\Menu\Builder\AbstractComma
*/
public function getResult(\Magento\Backend\Model\Menu $menu)
{
/** @var $items \Magento\Backend\Model\Menu\Item[] */
/** @var \Magento\Backend\Model\Menu\Item[] $items */
$params = [];
$items = [];

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Model/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function getStartupPageUrl()
*/
public function findFirstAvailableMenu()
{
/* @var $menu \Magento\Backend\Model\Menu\Item */
/** @var \Magento\Backend\Model\Menu\Item $menu */
$menu = $this->_getMenu();
$item = $menu->getFirstAvailable();
$action = $item ? $item->getAction() : null;
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/Model/View/Result/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class Page extends View\Result\Page
*/
public function setActiveMenu($itemId)
{
/** @var $menuBlock \Magento\Backend\Block\Menu */
/** @var \Magento\Backend\Block\Menu $menuBlock */
$menuBlock = $this->layout->getBlock('menu');
$menuBlock->setActive($itemId);
$parents = $menuBlock->getMenuModel()->getParentItems($itemId);
foreach ($parents as $item) {
/** @var $item \Magento\Backend\Model\Menu\Item */
/** @var \Magento\Backend\Model\Menu\Item $item */
$this->getConfig()->getTitle()->prepend($item->getTitle());
}
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* All Rights Reserved.
*/
?>
<?php /** @var $block \Magento\Backend\Block\Page */ ?>
<?php /** @var \Magento\Backend\Block\Page $block */ ?>
<!doctype html>
<html lang="<?= $block->escapeHtmlAttr($block->getLang()) ?>" class="no-js">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

// phpcs:disable PHPCompatibility.Miscellaneous.RemovedAlternativePHPTags.MaybeASPOpenTagFound
/** @var $block \Magento\Backend\Block\Media\Uploader */
/** @var \Magento\Backend\Block\Media\Uploader $block */
/** @var \Magento\Framework\Escaper $escaper */
?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* All Rights Reserved.
*/

/** @var $block \Magento\Backend\Block\Page\Header */
/** @var \Magento\Backend\Block\Page\Header $block */
$part = $block->getShowPart();
?>
<?php if ($part === 'logo') : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
*/
?>

<?php /** @var $block \Magento\Framework\View\Element\Js\Components */ ?>
<?php /** @var \Magento\Framework\View\Element\Js\Components $block */ ?>
<?= $block->getChildHtml() ?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* All Rights Reserved.
*/

/* @var $block \Magento\Backend\Block\Store\Switcher */
/** @var \Magento\Backend\Block\Store\Switcher $block */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<?php if ($websites = $block->getWebsites()): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
?>
<?php
/* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */
/** @var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element $block */
$element = $block->getElement();
$note = $element->getNote() ? '<div class="note">' . $element->getNote() . '</div>' : '';
$elementBeforeLabel = $element->getExtType() == 'checkbox' || $element->getExtType() == 'radio';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Magento\Backend\Block\GlobalSearch;
use Magento\Framework\Json\Helper\Data;

/** @var $block GlobalSearch */
/** @var GlobalSearch $block */
/** @var Data $helper */
$helper = $this->helper(Data::class);

Expand Down
Loading