Commit graph

44 commits

Author SHA1 Message Date
Fomafix 6468bf9ebb Replace deprecated Language::isValidBuiltInCode and Language::factory
Change-Id: I4c5bf4d68bcb79da33864dbffe395e3818050eb4
2022-09-17 10:00:50 +00:00
Reedy f647423039 Correct namespacing to match best practices
Bug: T303105
Change-Id: Ic09ed23c4248e74f93e5807212fe73d241251281
2022-03-05 15:06:59 +00:00
jenkins-bot 7fce8ab74b Merge "Fix and update PHPDoc type hints" 2021-11-21 00:09:47 +00:00
Thiemo Kreuz ce22d48123 Fix and update PHPDoc type hints
The parameters passed to these parser hook handler functions have
guaranteed types. They are either strings or an array of PPNode
objects, depending on the SFH_OBJECT_ARGS flag. When a parameter is
missing the default value from the function header is used.

Change-Id: Ie0196f43f94cf002110c07ad2de30adfa6b77179
2021-11-20 08:52:38 +00:00
Thiemo Kreuz dbe77d7edf Use more IDE-friendly callback syntax for parser hooks
This way my IDE (in this case PHPStorm) can actually follow these
references. Strg+click brings me straight to the function, and back.
I assume other tools, linters and such might benefit the same way.

I think this is worth having a bit more duplication.

Change-Id: I16260443e0f1513b9a4715874a513c7a399b5d92
2021-11-19 18:25:10 +01:00
libraryupgrader 5b572a6f6a build: Updating mediawiki/mediawiki-codesniffer to 37.0.0
Change-Id: I1f93907a1f7b9f3dace4b2e65f7532cedc11800f
2021-07-23 06:43:57 +00:00
TChin 66f7d36e68 Record #ifexist media in imagelinks table
`#ifexist` used to only record media links if the file existed, now it does it either way.

Bug: T245965
Change-Id: Ida5dd30669fbc3471d792fd4c202bb0ff74737ec
2021-07-01 19:33:50 +00:00
libraryupgrader 7df8411050 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
  The following sniffs now pass and were enabled:
  * MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic

* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Ifaca144ccfd753ea00d1dbba0d12941b0050e2a4
2021-05-04 08:49:27 +00:00
Umherirrender 4213826c4d Convert define() to class const in ExprParser
All are only used in this class, making it private

Change-Id: I83b5be672e12c42a34aed621e1c2571beee84abb
2021-04-04 23:17:27 +02:00
Umherirrender e36977934e build: Swap deprecated @codingStandardsIgnore to phpcs:ignore
Bug: T278594
Change-Id: I5845b9a421aa6dc1bda0469e4b13b5abc2b7b12d
2021-04-03 23:29:19 +02:00
Umherirrender d8a18b0878 Use HookHandlers for core hooks
Change-Id: I340caf0904b04dec04d218dc6813aa752ca5e9c4
2021-03-06 19:32:52 +01:00
C. Scott Ananian ff89dae8ff Replace use of Parser::$mOutput, deprecated in 1.35
The replacement, Parser::getOutput(), has been in MediaWiki for over a
decade (since 1.12.2 in 2008).

Bug: T275160
Change-Id: I4f4f7b0118470741a6cdaba562f858e425fcf350
2021-02-18 18:51:56 -05:00
Umherirrender 5fee8a2c9b Usage of Yoda conditions is not allowed; switch the expression order
Change-Id: I87fe0930cb9bc2f6af75ba8fabd4391ba4a2d7e2
2020-11-19 22:42:50 +01:00
Reedy 3767db25f7 Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: If4de0fff2886961481faeefe3f8021ae6760e116
2020-05-30 01:27:32 +01:00
ArtBaltai a3706c0d42 Use LanguageConverter::findVariantLink() instead of Language::findVariantLink()
Bug: T226832
Change-Id: I6d7e9019def4bbccdbffcdcfd523e614902fe1e6
2020-05-06 04:11:23 +03:00
DannyS712 6a9432647e PHP coding conventions: reorder doxygen tags
See https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Doxygen_tags

Change-Id: Id8fc6d999ace1f222cbb6cc91e70652f60cf4f8b
2020-03-26 15:49:31 +00:00
Umherirrender b00143f151 Use MediaWikiServices::getLinkCache()
Since 1.28

Change-Id: I502726983b7ebddcf887d377a1c87740441b0a12
2020-03-14 21:25:00 +01:00
Umherirrender 2c97d15088 Use MediaWikiServices::getRepoGroup
This required MediaWiki 1.34

Change-Id: I1578dffaa20d80696378827397a0593d1c634477
2020-03-14 14:45:29 +01:00
libraryupgrader b718f1bf1a build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: Id96905c5755a2705e434b3d1755827d2788c0efb
2020-01-14 09:00:15 +00:00
Max Semenik 1e8444fad1 Improve ExprParser test coverage
Had to change a bit how ExprError is used, to prevent having to turn unit
tests into ingergation tests, adding 5 seconds to run time.

Change-Id: Id4e158f3a4418d320b1c0bdac834ebbba03762af
2019-09-05 15:37:21 -07:00
Max Semenik 8d6e567e5a ParserFunctions class: tweak function declarations
* Force type hints
* Documentation
* Give links to documentation on mw.org to make high-level understanding of
  what each function does easier.

Change-Id: I7708343540b7980e57b68ce9b2d9816d2aee710f
2019-07-20 21:27:52 +00:00
jenkins-bot c8a1f28418 Merge "ParserFunctions class: make everything that doesn't need to be public private" 2019-07-20 21:19:01 +00:00
jenkins-bot dad921ea53 Merge "Remove function existence check" 2019-07-18 02:50:44 +00:00
Max Semenik cca4ec9af0 Remove function existence check
PPFrame::setTTL() is present in every supported MediaWiki version.

Change-Id: I7065723bfbd2170cd7c951d1f9b3c4a0318f9938
2019-07-18 02:38:17 +00:00
Max Semenik 3fd4ac43ac ParserFunctions class: make everything that doesn't need to be public private
Change-Id: I818315e5f0cd80700731d212ba11fbf341582ba1
2019-07-18 02:36:30 +00:00
Max Semenik 8b50403fe8 Get rid of *Obj() functions
They're a rudiment from the time when the extension had to be compatible
with both SFH_OBJECT_ARGS supporting and not versions of MediaWiki.
This is in the past, so unify them now by merging and or deleting the
old versions. The resulting functions don't end with "Obj" anymore.
One "common" function was left alone to be refactored at a later time,
however I've renamed it and made private.

Change-Id: Ice97e587bf7cc0469476c2e53268d2774ddfdd04
2019-07-18 02:35:53 +00:00
Max Semenik 439544224f Replace a single use function with a closure
Change-Id: Id6408bb203fc984f7baaaf3358cea79c281005bf
2019-04-04 17:22:04 -07:00
Max Semenik e721c193d9 Avoid using $wgContLang
Change-Id: If43a6aa5580397264b2ca9dff5ef7d0da859e3d6
2019-04-03 23:25:11 -07:00
Max Semenik e684068ed9 Convert variable used as a constant into constant proper
Change-Id: I1c7914cc9015c18f4c3877b4acc5b3be921ec4d5
2019-04-03 19:20:15 -07:00
Max Semenik 3c54e29505 Improve hook handler documentation
Change-Id: I2ae4271ec5e5a06d81a39ab9e528c6072c0f7731
2019-04-03 19:20:15 -07:00
Max Semenik 8e7a3ce5df Remove b/c code
New code requires 1.32, this extension requires 1.32.

Change-Id: I14b9d0074d057d6fb323d54502d0a4c64fc74879
2019-04-03 19:20:15 -07:00
Max Semenik f53debae7d Namespace this extension
Change-Id: I0c7719f17f74180a4c85f914888262f7e3b13111
2019-04-03 19:20:14 -07:00
Kunal Mehta ab601a2ca7 Upgrade to newer phan
Bug: T216933
Change-Id: If8a63da99343597b7f8c131f3656945eaf67d819
2019-03-16 22:39:09 -07:00
jenkins-bot 111c434c4e Merge "Enable string functions if running parser/PHPUnit tests" 2019-02-07 23:41:04 +00:00
Kunal Mehta 662734cc6f Enable string functions if running parser/PHPUnit tests
Instead of using a global variable specific to Wikimedia CI, always enable
string functions when running parser and PHPUnit tests.

Bug: T180192
Bug: T200650
Change-Id: I27764036e42800be437d69d96ce2b7bc1b1f7cb3
2019-02-07 01:59:13 +00:00
Alexia E. Smith cf1480cb96 Fix E_WARNING with {{#pos:}} if the offset is larger than the string
The mb_strpos() function throws E_WARNING if the offset is longer
than the length of the string.

Bug: T209600
Change-Id: Ib4296ba136eaf5c8461681e9d5f108118b2494f4
2018-11-15 12:50:32 -08:00
RazeSoldier d258457e01 Use "break" instead of "continue" inside a switch
"continue" statements in a switch are equivalent to "break". In PHP 7.3, will generate a warning.

Also change the indentation.

Bug: T206977
Change-Id: I8ad0ef6508e73bcca7dabfe2e88d661dd409bdfb
2018-10-15 15:45:06 +00:00
libraryupgrader 52c6ccb4a0 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Change-Id: Ia5c70d201c26b6894b0f0f028a8838fcb72ef784
2018-09-03 06:58:49 +00:00
Aryeh Gregor cc6f6cd01c Don't call SpecialPageFactory methods statically
This is deprecated in 1.32. Bump minimum requirement of MediaWiki to
1.32 since this is a tarball-bundled extension.

Depends-On: Id8a92d57743f790b7d8c377c033cef38d1bb24de
Change-Id: Ie18c7c97405124ccaa3922b4a25fa7b40496039f
2018-08-17 11:04:59 -07:00
Aryeh Gregor a06cf6f41c Don't use deprecated MagicWord static methods
Bug: T200247
Change-Id: I62b5c87af33ae77d3e305de8b39374d7f18199fa
2018-08-01 11:45:04 +03:00
Kunal Mehta 26b8e44180 Remove & from $mwDefault variable assignment
There's no need for it to be a reference in the first place.

Bug: T200772
Change-Id: I1252d481103f3f0ce1ce28b59dcba746f7611598
2018-07-31 09:58:10 -07:00
libraryupgrader 7d78876400 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I3bb3a973a23be71fd35e0a0a91c533a63ecef4f3
2018-05-26 05:31:24 +00:00
Umherirrender 37805a4fa0 Fix indent of elseif
Removed comments which breaks the elseif in "blocks"
and make phpcs unhappy

Change-Id: I4f05728659b4b7eff9bc2bd1bf90a5ac79244f11
2018-02-25 00:02:10 +00:00
Kunal Mehta 9f94cebdaa Move classes to includes/
Change-Id: Iefaa21bf911fa7dcf11aedd38648bed945b905f9
2018-02-24 14:06:58 -08:00