Commit graph

10 commits

Author SHA1 Message Date
Thiemo Kreuz
65c42a6034 Simplify a few binary checks for bit 1
( $var & 1 ) is either 0 or 1, which can be used as a boolean value.
The main advantage of this is that there is no confusion with the
operator precedence. In `$var & 1 !== 1` the `!==` is executed first,
effectively turning it into `$var & 0`. This always succeeds.

Change-Id: I53c81a3891d42b2660eefc311f1f0f2523104894
2019-05-17 16:57:23 +02:00
Thiemo Kreuz
9314453c93 Make use of the list() feature where it makes sense
This code is functionally identical, but less error prone (not so easy
to forget or mix these numerical indexes).

This patch happens to touch the Parser, which might be a bit scary. We
can remove this file from this patch if you prefer.

Change-Id: I8cbe3a9a6725d1c42b86e67678c1af15fbc5961a
2019-03-24 20:12:23 +00:00
Umherirrender
9d5e2fd751 Move class RangeDifference to own file
Change-Id: I5262c7484017a0d920cc24297515d5946f614ee6
2019-03-08 23:29:14 +01:00
Bartosz Dziewoński
4fd27f006f Use PHP 5.6 '**' operator instead of 'pow()' function
Change-Id: Ieb22e1dbfcffaa4e7b3dcfabbcc999e5dd59a4bf
2018-05-30 18:05:19 -07:00
Kunal Mehta
f093fb4192 Don't globally disable PHPCS's prohibition of assert()
Whitelist the remaining usages of assert(), and reinstate the PHPCS sniff
that forbids usage of it. Add FIXME comments as well, so any casual readers
of the code will not think that the disabling and usage is intentional.

Change-Id: I7cabe715c0e6aa6a9ef3ffe5657f3de7fd8e662b
2018-05-07 17:15:16 +00:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Fomafix
d2997347a2 PHP code style: No space after unary not operator
Change-Id: I4d3df0cfcda4d88e405164123893e57786fbe15e
2017-01-05 16:00:59 +00:00
Max Semenik
dd57ff3cce Rethink diff limits
Now, instead of "if your changed paragraphs are larger than 10Kb, you're
screwed":
* Instead of relying on overall length, estimate complexity after splitting to words
  and taking any equal head and tail out of equation.
* Estimate based on words changed, which better reflects the actual complexity
  of generating a diff.
* New limit is determined scientifically, i.e. "above that number XDebug starts
  complaining about recursion limits reached in Vagrant".

Caveat: if new limits are hit, the consequences are more widespread as all adjacent
changed paragraphs are displayed without word level diffs, as opposed to only the
paragraph that's too long being affected. However, the new limit is much higher and
in wikitext you're supposed to put empty lines between paragraphs anyway, negating
this problem.

Bug: T128697
Change-Id: I4e91c7c40f5afdd116b847a859b8517522302489
2016-06-01 16:30:58 -07:00
Max Semenik
33cb9e803a Improve diff docs
Change-Id: I42332051f6f1b94f459b06d6c69625bc2a1fa9cf
2016-05-18 01:59:29 +00:00
Max Semenik
20f066e971 Merge Wikidiff3 into DiffEngine
Change-Id: Ib4d083a5200824e4d032de6921c375e455e77fb2
2016-05-18 01:50:19 +00:00
Renamed from includes/diff/WikiDiff3.php (Browse further)