Skip to content

Commit

Permalink
Merge pull request #51 from creative-commoners/pulls/3/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 5287ed1 + bfb103e commit f948de8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/SitewideContentReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function sourceRecords($params = [])
'Files' => Subsite::get_from_all_subsites(File::class),
];

if (array_key_exists('AllSubsites', $params)) {
if (array_key_exists('AllSubsites', $params ?? [])) {
$items['Pages'] = $items['Pages']->filter(['SubsiteID' => $params['AllSubsites']]);
$items['Files'] = $items['Files']->filter(['SubsiteID' => [0, $params['AllSubsites']]]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/php/SitewideContentReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function testParameterFields()
if (class_exists(Subsite::class)) {
/** @var DropdownField $field */
$field = $fields->fieldByName('AllSubsites');
$keys = array_filter(array_keys($field->getSource()));
$keys = array_filter(array_keys($field->getSource() ?? []));

$this->assertCount(4, $keys, '2 subsites plus 2 added options to filter by subsite');
} else {
Expand Down

0 comments on commit f948de8

Please sign in to comment.