a class that uses property (not method) _redirect or loadLayout
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;
}
}
}
2. run `phpcs`
### Expected result
<!--- Tell us what do you expect to happen. -->
1. No `Magento2.Legacy.ObsoleteResponse` triggered
### Actual result
<!--- Tell us what happened instead. Include error messages and issues. -->
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.
Preconditions
_redirect
orloadLayout
Steps to reproduce
declare(strict_types=1);
namespace Vendor\Module\Model;
class MyModel { /**
@var string */ private $renderLayout;
/**
@var string */ private $_redirect;
/**
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.