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

PHP Fatal error: Uncaught TypeError: Cannot assign Composer\PartialComposer to property NunoMaduro\PhpInsights\Domain\ComposerLoader::$composer of type ?Composer\Composer #565

Closed
vaawebdev opened this issue Feb 23, 2022 · 8 comments

Comments

@vaawebdev
Copy link

Q A
Bug report? yes
Feature request? no
Library version v2.1.0

'preset' => 'laravel',

Running ./vendor/bin/phpinsights results an error

Locked composer version "dev-main"

PHP Fatal error:  Uncaught TypeError: Cannot assign Composer\PartialComposer to property NunoMaduro\PhpInsights\Domain\ComposerLoader::$composer of type ?Composer\Composer in /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Domain/ComposerLoader.php:30
Stack trace:
#0 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Domain/Insights/Composer/ComposerLockMustBeFresh.php(22): NunoMaduro\PhpInsights\Domain\ComposerLoader::getInstance()
#1 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Domain/Results.php(155): NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerLockMustBeFresh->hasIssue()
#2 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Domain/Results.php(66): NunoMaduro\PhpInsights\Domain\Results->getPercentage()
#3 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Application/Console/Formatters/Console.php(253): NunoMaduro\PhpInsights\Domain\Results->getStructure()#4 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Application/Console/Formatters/Console.php(135): NunoMaduro\PhpInsights\Application\Console\Formatters\Console->summary()
#5 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Application/Console/Formatters/Multiple.php(32): NunoMaduro\PhpInsights\Application\Console\Formatters\Console->format()
#6 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Application/Console/Analyser.php(38): NunoMaduro\PhpInsights\Application\Console\Formatters\Multiple->format()
#7 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Application/Console/Commands/AnalyseCommand.php(65): NunoMaduro\PhpInsights\Application\Console\Analyser->analyse()
#8 [internal function]: NunoMaduro\PhpInsights\Application\Console\Commands\AnalyseCommand->__invoke()
#9 /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Application/Console/Commands/InvokableCommand.php(41): call_user_func()
#10 /var/www/workflowz/vendor/symfony/console/Command/Command.php(291): NunoMaduro\PhpInsights\Application\Console\Commands\InvokableCommand->execute()       
#11 /var/www/workflowz/vendor/symfony/console/Application.php(989): Symfony\Component\Console\Command\Command->run()
#12 /var/www/workflowz/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#13 /var/www/workflowz/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#14 /var/www/workflowz/vendor/nunomaduro/phpinsights/bin/phpinsights(42): Symfony\Component\Console\Application->run()
#15 /var/www/workflowz/vendor/nunomaduro/phpinsights/bin/phpinsights(43): {closure}()
#16 /var/www/workflowz/vendor/bin/phpinsights(107): include('...')
#17 {main}
  thrown in /var/www/workflowz/vendor/nunomaduro/phpinsights/src/Domain/ComposerLoader.php on line 30
@shomsy
Copy link

shomsy commented Feb 24, 2022

I have same error:

image

@50bhan
Copy link
Contributor

50bhan commented Feb 24, 2022

The root of the issue is the composer. As the composer maintainer said in #559, we need to remove the composer/composer dependency. Because they split the class into a base class PartialComposer (composer/composer#10547).

@nunomaduro @Jibbarth @olivernybroe Could you guys please help with this? As it's not possible to install the package anymore.

@nunomaduro
Copy link
Owner

The people reporting this issue, are free to make a pull request. Personally, I don't have time for this project. 👍🏻

@Queopius
Copy link

Queopius commented Feb 25, 2022

Hello everyone! I have the same problem.

Screenshot from 2022-02-25 10-48-23

@damek24
Copy link

damek24 commented Mar 4, 2022

temp fix that worked for me:
in src\Domain\ComposerLoader.php change fullLoad parameter to true:
self::$composer = (new Factory())->createComposer($io, ComposerFinder::getPath($collector), false, null, true);

@DannyvdSluijs
Copy link
Contributor

temp fix that worked for me:
in src\Domain\ComposerLoader.php change fullLoad parameter to true:
self::$composer = (new Factory())->createComposer($io, ComposerFinder::getPath($collector), false, null, true);

That is what the pr in #566 does.

@cmgmyr
Copy link
Collaborator

cmgmyr commented Mar 8, 2022

fixed in #566

@cmgmyr cmgmyr closed this as completed Mar 8, 2022
@Sergiobop
Copy link

Can we have a release with the fix @cmgmyr ? Thanks!

Teakowa added a commit to XNXKTech/laravel-esign that referenced this issue Mar 21, 2022
This commit will fix nunomaduro/phpinsights#565 error, it's came from

nunomaduro/phpinsights#566 , and this commit will also switch the target

version to dev-master, since the upstream repository has not yet

released a version, This will last for some time.

Signed-off-by: Teakowa Gatanothor O'deorain <hub+git@teakowa.dev>
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

9 participants