Inline PackageEvents constants
parent
f1f013edde
commit
a812853fe4
|
@ -430,9 +430,14 @@ class InstallationManager
|
||||||
}
|
}
|
||||||
$installer = $this->getInstaller($package->getType());
|
$installer = $this->getInstaller($package->getType());
|
||||||
|
|
||||||
$event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($opType);
|
$eventName = [
|
||||||
if (defined($event) && $runScripts && $this->eventDispatcher) {
|
'install' => PackageEvents::PRE_PACKAGE_INSTALL,
|
||||||
$this->eventDispatcher->dispatchPackageEvent(constant($event), $devMode, $repo, $allOperations, $operation);
|
'update' => PackageEvents::PRE_PACKAGE_UPDATE,
|
||||||
|
'uninstall' => PackageEvents::PRE_PACKAGE_UNINSTALL,
|
||||||
|
][$opType] ?? null;
|
||||||
|
|
||||||
|
if (null !== $eventName && $runScripts && $this->eventDispatcher) {
|
||||||
|
$this->eventDispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dispatcher = $this->eventDispatcher;
|
$dispatcher = $this->eventDispatcher;
|
||||||
|
@ -454,12 +459,17 @@ class InstallationManager
|
||||||
throw $e;
|
throw $e;
|
||||||
});
|
});
|
||||||
|
|
||||||
$postExecCallbacks[] = function () use ($opType, $runScripts, $dispatcher, $devMode, $repo, $allOperations, $operation): void {
|
$eventName = [
|
||||||
$event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($opType);
|
'install' => PackageEvents::POST_PACKAGE_INSTALL,
|
||||||
if (defined($event) && $runScripts && $dispatcher) {
|
'update' => PackageEvents::POST_PACKAGE_UPDATE,
|
||||||
$dispatcher->dispatchPackageEvent(constant($event), $devMode, $repo, $allOperations, $operation);
|
'uninstall' => PackageEvents::POST_PACKAGE_UNINSTALL,
|
||||||
}
|
][$opType] ?? null;
|
||||||
|
|
||||||
|
if (null !== $eventName && $runScripts && $dispatcher) {
|
||||||
|
$postExecCallbacks[] = function () use ($dispatcher, $eventName, $devMode, $repo, $allOperations, $operation): void {
|
||||||
|
$dispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
$promises[] = $promise;
|
$promises[] = $promise;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue