Skip to content

Commit

Permalink
add check if array key exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Gaal committed Feb 8, 2024
1 parent 846ddfb commit 12b15bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function getPackages(): array
$json = json_decode($content, true);

return $this->packages = [
'require' => array_keys($json['require']),
'requireDev' => array_keys($json['require-dev']),
'require' => array_key_exists('require', $json) ? array_keys($json['require']) : [],
'requireDev' => array_key_exists('requireDev', $json) ? array_keys($json['require-dev']) : [],
];
}
}

0 comments on commit 12b15bd

Please sign in to comment.