Manual:UserFactory.php

To get an instance of a UserFactory:

$userFactory = MediaWiki\MediaWikiServices::getInstance()->getUserFactory();