Skip to content

Commit 962239c

Browse files
authored
array_key_exists() is better than isset().
1 parent bafbbe4 commit 962239c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SelectboxTree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private function serializeCategoriesToSelectbox(?array $categories, int $level =
9999

100100
$return = [];
101101
foreach ($categories as $catKey => $category) {
102-
if (isset($category['id'], $category['parent'], $category['name']) === false) {
102+
if (array_key_exists('id', $category) === false || array_key_exists('parent', $category) === false || array_key_exists('name', $category) === false) {
103103
throw new \InvalidArgumentException('Category "' . $catKey . '" must contain keys "id", "parent" and "name".');
104104
}
105105

0 commit comments

Comments
 (0)