Skip to content

Commit 3560425

Browse files
committed
Also remove final classes when running composer install/update
1 parent 46bf8d4 commit 3560425

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ When does this plugin update EasyAdmin classes?
2020

2121
* Just after installing this Composer plugin;
2222
* Just after installing or updating any EasyAdmin version.
23+
* Just after running `composer update` or `composer install` commands.
2324

2425
[1]: https://easycorp.github.io/blog/posts/the-road-to-easyadmin-3-no-more-inheritance

src/NoFinalClassPlugin.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Composer\IO\IOInterface;
1313
use Composer\Package\PackageInterface;
1414
use Composer\Plugin\PluginInterface;
15+
use Composer\Script\Event;
16+
use Composer\Script\ScriptEvents;
1517

1618
final class NoFinalClassPlugin implements PluginInterface, EventSubscriberInterface
1719
{
@@ -27,6 +29,8 @@ public static function getSubscribedEvents()
2729
return [
2830
PackageEvents::POST_PACKAGE_INSTALL => 'onPackageInstall',
2931
PackageEvents::POST_PACKAGE_UPDATE => 'onPackageUpdate',
32+
ScriptEvents::POST_INSTALL_CMD => 'onInstallCmd',
33+
ScriptEvents::POST_UPDATE_CMD => 'onUpdateCmd',
3034
];
3135
}
3236

@@ -56,6 +60,16 @@ public function onPackageUpdate(PackageEvent $event)
5660
$this->removeFinalFromAllEasyAdminClasses();
5761
}
5862

63+
public function onInstallCmd(Event $event)
64+
{
65+
$this->removeFinalFromAllEasyAdminClasses();
66+
}
67+
68+
public function onUpdateCmd(Event $event)
69+
{
70+
$this->removeFinalFromAllEasyAdminClasses();
71+
}
72+
5973
public function removeFinalFromAllEasyAdminClasses()
6074
{
6175
$vendorDirPath = $this->getVendorDirPath();

0 commit comments

Comments
 (0)