| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead
Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a
Break one long line in SpecialPage.php
Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
|
|
|
|
|
| |
Bug: T353458
Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I'm not sure how this ever happened, but I'm sure it's a mistake.
The following test scenario should make it very obvious:
* {{#formatdate:-0002-12-31|mdy}}
* {{#formatdate:-0001-12-31|mdy}}
* {{#formatdate:0000-12-31|mdy}}
* {{#formatdate:0001-12-31|mdy}}
* {{#formatdate:0002-12-31|mdy}}
Expected output: 3 BC, 2 BC, 1 BC, 1, 2, …
Current output: 3 BC, 2 BC, 0 (?), 1, 2, …
Note how "1 BC" is skipped and shown as "0" instead. Everything else
is correct, e.g. the ISO year -1 is already displayed as "2 BC".
It's really only this single outlier.
In case you don't know: There is no year 0 when the BC specifier is
used. There is either year 1 after or year 1 before Christ. This is
different in ISO, mostly to make calculations easier. That's why the
DateFormater already does an extra `- 1` and `+ 1` in the two
makeIsoYear and makeNormalYear methods.
The problematic line of code was originally written in 2003, see
https://phabricator.wikimedia.org/rMW98fc03e6
The core parser function exists since 2009, see
https://phabricator.wikimedia.org/rMWb9ffb5a7
Change-Id: Iaeb7a954579a409fefd87dab4e2a15778ab39fb4
|
|
|
|
|
| |
Bug: T321882
Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why?
* I found the LAST constant somewhat fragile and redundant. A
complete array of target formats already exists. We can just use
that.
* We can use the convenient ?? operator now.
Parts of this patch are split from I6e113d1. I believe this here is
uncontroversial, that's why I re-submitted it as a separate patch.
Change-Id: Id5c480d4e0183aa64fa4f19a5c03bbb537f9f971
|
|
|
|
|
|
|
|
| |
Available since PHP 7.4.
Automated search, manual replacement.
Change-Id: Ibb163141526e799bff08cfeb4037b52144bb39fa
|
|
|
|
| |
Change-Id: I85a5ec6ed354000a0f50e80f1e1201113c1cad3e
|
|
|
|
|
|
|
|
|
|
| |
These are created once in the constructor and never touched again.
Modern PHP allows us to be much more expressive in constants.
Intentionally not doing anything else in this patch. More cleanup
will be done in a later patch.
Change-Id: Icae484dd7e2dd2a05247c111d9f2261c214c5d4e
|
|
|
|
| |
Change-Id: Ibe5f921c6378c24137f503f1625262bb5842bfe2
|
|
|
|
|
|
|
|
|
|
|
| |
Make phan stricter about array keys
Remaining false positive issues are suppressed.
The suppression and the setting change can only be done together
Bug: T304887
Depends-On: I3105a5fd4826f8667b5232834defc5ec93be32a1
Depends-On: Ie9610a6e83731468311edb3ed17f80fc509de385
Change-Id: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef
|
|
|
|
|
|
|
|
| |
Nothing to learn from these.
You can find a longer explanation in the comments in I93751e6.
Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
|
|
|
|
|
|
| |
Found by sonarqube
Change-Id: I3464d25e94d98aaca55d9209d5175542b335f994
|
|
|
|
|
| |
Bug: T277987
Change-Id: Iafc4b3e3137936046487119b7e17635f4e560277
|
|
|
|
| |
Change-Id: I6d98efcfac1f1c0ab6a442e0af6d5daa6ef7801a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This code is surprisingly little changed since I added the class in
November 2003, and needs some modernisation.
* Remove the "linked" option, unused since 1.21. Similarly, make the
"match-whole" option implied. This allows the regexes to be
simplified. Nothing will be broken, according to CodeSearch.
* Instead of ucfirst(), use the canonical month name from the language.
This will work with e.g. French which does not capitalise month names.
* Stop caching DateFormatter instances in APC. Caching was added
in 2005 when initialisation was being done on every request, but now
it is only needed when parsing a page with {{#formatdate}}, which is
rarely, and the constructor overhead is only 200µs after Language
object data initialisation. Instead, use an in-process cache via a
factory service.
* Add docs and extra tests.
* Remove todo note obsolete since 38 minutes after the original commit.
* Rename many variables.
* Use double-slash comments
* Don't store the Language object, just get arrays.
* Use mb_strtolower() instead of Language::lc() -- any customisation of
Language::lc() would break PCRE case-insensitive matching.
* Use named subpatterns instead of "keys"
* Remove the ISO1/ISO2 distinction, the only difference was linking.
* Use closure variables instead of temporary object members
Change-Id: I25fb1203dba2930724d7bc28ad0d51f59f88e1ea
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some languages have date abbreviations that contain ".", which allows
the non-ISO regexes to match an input string containing an invalid month
name. Use preg_quote() to avoid this.
Also fix the error handling case of makeIsoMonth(). If the input date is
invalid, don't try to wrap it in a date span, since that's semantically
incorrect and may also access unset members of $bits, causing a notice.
Bug: T220563
Change-Id: Ib2b3fb315dc93b60de595d3c445637f6bcc78a1a
|
|
|
|
| |
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
|
|
|
|
|
|
| |
Also use ?? instead of ?: to check for null.
Change-Id: I058b61d7e06cdefecdafa82f60109cc386e2a809
|
|
|
|
|
|
|
| |
Brought to you by vim macros.
Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
|
|
|
|
| |
Change-Id: I677ab561d67b63f0c86f65fadf9319e41444a22a
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The parameter $lang is not used with type string in the Git repository:
https://codesearch.wmflabs.org/search/?q=DateFormatter%3A%3AgetInstance
This function is only used with type Language and without parameter.
The support for the language as string will be removed with Change-ID
I677ab561d67b63f0c86f65fadf9319e41444a22a.
The removal of the support for the type string simplifies the code.
Change-Id: I0c0ab46ffc0fab6b68672940e979ad7e5754a7d1
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.
Bug: T153505
Change-Id: I8bbb26e248cd6f213fd0e7460d6d6935a3f9e468
|
|
|
|
|
|
|
|
| |
As discussed in https://gerrit.wikimedia.org/r/#/c/332702/ , these
methods and fields shouldn't have been marked public in the first place.
No outside users. Also, declare a couple of fields and remove unused ones.
Change-Id: I7775978c87d983784a484ee2ad901d25c42499b3
|
|
|
|
|
|
|
|
|
|
| |
Undeclared variables are a very common error type that we want to catch
as often as possible. To avoid needing to refactor a variety of global
level code (mostly in old-style maintenance scripts) this ignores
undeclared variables in global scope. This is still a good improvement
over what was happening previously.
Change-Id: I50b41d571724244552074b9408abbdf6160aca59
|
|
|
|
|
|
|
|
|
|
| |
Per wikitech-l consensus:
https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html
Notes:
* Disabled CallTimePassByReference due to false positives (T127163)
Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
|
|
|
|
|
|
| |
The name is clearer and more consistent, with simpler arguments.
Change-Id: I7205a99ce033e8b086a52cd02c8a721e99c84b1e
|
|
|
|
|
|
|
| |
Also consistently use self:: instead of BagOStuff:: for constants
referenced within the BagOStuff class.
Change-Id: I20fde9fa5cddcc9e92fa6a02b05dc7effa846742
|
|
|
|
| |
Change-Id: Idfff805903bffcdd6ff8f2a3c1331ca63476933e
|
|
|
|
|
|
|
|
| |
* Declare undeclared variables
* Kill unused variables
* Fix comments including PHPDoc
Change-Id: I60015f6b6740aa9088bda3745f4dc4e65e29fcb1
|
|
|
|
| |
Change-Id: Ic5c04bdb88bc57a7c44159d7858ef791c24354c4
|
|
|
|
|
|
|
|
| |
This fixes all issues except for:
- class names
- line length
Change-Id: Ie91b010d5b3eec49d3b80b6e93b125a901ef43c6
|
|
|
|
|
|
|
|
|
|
| |
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: I8ebfbcea0e2ae2670553822acedde49c1aa7e98d
|
|
|
|
|
|
|
|
|
| |
See https://bugzilla.wikimedia.org/65375#c4
This reverts commit f359cdf61462782743a87943938ef4cce78b2647.
Bug: 65375
Change-Id: I12a60b5cc52a07a6deabcbf47c7c99cd2faac3c3
|
|
|
|
| |
Change-Id: I16dd3a792cc83f8c80b3652d42c055730f6d177a
|
|
|
|
|
|
|
| |
Remaining are the classes containing underscores and possibly a few other
issues that will be addressed soonish.
Change-Id: Icf56374c71afc134420ebbcfecf12dcb29dc9564
|
|
|
|
| |
Change-Id: If03a9bd5eb83be4d15f54e73f49f42540fb7d5fc
|
|
|
|
|
|
|
|
|
| |
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: I49f8f48b521878de7abd9cc40efdeff6cf9a37e0
|
|
|
|
|
|
|
| |
... and very few other documentation details that are closely connected
to these mistakes.
Change-Id: I5b2691948e196124c77f0cc04d0ed5a7167cac25
|
|
|
|
|
|
| |
While at it, added/removed some other spaces in the same files
Change-Id: Iabb23a448f6f53eb6020155f9c744f74f8b11786
|
|
|
|
|
|
|
| |
Added spaces before if, foreach
Added some braces for one line statements
Change-Id: I11bbcfa351e945b7bde10c2105d61a3cf5622205
|
|
|
|
|
|
|
|
|
| |
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !
Fixed windows newline style
Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
|
|
|
|
|
|
|
|
|
|
|
| |
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays
Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
|
|
|
|
|
|
|
|
|
| |
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls
Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"
Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
|
|
|
|
|
|
|
|
|
|
|
| |
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.
Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
|
|
|
|
|
|
|
|
| |
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments
Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
|
|
|
|
| |
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
|
|
|
|
| |
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
|
|
|
|
|
|
|
|
|
|
|
| |
Add a lang parameter to DateFormatter so it can work in any language instead of only the site content language.
(The memcached key is now per language code.)
Use by default parser->getTargetLanguage() so it is parsed in the page content language by default.
Also add some documentation and remove unneeded whitespace.
If needed, a parameter to {{#dateformatter}} can now be easily added, to specify the language to format in.
Change-Id: If61854920065f7c3b4170ab89e9aa66b299f9dd8
|
|
|
|
|
|
| |
Also made file/class documentation more consistent.
Change-Id: I10c077f27a2077a266a64048fa137f7b1f8e226c
|