From f2a1b314b97643e7b0b0d7577a2f18b8ed877aa4 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 3 Mar 2024 23:35:06 +0100 Subject: [PATCH] Ensure that endChangeset() returns the real outcome 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. --- src/Fixer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Fixer.php b/src/Fixer.php index b3e933355b..52de753c8a 100644 --- a/src/Fixer.php +++ b/src/Fixer.php @@ -461,7 +461,7 @@ public function endChangeset() } $this->changeset = []; - return true; + return $success; }//end endChangeset()