`$leadImages || $images` will return a boolean, it doesn't work like
JavaScript or Python. Use `?:` to implement what was wanted.
This only worked because `count( true ) === 1`. Using assertCount()
would have caught it also.
Change-Id: I11357b23ad1124ed96d863872014cdca7c59e284
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
Change-Id: I3554682b5c8686299dc8cf23a3ec8c59514ff008
Plus:
* Add a missing "array" type hint.
* Use more specific assert… functions instead of isset().
Change-Id: Iaa423620d493b4bee11bf89f627d0420a645a8de
Supporting changes:
* Update the LinksUpdateHookHandlerTest test case to set the config
variable to its expected value of false.
Bug: T162203
Change-Id: Ic7b4d5ab42f71f6b4cf24cb5bbbbe808341a09e8
The API accepts a new query parameter `license`, whose
value can either be `free` or `any`. `free` is the default value.
When the value of `licence` is:
* `free`, then only the best image whose copyright allows
reusing it will be returned;
* `any`, then the best image, regardless of its copyright
status, will be returned.
Bug: T131105
Change-Id: I83ac5266e382d2d121aff3f7d28711787251c03b
* Do not "return true" in hook handlers. I was told it's good practice
to either return false on failure, or nothing/null.
* Remove "static" from method that does not need to be static.
* Make some type hints more specific.
* Add missing imports. I wonder how this can work without the imports.
My PHPStorm complains.
Change-Id: Ia0e980ff99f0e004d700b22dd07ff17f04bed4ec
This patch only moves existing code around, but does not change any
implementation detail.
I found it very suprising that all code called by this hook handler
is 100% exclusive to this hook handler. There is zero interaction
between this hook handlers code and all other code. Why is it in the
same file then? And why is it all static? It doesn't have to be. I
had to change literally nothing, except cutting and pasting, removing
all "static" and replacing all "self::..." with "$this->...". That's
all.
Change-Id: I5ffe6fdf4e57135e6f3b32636c80f22be758607c