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

Convert local method parameter variables to instance variables #50

Description

@tomphp

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions