aboutsummaryrefslogtreecommitdiffstats
path: root/includes/diff/WordAccumulator.php
Commit message (Collapse)AuthorAgeFilesLines
* Move DiffEngine and helpers to includes/libs/Diff and put them in a namespaceTim Starling2023-06-201-114/+0
| | | | | | | I will address the dependencies on MW core in a followup. Bug: T339184 Change-Id: I892364b0c9f15c9de4cfc29c683670c172d71764
* Fix more PHPStorm inspections (#2)Tim Starling2023-03-251-2/+2
| | | | | | | | | | | | | | | * Illegal string offset and invalid argument supplied to foreach, due to incorrect type information * Array internal pointer reset is unnecessary * $hookData unused since MW 1.35 due to incomplete revert * array_push() with single element * Unnecessary sprintf() * for loop can be replaced with str_repeat() * preg_replace() can be replaced with rtrim() * array_values() call is redundant * Unnecessary cast to string * Unnecessary ternary. Often the result relies on short-circuit evaluation, but I find it more readable nonetheless. Change-Id: I4c45bdb59b51b243fa96286bec8b58deb097d707
* WordAccumulator: use htmlspecialchars with ENT_NOQUOTESTim Starling2022-11-021-3/+4
| | | | | | | | | | PHP 8.1 adds single quotes to the list of encoded characters when htmlspecialchars() is called with no flags. That's usually harmless, but this instance breaks an extension test. So use ENT_NOQUOTES which is optimal for text which is not inside a tag or attribute. Bug: T322099 Change-Id: I3a2c385771b3f00a38a238bf745bd2997be60a9c
* Improve and add documentation to diff related classesUmherirrender2020-11-221-0/+6
| | | | Change-Id: Ic10c700e970018fa0b9a219d96d56908b0298d71
* Use @internal instead of @private per policydaniel2020-06-261-1/+1
| | | | | | | | https://www.mediawiki.org/wiki/Stable_interface_policy mandates the use of @internal. The semantics of @private was never properly defined. Bug: T247862 Change-Id: I4c7c6e7b5a80e86456965521f88d1dfa7d698f84
* Use \u{00A0} instead of   or  Fomafix2018-06-241-1/+1
| | | | | | | | | | | | | Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of the HTML/XML entities   or   or  . With the UTF-8 character the generated HTML is shorter and better to read. Also change the special value for the label in HTMLForm from   to U+00A0 but also support   for backward compability. Bug: T154300 Change-Id: I882599ac1120789bb4e524c4394870680caca4f4
* Don't globally disable PHPCS's prohibition of assert()Kunal Mehta2018-05-071-0/+2
| | | | | | | | 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
* Miscellaneous indentation tweaksBartosz DziewoƄski2017-02-271-4/+2
| | | | | | | | | | I was bored. What? Don't look at me that way. I mostly targetted mixed tabs and spaces, but others were not spared. Note that some of the whitespace changes are inside HTML output, extended regexps or SQL snippets. Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
* Refactor diffsMax Semenik2016-05-171-0/+107
* Merge MappedDiff into WordLevelDiff * Rename <something insane>WordAccumulator into WordAccumulator and namespace * Better variable names Change-Id: I5847f2bb89402d0537b9e99cccd24c547ce4e4e2