wiki.techinc.nl/includes/api/Hook
Timo Tijhof 01f3efe4ff Hook: Mark abortable=false hooks as void
* Remove the mention of 'return true' being legal.
  This is only allowed for compat with code from before MW 1.21,
  when I added hook aborting as well as tolerance for null to
  be the same as true.

  Since then, there is no reason to return null or return true.
  For early returns, an explicitly void 'return;' should be used
  instead. Returning anything else like null/true serves no purpose
  other than to confuse the reader.

* Mark the interfaces as natively 'void' with return type hints.

  This means in core code that runs the hook, static analysis
  like Phan and in IDEs, it will be known that these onFoo()s
  never return a value, thus allowing them to detect if its
  return value is assigned or used in a conditional for any
  reason, which can be an easy mistake.

  It also means that in the future when extensions start using
  these interfaces in 'implements' statement, they will be
  required to mark their hooks as void.

  That migration is opt-in and still up ahead. This is not
  a breaking change even for all existing extensions where
  a return true/null may exist in an abortable hook since this
  only applies to code directly typed against the interface.
  The internal run() method doesn't care.

Change-Id: Ib79289bd486ac97cec492e72f9a8dee70cf2f6c2
2020-06-22 19:07:35 +00:00
..
APIAfterExecuteHook.php
ApiCheckCanExecuteHook.php
ApiDeprecationHelpHook.php
ApiFeedContributions__feedItemHook.php
ApiFormatHighlightHook.php
APIGetAllowedParamsHook.php
APIGetDescriptionMessagesHook.php
APIGetParamDescriptionMessagesHook.php
APIHelpModifyOutputHook.php
ApiMain__moduleManagerHook.php
ApiMain__onExceptionHook.php
ApiMakeParserOptionsHook.php
ApiMaxLagInfoHook.php Hook: Mark abortable=false hooks as void 2020-06-22 19:07:35 +00:00
ApiOpenSearchSuggestHook.php
ApiOptionsHook.php
ApiParseMakeOutputPageHook.php
ApiQuery__moduleManagerHook.php
APIQueryAfterExecuteHook.php
ApiQueryBaseAfterQueryHook.php
ApiQueryBaseBeforeQueryHook.php
ApiQueryBaseProcessRowHook.php
APIQueryGeneratorAfterExecuteHook.php
APIQueryInfoTokensHook.php
APIQueryRecentChangesTokensHook.php
APIQueryRevisionsTokensHook.php
APIQuerySiteInfoGeneralInfoHook.php
APIQuerySiteInfoStatisticsInfoHook.php
ApiQueryTokensRegisterTypesHook.php
APIQueryUsersTokensHook.php
ApiQueryWatchlistExtractOutputDataHook.php
ApiQueryWatchlistPrepareWatchedItemQueryServiceOptionsHook.php
ApiRsdServiceApisHook.php
ApiTokensGetTokenTypesHook.php
ApiValidatePasswordHook.php
RequestHasSameOriginSecurityHook.php