Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Convert local method parameter variables to instance variables #50

Open
tomphp opened this issue Dec 29, 2013 · 0 comments · May be fixed by #53
Open

Convert local method parameter variables to instance variables #50

tomphp opened this issue Dec 29, 2013 · 0 comments · May be fixed by #53

Comments

@tomphp
Copy link
Contributor

tomphp commented Dec 29, 2013

I've currently noticed some funny behaviour with convert local variable to instance variable when the local variable is a method parameter. Currently if you convert myvar in the following code

class X
{
    public function doSomething($myvar)
    {
        $myvar++;

        return $myvar;
    }
}

You get something like this

class X
{
    private $myvar;

    public function doSomething($this->myvar)
    {
        $this->myvar++;

        return $this->myvar;
    }
}

Which includes syntax errors as well as logic errors. What I think it should actually produce is something like this:

class X
{
    private $myvar;

    public function doSomething($myvar)
    {
        $this->myvar = $myvar;

        $this->myvar++;

        return $this->myvar;
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant