Skip to content

Commit

Permalink
Avoid "Undefined array key" warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fiedsch committed Aug 30, 2023
1 parent 50813e6 commit 718f0ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Traits/JsonGetterSetterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __unset($strKey): void
*/
protected function getJsonData(): array
{
$jsonString = $this->arrData[static::$strJsonColumn];
$jsonString = $this->arrData[static::$strJsonColumn] ?? '';

if (empty($jsonString)) {
$jsonData = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/YamlGetterSetterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __unset($strKey): void
protected function getYamlData(): array
{
try {
$yamlData = Yaml::parse($this->arrData[static::$strYamlColumn]);
$yamlData = Yaml::parse($this->arrData[static::$strYamlColumn]) ?? '';
} catch (ParseException $e) {
// ignored
$yamlData = [];
Expand Down

0 comments on commit 718f0ce

Please sign in to comment.