WP_CLI

PackageManagerEventSubscriber::post_install()public staticWP-CLI 1.0

Post-install operation log.

Method of the class: PackageManagerEventSubscriber{}

No Hooks.

Return

null. Nothing.

Usage

$result = PackageManagerEventSubscriber::post_install( $event );
$event(\Composer\Installer\PackageEvent) (required)
-

PackageManagerEventSubscriber::post_install() code WP-CLI 2.8.0-alpha

public static function post_install( PackageEvent $event ) {

	$operation = $event->getOperation();

	// getReason() was removed in Composer v2 without replacement.
	if ( ! method_exists( $operation, 'getReason' ) ) {
		return;
	}

	$reason = $operation->getReason();
	if ( $reason instanceof Rule ) {

		switch ( $reason->getReason() ) {

			case Rule::RULE_PACKAGE_CONFLICT:
			case Rule::RULE_PACKAGE_SAME_NAME:
			case Rule::RULE_PACKAGE_REQUIRES:
				$composer_error = $reason->getPrettyString( $event->getPool() );
				break;

		}

		if ( ! empty( $composer_error ) ) {
			WP_CLI::log( sprintf( ' - Warning: %s', $composer_error ) );
		}
	}

}