Skip to content

Commit

Permalink
Ensure that endChangeset() returns the real outcome
Browse files Browse the repository at this point in the history
I was debugging a complex sniff that implies multiple
potential modifications to the same token (that is, right now,
not possible - we could discuss about that another day), when
have detected that the Fixer::endChangeset() method is returning
always true, no matter the changes have been not accepted.

So this just ensures that the method returns the real outcome.

I've been looking to current tests to try to add something to
have it covered, but it seems that the Fixer is one of those
areas needing some coverage, haven't found any test explicitly
covering it.

Also, I've searched at github, to see if anybody may be using
expressions like:

$outcome = $phpcsFile->fixer->endChangeset()...
if ($phpcsFile->fixer->endChangeset()...

And have found zero lines of code using the return value
of the method. Hence, I think it's a safe change to apply.
  • Loading branch information
stronk7 committed Mar 3, 2024
1 parent 19cb50e commit f2a1b31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public function endChangeset()
}

$this->changeset = [];
return true;
return $success;

}//end endChangeset()

Expand Down

0 comments on commit f2a1b31

Please sign in to comment.