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

Unset operations are not seen as changing a value #71

Open
AJenbo opened this issue Jun 6, 2017 · 0 comments
Open

Unset operations are not seen as changing a value #71

AJenbo opened this issue Jun 6, 2017 · 0 comments

Comments

@AJenbo
Copy link

AJenbo commented Jun 6, 2017

    function test()
    {
        $userHelper = [1,2];
        unset($options[0]);
    }

Refactoring the secound line in the function will fail to take account for the unsetting changing $options and it needing to be retuned or passed by reference.

    function test()
    {
        $options = [1,2];
        $this->asd($options);
    }

    private function asd($options)
    {
        unset($options[0]);
    }

expected

    function test()
    {
        $options = [1,2];
        $options = $this->asd($options);
    }

    private function asd($options)
    {
        unset($options[0]);
        return $options;
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant