preg_match() does not accept passing null as the $subject string parameter in PHP 8.1.
Thus first check that $subject !== null.
EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261] arcanist(head=master, ref.master=0e32dbc1ac8f), phorge(head=diffusionRepoPage, ref.master=5405134fa5db, ref.diffusionRepoPage=dbe5e3a68c41) #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261] #1 <#2> preg_match(string, NULL) called at [<phorge>/src/applications/herald/typeahead/HeraldRuleDatasource.php:25]
Closes T15422