diff --git a/README.md b/README.md index ca13531..36cffbf 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,6 @@ When does this plugin update EasyAdmin classes? * Just after installing this Composer plugin; * Just after installing or updating any EasyAdmin version. +* Just after running `composer update` or `composer install` commands. [1]: https://easycorp.github.io/blog/posts/the-road-to-easyadmin-3-no-more-inheritance diff --git a/src/NoFinalClassPlugin.php b/src/NoFinalClassPlugin.php index 0c4dfd1..b253a69 100644 --- a/src/NoFinalClassPlugin.php +++ b/src/NoFinalClassPlugin.php @@ -12,6 +12,8 @@ use Composer\IO\IOInterface; use Composer\Package\PackageInterface; use Composer\Plugin\PluginInterface; +use Composer\Script\Event; +use Composer\Script\ScriptEvents; final class NoFinalClassPlugin implements PluginInterface, EventSubscriberInterface { @@ -27,6 +29,8 @@ public static function getSubscribedEvents() return [ PackageEvents::POST_PACKAGE_INSTALL => 'onPackageInstall', PackageEvents::POST_PACKAGE_UPDATE => 'onPackageUpdate', + ScriptEvents::POST_INSTALL_CMD => 'onInstallCmd', + ScriptEvents::POST_UPDATE_CMD => 'onUpdateCmd', ]; } @@ -56,6 +60,16 @@ public function onPackageUpdate(PackageEvent $event) $this->removeFinalFromAllEasyAdminClasses(); } + public function onInstallCmd(Event $event) + { + $this->removeFinalFromAllEasyAdminClasses(); + } + + public function onUpdateCmd(Event $event) + { + $this->removeFinalFromAllEasyAdminClasses(); + } + public function removeFinalFromAllEasyAdminClasses() { $vendorDirPath = $this->getVendorDirPath();