Commit graph

11 commits

Author SHA1 Message Date
Umherirrender
e3c1f72bc9 Improve return types in class MagicWordArray
Change-Id: I63ff4f52d8459ab19dd774ef1dee8435f1eb5cae
2019-06-03 17:52:47 +02:00
Fomafix
8a314d9b43 Simplify by using ?: operator
Change-Id: I2851cc51c9e05dd0599733be5af39e19f12b52e2
2019-04-15 15:05:00 +02:00
Thiemo Kreuz
2540c29b20 Use the ?? feature instead of isset() where it makes sense
Change-Id: I3a54f36b33d99ef3ff4c63e32e7dfcbcfc296135
2019-03-24 22:40:49 +01:00
Aryeh Gregor
6142859029 Update MagicWord to use ContentLanguage
Bug: T200246
Change-Id: I9f17142d25bc851c973bebe27e6cbc5be8b70729
2018-08-01 10:39:33 +00:00
Aryeh Gregor
5a16d92e04 Update MagicWordArray to use MagicWordFactory
Bug: T200247
Change-Id: Ie5a60b81382d7299beadc691fe4d27e931ebe0ed
2018-07-31 21:40:21 +03:00
Brad Jorsch
2c34fd6e0e Replace uses of each()
It's deprecated in PHP 7.2, may as well replace it now.

I note that, contrary to claims at
https://wiki.php.net/rfc/deprecations_php_7_2#each, none of our uses
were trivially replaceable with foreach.

* wfArrayDiff2_cmp() is processing two arrays by value in parallel.
* MagicWordArray::parseMatch() is doing something funky with the data
  structure returned by preg_match().
* HashRing was using it like "nextKey()", replaced with calls to key()
  and next().
* FormatMetadata and IndexPager were both using it as a shorter way to
  get both key() and current() for the first element in the array. I
  suppose a foreach(){ break; } would do the same, but that's confusing.

Bug: T174354
Change-Id: I36169a04c764fdf1bfd6603395111c6fe0aae5eb
2017-09-20 09:51:28 -04:00
jenkins-bot
3e88f9fa2a Merge "Get better error message for duplicate names in MagicWordArray" 2017-08-29 18:50:11 +00:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
Umherirrender
a6f4ec848e Get better error message for duplicate names in MagicWordArray
Actually php says:
Warning: Compilation failed: two named subpatterns have the same name at
offset 679

The message is not helpful to find the duplicate name inside the
MagicWordArray, because the generated regex is unknown to count the
correct offset.
Try to detect such duplicates and throw an exception with more
information and a stacktrace.

Change-Id: I95dea67da06aa4000d52ac3338c3b865450b3e23
2017-08-11 14:26:20 +00:00
addshore
2ff9e66986 Add access modifiers to MagicWordArray.php
Change-Id: Ib5fe0fd22a6f24142f1e87338298c1bdef45cc4a
2016-03-01 10:56:55 +00:00
addshore
26cd337c2e Move MagicWordArray class to own file
Change-Id: I9ba602da77f1c8d4270d8ae10d03e82a3197e5b1
2016-03-01 10:49:29 +00:00