From 7a0a927835d50e5db8f0a277fe43df44e430eedc Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Thu, 25 Apr 2024 09:33:34 -0700 Subject: [PATCH] check for array before loop --- CHANGELOG.md | 4 ++++ src/Cleanup.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cac975f8..45f8cb7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.18.1 April 2024 + +* Fix: check for array before loop + ## 0.18.0 April 2024 diff --git a/src/Cleanup.php b/src/Cleanup.php index eeeecea1..61062f0f 100644 --- a/src/Cleanup.php +++ b/src/Cleanup.php @@ -151,6 +151,9 @@ public function cleanupInstalledJson(): void $installedJsonArray = $installedJsonFile->read(); foreach ($installedJsonArray['packages'] as $key => $package) { + if (!isset($package['autoload'])) { + continue; + } $packageDir = $this->workingDir . $this->vendorDirectory . ltrim($package['install-path'], '.'); $autoload_key = $package['autoload']; foreach ($autoload_key as $type => $autoload) {