Open
Description
Preconditions
- a class that uses property (not method)
_redirect
orloadLayout
- magento-coding-standard v16
Steps to reproduce
- a class that uses properties (not methods) that are listed in the list of methods
<?php
declare(strict_types=1);
namespace Vendor\Module\Model;
class MyModel
{
/**
* @var string
*/
private $renderLayout;
/**
* @var string
*/
private $_redirect;
/**
* @return void
*/
public function test()
{
if ($this->renderLayout === null) {
$a = 1;
}
if ($this->_redirect === null) {
$b = 2;
}
}
}
- run
phpcs
Expected result
- No
Magento2.Legacy.ObsoleteResponse
triggered
Actual result
FILE: /Model/MyModel.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------
24 | WARNING | renderLayout method is deprecated. Please use \Magento\Framework\Controller\ResultInterface::renderResult instead.
27 | WARNING | _redirect method is deprecated. Please use \Magento\Backend\Model\View\Result\Redirect::render instead.
-----------------------------------------------------------------------------------------------------------------------------------