diff --git a/src/Task/Composer.php b/src/Task/Composer.php index 0152498fa..b4a9d2f3b 100644 --- a/src/Task/Composer.php +++ b/src/Task/Composer.php @@ -105,7 +105,7 @@ private function hasLocalRepository(SplFileInfo $composerFile): bool } foreach ($package['repositories'] as $repository) { - if ('path' === $repository['type']) { + if ('path' === ($repository['type'] ?? null)) { return true; } } diff --git a/test/Unit/Task/ComposerTest.php b/test/Unit/Task/ComposerTest.php index aab35f231..b320645b1 100644 --- a/test/Unit/Task/ComposerTest.php +++ b/test/Unit/Task/ComposerTest.php @@ -152,6 +152,22 @@ function () { ); } ]; + yield 'packagistDotOrgDisabled' => [ + [ + 'no_local_repository' => true, + ], + $this->mockContext(RunContext::class, ['composer.json']), + function () { + $this->mockProcessBuilder('composer', $this->mockProcess(0)); + $this->filesystem->readFromFileInfo(Argument::which('getBasename', 'composer.json'))->willReturn( + json_encode([ + 'repositories' => [ + ['packagist.org' => false], + ], + ]) + ); + } + ]; } public function provideSkipsOnStuff(): iterable