Commit graph

14 commits

Author SHA1 Message Date
James D. Forrester
17e5334fc9 Drop wfRunHooks, deprecated since 1.25
Change-Id: I0350fba3f1a4a4ff500af746609bc9c6b46f0bdf
2018-10-10 15:30:00 -07:00
Kunal Mehta
cac3ce5668 Complete test coverage of Hooks class
Change-Id: I9e720c44e6d6c9c5d726a8a147e07ee9b638913f
2018-05-26 23:38:28 -07:00
Kunal Mehta
91a1a3ba2f HooksTest: Covers Hooks::callHook too
Change-Id: Id2b97b031b2fcf82a6fba66dae353db1acf340c3
2018-01-02 00:19:21 -08:00
Max Semenik
ca887b5301 Hard deprecate wfRunHooks()
Deprecated since 1.25, very few callers. Having to grep for 2
ways of calling a hook is harmful not only because it wastes developers'
time, but also because it makes it possible to forget to search for the
old way, resulting in mistakes. Better get rid of this.

Change-Id: Iab28bd5758475b780c2016847881757d64973862
2017-10-17 00:36:17 +00:00
Timo Tijhof
08f609d45d Hooks: Introduce Hooks::runWithoutAbort() alongside Hooks::run()
When used, any hook that tries to abort the event by returning something
other than true or null, will result in a run-time exception.

To make it easier to introduce this opt-in flag, still allow explicit
'true' returns from existing callers.

Also factor out the common code between these methods into a new
private method callHook().

Bug: T173615
Change-Id: I94c7ab656bd1a046410681a810c0a3fd4f72a2e5
2017-09-04 18:55:42 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Siebrand Mazeland
ce42915e0d Pass phpcs-strict on some test files (2/x)
Change-Id: Ia39fd107a554206927652b6e168faa0da501b362
2014-04-24 17:05:34 +02:00
addshore
9c540db2df @covers tags for inclues/*Test
Change-Id: Id28acdd8fe0028bf1e46344cfed131076c8f4c95
2013-10-24 11:54:02 +01:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
MatmaRex
af125df519 Cleaned up Hooks code, comments, and documentation.
Essentially rewrote Hooks::run() to get rid of the ridiculous
four levels of indentation. Also made some slight adjustments
to fix rare edge cases (for example, moved set_error_handler
after wfProfileIn in case Profiler triggers an error).

Change-Id: Iafdd4ceedac067b49ac597359ac456f4617da9e8
2013-04-22 16:41:17 +02:00
Antoine Musso
0fd05285d7 pass codesniffer on tests/
Fix almost all occurences of the following sniffs:

Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility

Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
2013-01-28 12:14:26 +01:00
daniel
503ce75e27 Fix behavior of Hooks class.
Until now, Hooks::run() would execute hooks registered via $wgHooks, but
Hooks:isRegistered() would not consider them and Hooks::getHandlers() would
not return them. That is inconsistent and misleading. This change aims to
make the methods of the Hooks class behave consistently, and allows them
to be used as a generic way of interacting with hooks.

Change-Id: I39bd5de2bc8ccbe8df729446363960af9d29b0be
2012-10-08 13:45:58 +02:00
Sam Reed
8c0292520b Fixup whitespace from r80445 2011-03-27 01:27:02 +00:00
X!
7ea48c9778 Followup to r80435: Forgot the svn add 2011-01-17 16:43:12 +00:00