Legoktm has submitted this change and it was merged. (
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(-)
Approvals:
Legoktm: Verified; Looks good to me, approved
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: merged
Gerrit-Change-Id: Iec9c12359f0d46f90e95b40ff9e62ab60a6a6c02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/phpunit-patch-coverage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits