Czukowski created NETBEANS-5337:
-----------------------------------

             Summary: Find occurences/rename wrong elements
                 Key: NETBEANS-5337
                 URL: https://issues.apache.org/jira/browse/NETBEANS-5337
             Project: NetBeans
          Issue Type: Bug
          Components: php - Code Analysis
    Affects Versions: 12.3
            Reporter: Czukowski
         Attachments: image-2021-02-05-16-25-03-183.png

Please see the example code below. If you place a cursor into any of the 3 
occurrences of {{getItems}} and press Ctrl+R to rename, all three will be 
renamed, even though these refer to two different methods named {{getItems()}}, 
one in the current class and another from a different class that the Query 
object iterates over.
{code:php}
<?php declare(strict_types = 1);

namespace Cz\RenameVariable;

use Doctrine\ORM\Query;
use Symfony\Component\Console\Command\Command;

class TestCommand extends Command
{
    protected function execute(): int
    {
        $items = $this->getItems(); // [1]

        foreach ($items->iterate() as [$item]) {
            foreach ($item->getItems() as $subItem) { // [2]
                $this->writeln('Test');
            }
        }
    }

    /**
     * @return Query
     */
    private function getItems(): Query // [3]
    {}
}
{code}
!image-2021-02-05-16-25-03-183.png|width=520,height=360!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to