Implemented #3836: Replace setCancelled() in events with cancel() and uncancel()

The motivation for this is to prevent passing a dynamic argument to cancellation, which in almost all cases is a bug in user code. This same mistake also appears in a few places in the PM core (as seen in this commit), but in those cases the mistakes were mostly harmless since they were taking place before the event was actually called.
closes #3836
This commit is contained in:
Dylan K. Taylor
2020-09-26 14:31:56 +01:00
parent 75e3a0aa0f
commit 7b02cc3efd
12 changed files with 41 additions and 27 deletions

View File

@ -51,7 +51,7 @@ class Main extends PluginBase implements Listener{
//be asynchronous tests running. Instead we cancel this and stop the server of our own accord once all tests
//have completed.
if($event->getCommand() === "stop"){
$event->setCancelled();
$event->cancel();
}
}