Commit graph

2626 commits

Author SHA1 Message Date
Thiemo Kreuz 670f0bb8f9 Don't expect objects by reference in hook handlers
The motivation for this patch is to make the code less complex, better
readable, and less brittle.

Example:

public function onExampleHook( Parser &$parser, array &$result ) {
    /* This is the hook handler */
}

In this example the $result array is meant to be manipulated by the
hook handler. Changes should become visible to the caller. Since PHP
passes arrays by value, the & is needed to make this possible.

But the & is misplaced in pretty much all cases where the parameter is
an object. The only reason we still see these & in many hook handlers
is historical: PHP 4 passed objects by value, which potentially caused
expensive cloning. This was prevented with the &.

Since PHP 5 objects are passed by reference. However, this did not
made the & entirely meaningless. Keeping the & means callees are
allowed to replace passed objects with new ones. The & makes it look
like a function might intentionally replace a passed object, which is
unintended and actually scary in cases like the Parser. Luckily all
Hooks::run I have seen so far ignore unintended out-values. So even if
a hook handler tries to do something bad like replacing the Parser
with a different one, this would not have an effect.

Removing the & does not remove the possibility to manipulate the
object. Changes done to public properties are still visible to the
caller.

Unfortunately these & cannot be removed from the callers as long as
there is a single callee expecting a reference. This patch reduces the
number of such problematic callees.

Change-Id: I21d53c989ea487607dc69e6b3365c023ef6729f5
2018-05-15 17:50:08 +02:00
Translation updater bot 7eed63d895 Localisation updates from https://translatewiki.net.
Change-Id: I60978aab1d3f51556aa5ccc855d5a93c9806973b
2018-05-14 22:44:23 +02:00
Translation updater bot 9ef67abab3 Localisation updates from https://translatewiki.net.
Change-Id: I45006aa155b9a9c6a5ee170c97468da00f90e73d
2018-05-06 22:22:31 +02:00
Kunal Mehta 7a53bd905c Disable PHPCS more narrowly
Change-Id: I20d8b519d5827e865ccd3adf7c2c6ba069f37afb
2018-05-03 19:00:55 -07:00
jenkins-bot dcf8f0926d Merge "MathChemSymbolsDataModule: Remove origin restriction" 2018-04-30 20:42:06 +00:00
jenkins-bot 332682543c Merge "MathMathSymbolsDataModule: Remove origin restriction" 2018-04-30 20:42:04 +00:00
Bartosz Dziewoński 7270d702f1 MathMathSymbolsDataModule: Remove origin restriction
Without this change it would no longer load in safe mode (T185303)
because the module would be missing.

I think this has been copy-pasted from VisualEditor, see commit
I6d097ccbf1dc2462843219adcf96bf8313e30289 there for explanation.

Bug: T185303
Change-Id: I6644a361d1450c394a7f82dc3dad97515982846d
2018-04-30 22:26:28 +02:00
Bartosz Dziewoński 4ccb9abe8a MathChemSymbolsDataModule: Remove origin restriction
Without this change it would no longer load in safe mode (T185303)
because the module would be missing.

I think this has been copy-pasted from VisualEditor, see commit
I6d097ccbf1dc2462843219adcf96bf8313e30289 there for explanation.

Bug: T185303
Change-Id: Ieed46488c94c5809e9f17f667c6926a21ffe838b
2018-04-30 22:25:52 +02:00
Translation updater bot a3aab83b87 Localisation updates from https://translatewiki.net.
Change-Id: I3c4afa25a02d2b17063c6b596b865592e81eff89
2018-04-30 22:22:23 +02:00
jenkins-bot 7349010b55 Merge "Autocomplete LaTeX commands with backslash" 2018-04-29 14:24:20 +00:00
Translation updater bot 4f4c277715 Localisation updates from https://translatewiki.net.
Change-Id: I43dcd58dba27e69c65f7001ac9e48bdd10c31912
2018-04-28 22:32:53 +02:00
Translation updater bot c8d8787040 Localisation updates from https://translatewiki.net.
Change-Id: I69006a89e9b7d6ecb72471ea4f5450a98f9318af
2018-04-27 22:26:02 +02:00
Translation updater bot 6c5983e3d6 Localisation updates from https://translatewiki.net.
Change-Id: I6fa4e2aa576439cefd85eec0a2e28623908e2899
2018-04-26 22:16:40 +02:00
jenkins-bot 5fef05a7f3 Merge "Generate HTML tag using HTML class" 2018-04-24 21:14:50 +00:00
Moritz Schubotz (physikerwelt) ffcfdf488e
Autocomplete LaTeX commands with backslash
Insert required backslash to LaTeX commands.
This should help to avoid that users ommit the backslash for LaTeX commands unintentionally.

Change-Id: I970cec2cb597815cc4272ed573ac1a2ee2682e55
2018-04-24 20:17:21 +02:00
Translation updater bot 7b78dcfc1f Localisation updates from https://translatewiki.net.
Change-Id: Ifc0ecfe5c6d286e969c5c639d7adfb77f56e656f
2018-04-23 22:30:50 +02:00
Moritz Schubotz (physikerwelt) 9fee65ae24
Generate HTML tag using HTML class
Change-Id: I8c37fdaa112cfeac0466f4380e972b63404a8d35
2018-04-23 15:39:30 +02:00
Moritz Schubotz (physikerwelt) 6e28bf8743
Move php source files
Move php source files to scr. This allows jenkins to calculate the test
coverage.

Bug: T126034
Change-Id: If012c6a4fce0fdeaa5a63dad23210a42d1fc80e6
2018-04-23 15:09:23 +02:00
jenkins-bot 600d6867b0 Merge "Move phpunit test files" 2018-04-23 09:34:20 +00:00
Translation updater bot 8f96f27912 Localisation updates from https://translatewiki.net.
Change-Id: I0a542dd46a1191f719e548bac6c47b3d6490146c
2018-04-22 22:21:54 +02:00
Moritz Schubotz (physikerwelt) 88546ae1ad
Move phpunit test files
* currently the phpunit tests are not triggered by jenkins
* some test can't be re-enabled possible reasons:
** the texvc and texvccheck binaries are not available from jenkins
** the binaries can not be generated
** the path to the binaries are not set up correctly

Bug: T142120
Change-Id: I0c8fe5ad652c4663eeb029781521acbf56e42bad
2018-04-22 10:09:12 +02:00
jenkins-bot a1263dbe1f Merge "Update @license tags from GPLv2 to GPL-2.0-or-later" 2018-04-16 22:54:20 +00:00
jenkins-bot ad2a252ac0 Merge "build: Updating mediawiki/mediawiki-codesniffer to 18.0.0" 2018-04-15 19:40:42 +00:00
libraryupgrader d53d01b97d build: Updating mediawiki/mediawiki-codesniffer to 18.0.0
The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag

Depends-On: I4e9749d8058cd6e55c7a4818d01c9d10a9d62efc
Change-Id: Ic4fbcb9ca724e940c102ac6feee0740b583cb14e
2018-04-14 22:39:05 +00:00
Translation updater bot cbbdb83251 Localisation updates from https://translatewiki.net.
Change-Id: If86799bffdfeaa0fe28faae5b0dbede69a7caa73
2018-04-14 22:13:58 +02:00
Thiemo Kreuz 0e8c745885 Update @license tags from GPLv2 to GPL-2.0-or-later
Change-Id: I150433038f8411df0b9f40f5c8933d7a533f426b
2018-04-14 09:36:27 +00:00
Jayprakash12345 270b942c64 Update extensions to take advantage of parser test autodiscovery
Bug: T170037
Change-Id: I2fe982bc146355d7faec03e39a2a59e9d32e22be
2018-04-13 17:37:23 +00:00
jenkins-bot 0a8608399a Merge "Fix MathFormatter failing on new SnakFormatter format MIME types" 2018-04-13 16:11:03 +00:00
Thiemo Kreuz 1f87afa8e6 Fix MathFormatter failing on new SnakFormatter format MIME types
A formatter like this is not supposed to check if the format is known
or not. The code calling these formatters can introduce new (sub) formats
any time. What a formatter like this should do then are two things:
* If it's some HTML format, always return HTML.
* If you really can't identify the format, do a sensible fallback.

This currently blocks introducing a new format in Wikibase.

Bug: T46727
Change-Id: I585069e8f2ba33ec657ca4d514c6d502fe0f5ba3
2018-04-13 14:46:58 +00:00
jenkins-bot 3291177420 Merge "Use "@license GPL-2.0-or-later" according to SPDX" 2018-04-13 14:21:44 +00:00
jenkins-bot dd042cb590 Merge "Use short "@license MIT" according to SPDX" 2018-04-13 14:20:46 +00:00
jenkins-bot d062b933cb Merge "Remove @file tags from normal class level comments" 2018-04-13 14:09:34 +00:00
jenkins-bot 04e17f7e1e Merge "Remove non-helpful comments" 2018-04-13 14:09:33 +00:00
Thiemo Kreuz 945ef79559 Use "@license GPL-2.0-or-later" according to SPDX
Change-Id: I5b9ba062f51dce9fcc10f7c31f37c137176bfff3
2018-04-13 16:07:10 +02:00
Thiemo Kreuz 801888d34b Use short "@license MIT" according to SPDX
Note there is not even a LICENSE.txt in this code base.

Change-Id: I3dccd4187f4a20e3f040c812c5811298794d469a
2018-04-13 16:04:06 +02:00
Thiemo Kreuz 920ca42c59 Remove insonsistent "@ingroup Extensions" tag
This is obviously copy-pasted from somwhere else. Note that this tag
only appears in these two files. No other file does have it. It's not
useful for anything this way.

Change-Id: I7e0dcf0594fb59b396b1fd26b13383d59227b3f9
2018-04-13 15:33:41 +02:00
Thiemo Kreuz 3f0398e031 Remove non-helpful comments
Documenting protected members as protected members is not really helpful.
One can see this by looking at the code.

Same for documenting a variable named "$html…" as "HTML". This does not
add anything.

Change-Id: I72364b6857166d77b9c85aa884cd139dc163c6bb
2018-04-13 15:32:05 +02:00
Thiemo Kreuz cb76291cbf Remove @file tags from normal class level comments
The @file tag is helpful when a block of documentation does not refer
to a class, but to a file. This is not the case here. These comments
can be normal class level comments.

Change-Id: I5ea1a1ecbe2dd681b91b793d4e45e7cd8dee529e
2018-04-13 15:29:59 +02:00
jenkins-bot 82e4283f02 Merge "Fix parameter docs" 2018-04-08 20:04:38 +00:00
Translation updater bot c56ece4620 Localisation updates from https://translatewiki.net.
Change-Id: I27e9fc4471389e34be366fbd11279a13ca2b9ce2
2018-04-07 22:34:30 +02:00
Umherirrender bbc88d5f5d Fix parameter docs
* Removed () from param doc
* Fix return type
* Changed default type

Change-Id: I82d81c99683cb79d60980eaa702c99110af6db94
2018-04-07 21:04:07 +02:00
jenkins-bot 882c4c4450 Merge "Add missing use for namespace Wikimedia\Rdbms" 2018-04-06 14:16:04 +00:00
Translation updater bot 1ca735b9e0 Localisation updates from https://translatewiki.net.
Change-Id: I5742d7ae709d7db7b9376dcfeeac491cd0a2b6b2
2018-04-05 22:22:23 +02:00
Umherirrender ccffa0ece9 Add missing use for namespace Wikimedia\Rdbms
Change-Id: I0aa99485a180644cf86e48a5a0cc53b6f578dc34
2018-04-05 16:11:14 +02:00
Translation updater bot 5e236bc5e1 Localisation updates from https://translatewiki.net.
Change-Id: Ifc2b68c195c1a486ada8a57037d0e0690abed51f
2018-04-04 22:50:39 +02:00
libraryupgrader 5a076f94aa build: Updating mediawiki/mediawiki-codesniffer to 17.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment

Change-Id: Ia8000677263c4150d4900526bcba1c0602664b8e
2018-03-29 03:44:44 +00:00
Translation updater bot 792a3195e2 Localisation updates from https://translatewiki.net.
Change-Id: I26283f3335b1667a6d98810e53a957207d55a0cf
2018-03-24 22:29:29 +01:00
Ed Sanders 6d042da104 Redraw icons to fit 20x20 canvas better
Change-Id: I1222cbcb1e78ded144f1ac1e6376bfebb32be3c7
2018-03-22 15:34:55 +00:00
Bartosz Dziewoński e04e5ee28a Update icons for new 20px grid
Set viewBox to "2 2 20 20" to trim 2px off each side of our
existing 24px icons, therefore aligning them to the new 20px
grid. All of them had been drawn with large margins, so none
of the graphic is lost.

Bug: T177432
Bug: T190151
Change-Id: Ifaa8c27450cde7ed25d4429bd8aba25bcba3bfcc
2018-03-20 18:56:16 +01:00
Translation updater bot 26aa1bc89b Localisation updates from https://translatewiki.net.
Change-Id: I3b43e08ff503ee943c2d553e9932beb6b867e82b
2018-03-19 22:19:33 +01:00