diff --git a/CHANGELOG.md b/CHANGELOG.md index ff18d80..2d3172a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- fixed displaying the cleanup result when using a parameter `--no-autoloader` + ## 1.2.0 - 2020-03-15 - feature for cleanup in composer `bin` directory diff --git a/src/Plugin.php b/src/Plugin.php index 618055c..e40c12d 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -48,6 +48,18 @@ class Plugin implements PluginInterface, EventSubscriberInterface */ private $actionIsDumpAutoload = true; + /** + * @var bool + */ + private $isCleaningFinished = false; + + public function __destruct() + { + if (!$this->cleaner && !$this->isCleaningFinished) { + $this->cleaner->finishCleanup(); + } + } + /** * @inheritDoc */ @@ -125,6 +137,8 @@ public function cleanup(Event $event) if ($this->actionIsDumpAutoload || $this->isCleanedPackages) { $this->cleaner->cleanupBinary($this->binDir); $this->cleaner->finishCleanup(); + + $this->isCleaningFinished = true; } $this->isCleanedPackages = true;