Skip to content

Commit

Permalink
Merge pull request #85 from creative-commoners/pulls/2/php81
Browse files Browse the repository at this point in the history
ENH PHP 8.1 compatibility
  • Loading branch information
GuySartorelli authored Apr 26, 2022
2 parents 13dd349 + 729a425 commit 4f79f32
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Block/BannerBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function decodeLinkData($linkJson)
return;
}

$data = ArrayData::create(json_decode($linkJson));
$data = ArrayData::create(json_decode($linkJson ?? ''));

// Link page, if selected
if ($data->PageID) {
Expand Down
4 changes: 2 additions & 2 deletions src/Form/BlockLinkField.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getParsedValue()
if ($this->parsedValue) {
return $this->parsedValue;
}
$parsedValue = json_decode($this->dataValue(), true);
$parsedValue = json_decode($this->dataValue() ?? '', true);
return $this->parsedValue = ArrayData::create((array) $parsedValue);
}

Expand All @@ -80,7 +80,7 @@ public function getLinkPage()
*/
public function getLinkText()
{
return trim($this->getParsedValue()->Text);
return trim($this->getParsedValue()->Text ?? '');
}
/**
* Get the link "description", used for titles or alt text
Expand Down
2 changes: 1 addition & 1 deletion tests/Behat/Context/FixtureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function contentBlocksAreNotInLineEditable()

$file = 'content-blocks-not-inline-editable.yml';
$path = $this->getDestinationConfigFolder($file);
file_put_contents($path, $config);
file_put_contents($path ?? '', $config);

$this->activatedConfigFiles[] = $path;

Expand Down

0 comments on commit 4f79f32

Please sign in to comment.