Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run-script post-package-install - TypeError PackageEvent versus Event - bug in docu? #11424

Closed
siims-biz opened this issue Apr 8, 2023 · 1 comment

Comments

@siims-biz
Copy link

Regarding
https://getcomposer.org/doc/articles/scripts.md
The sample contains
"post-package-install": [
"MyVendor\MyClass::postPackageInstall"
],
public static function postPackageInstall(PackageEvent $event)

Observation
composer run-script post-package-install

Argument #1 ($event) must be of type Composer\Installer\PackageEvent, Composer\Script\Event given,

Composer version: 2.5.5
Windows 10

Is the sample working for you?

@Seldaek
Copy link
Member

Seldaek commented May 8, 2023

Yes, the sample works for me, with:

use Composer\Installer\PackageEvent;

    public static function postPackageInstall(PackageEvent $event)
    {
        $installedPackage = $event->getOperation()->getPackage();
        var_dump((string) $installedPackage);
    }

I get the following output when running install

  - Installing seld/jsonlint (1.9.0): Extracting archive
> MyVendor\MyClass::postPackageInstall
string(21) "seld/jsonlint-1.9.0.0"

So looks good to me..

@Seldaek Seldaek closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants