Legoktm has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405569 )
Change subject: Make it easier to hold onto the ScopedCallbacks ...................................................................... Make it easier to hold onto the ScopedCallbacks Change-Id: Iec9c12359f0d46f90e95b40ff9e62ab60a6a6c02 --- M src/CheckCommand.php 1 file changed, 14 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/phpunit-patch-coverage refs/changes/69/405569/1 diff --git a/src/CheckCommand.php b/src/CheckCommand.php index 30fc101..a0d8305 100644 --- a/src/CheckCommand.php +++ b/src/CheckCommand.php @@ -31,6 +31,15 @@ * Assumes cwd is the git repository */ class CheckCommand extends Command { + + /** + * Once this class is destructed, all of these + * will get run + * + * @var ScopedCallback[] + */ + private $scopedCallbacks = []; + protected function configure() { $this->setName( 'check' ) ->addOption( @@ -81,9 +90,11 @@ $output->writeln( "Finding coverage difference in $notMerge" ); // To reset back to once we're done, use a scoped callback so this // still happens regardless of exceptions - $lock = new ScopedCallback( function () use ( $git, $current ) { - $git->checkout( $current ); - } ); + $this->scopedCallbacks[] = new ScopedCallback( + function () use ( $git, $current ) { + $git->checkout( $current ); + } + ); $git->checkout( $notMerge ); $changed = $git->getChangedFiles( $notMerge ); $changedFiles = new GitChanged(); -- To view, visit https://gerrit.wikimedia.org/r/405569 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iec9c12359f0d46f90e95b40ff9e62ab60a6a6c02 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/tools/phpunit-patch-coverage Gerrit-Branch: master Gerrit-Owner: Legoktm <lego...@member.fsf.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits