diff --git a/includes/FilterStore.php b/includes/FilterStore.php index 26c242e9c..5a8693351 100644 --- a/includes/FilterStore.php +++ b/includes/FilterStore.php @@ -9,7 +9,6 @@ use MediaWiki\Extension\AbuseFilter\Filter\Filter; use MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseFilter; use MediaWiki\User\UserIdentity; use Status; -use stdClass; use User; use Wikimedia\Rdbms\ILoadBalancer; @@ -128,7 +127,7 @@ class FilterStore { bool $wasGlobal ): array { $dbw = $this->loadBalancer->getConnectionRef( DB_PRIMARY ); - $newRow = get_object_vars( $this->filterToDatabaseRow( $newFilter ) ); + $newRow = $this->filterToDatabaseRow( $newFilter ); // Set last modifier. $newRow['af_timestamp'] = $dbw->timestamp(); @@ -249,11 +248,11 @@ class FilterStore { /** * @todo Perhaps add validation to ensure no null values remained. * @param Filter $filter - * @return stdClass + * @return array */ - private function filterToDatabaseRow( Filter $filter ): stdClass { + private function filterToDatabaseRow( Filter $filter ): array { // T67807: integer 1's & 0's might be better understood than booleans - return (object)[ + return [ 'af_id' => $filter->getID(), 'af_pattern' => $filter->getRules(), 'af_public_comments' => $filter->getName(), diff --git a/tests/phpunit/integration/FilterStoreTest.php b/tests/phpunit/integration/FilterStoreTest.php index 331e2760f..b19e7c91f 100644 --- a/tests/phpunit/integration/FilterStoreTest.php +++ b/tests/phpunit/integration/FilterStoreTest.php @@ -48,7 +48,7 @@ class FilterStoreTest extends MediaWikiIntegrationTestCase { $filterStore = TestingAccessWrapper::newFromObject( AbuseFilterServices::getFilterStore() ); wfGetDB( DB_PRIMARY )->insert( 'abuse_filter', - get_object_vars( $filterStore->filterToDatabaseRow( $filter ) ), + $filterStore->filterToDatabaseRow( $filter ), __METHOD__ ); }