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.
Unset operations are not seen as changing a value #71
Open
Description
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;
}
Metadata
Metadata
Assignees
Labels
No labels