Debian Codegraph @

includes/user/Options/Hook/ConditionalDefaultOptionsAddConditionHook.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\User\Options\Hook;
4
5 /**
6 * This is a hook handler interface, see docs/Hooks.md.
7 * Use the hook name "ConditionalDefaultOptionsAddCondition" to register handlers implementing
8 * this interface. It runs virtually on any request, although it should run once, performance of
9 * the hook run should be taken in account.
10 *
11 * @stable to implement
12 * @ingroup Hooks
13 */
14 interface ConditionalDefaultOptionsAddConditionHook {
15 /**
16 * This hook is called when ConditionalDefaultsLookup service is created.
17 * Important: $extraConditions must be added and used in a property defined by the same extension. Using
18 * a condition from a missing extension will result in fatal error.
19 * See also Manual:$wgConditionalUserOptions.
20 *
21 * @since 1.43
22 *
23 * @param array<string,callable> &$extraConditions An empty array to add checker functions to
24 * evaluate conditions set in $wgConditionalUserOptions. The key is the name of the condition
25 * and the value a callable which will take two arguments:
26 * - UserIdentity $user: the user which option is being evaluated
27 * - array $args: the rest of arguments in the relevant condition configuration
28 * @return void This hook must not abort, it must return no value
29 */
30 public function onConditionalDefaultOptionsAddCondition( array &$extraConditions ): void;
31 }