FIX Always use ?int for subsite state (#341)

This commit is contained in:
Guy Sartorelli 2023-02-16 12:33:45 +13:00 committed by GitHub
parent 2f56d944c6
commit 72dc54b0f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ class SearchVariantSubsites extends SearchVariant
public function currentState() public function currentState()
{ {
return (string) SubsiteState::singleton()->getSubsiteId(); return SubsiteState::singleton()->getSubsiteId();
} }
public function reindexStates() public function reindexStates()
@ -74,8 +74,8 @@ class SearchVariantSubsites extends SearchVariant
if (is_numeric($state)) { if (is_numeric($state)) {
$state = (int) $state; $state = (int) $state;
} else { } elseif ($state !== null) {
throw new InvalidArgumentException("Invalid state ID. State ID should be number."); throw new InvalidArgumentException("Invalid state ID. State ID should be number or null.");
} }
// Note: Setting directly to the SubsiteState because we don't want the subsite ID to be persisted // Note: Setting directly to the SubsiteState because we don't want the subsite ID to be persisted