Skip to content
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

False positive Magento2.Legacy.ObsoleteResponse #352

Open
DmitryFurs opened this issue Dec 28, 2021 · 1 comment
Open

False positive Magento2.Legacy.ObsoleteResponse #352

DmitryFurs opened this issue Dec 28, 2021 · 1 comment
Labels

Comments

@DmitryFurs
Copy link

Preconditions

  1. a class that uses property (not method) _redirect or loadLayout
  2. magento-coding-standard v16

Steps to reproduce

  1. 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;
        }
    }
}

  1. run phpcs

Expected result

  1. 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.
-----------------------------------------------------------------------------------------------------------------------------------
@DmitryFurs DmitryFurs added the bug Something isn't working label Dec 28, 2021
@m2-assistant
Copy link

m2-assistant bot commented Dec 28, 2021

Hi @DmitryFurs. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant