szepeviktor / composer-envato

Composer plugin for Envato 💚 Install WordPress themes and plugins from ThemeForest‎‎ and CodeCanyon
https://packagist.org/packages/szepeviktor/composer-envato
MIT License
32 stars 3 forks source link

Error: Declaration of SzepeViktor\Composer\Envato\EnvatoPackage::getDistType() must be compatible with Composer\Package\Package::getDistType(): ?string in /var/www/html/vendor/szepeviktor/composer-envato/src/EnvatoPackage.php on line 53 #8

Closed soenkesmiletzki closed 1 year ago

soenkesmiletzki commented 1 year ago

Hello, I try to install your composer-envato, but it doesnt work :-( I extended the composer.json at the config array like:

    "envato": {
        "token": "PERSONAL-TOKEN",
        "packages": {
            "envato/avada-theme": {
                "item-id": 2833226,
                "type": "wordpress-theme"
            }
        }
    }

But after this I get an error:

PHP Fatal error: Declaration of SzepeViktor\Composer\Envato\EnvatoPackage::getDistType() must be compatible with Composer\Package\Package::getDistType(): ?string in /var/www/html/vendor/szepeviktor/composer-envato/src/EnvatoPackage.php on line 53

Fatal error: Declaration of SzepeViktor\Composer\Envato\EnvatoPackage::getDistType() must be compatible with Composer\Package\Package::getDistType(): ?string in /var/www/html/vendor/szepeviktor/composer-envato/src/EnvatoPackage.php on line 53

Any Idea?

szepeviktor commented 1 year ago

Hello @soenkesmiletzki! 👋🏻

You must have Composer v2. This package was written for v1.

Please consider contributing.

soenkesmiletzki commented 1 year ago

Oh, very fast reply, thanks a lot.

I'm using Composer 2.3.10 and I'm using 0.2.0:

"szepeviktor/composer-envato": "^0.2.0"

szepeviktor commented 1 year ago

Actually I do not know anything about this package. It was written for 1 client for free.

Please consider sending a PR.

szepeviktor commented 1 year ago

It turns out v0.2.0 supports Composer v2. https://github.com/szepeviktor/composer-envato/compare/v0.1.2...v0.2.0

A small fix would resolve your issue!

soenkesmiletzki commented 1 year ago

Sounds great, but how to do this?

szepeviktor commented 1 year ago

Simply by sending a Pull Request.

szepeviktor commented 1 year ago

I think latest PHPStan will show every problem.

soenkesmiletzki commented 1 year ago

sorry, I dont know :-(

soenkesmiletzki commented 1 year ago

No chance to get a working version?

szepeviktor commented 1 year ago

Do you mean I would work on the problem?

DannyTaki commented 1 year ago

I was receiving that same error, but after updating Composer to the latest version it went away, but after creating the config.json and adding the package to my project's composer.json and running composer update, composer returned an error that it couldn't find that package.

image

image

DannyTaki commented 1 year ago

I think latest PHPStan will show every problem.

Running PHPStan, within your codebase should show errors that need be resolved? Going to try this

DannyTaki commented 1 year ago

image

szepeviktor commented 1 year ago

Fixed in #10