| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
I assume these are all either auto-generated by an IDE or the
language-level type declarations have been added later. In any case
the comments don't add any new information to what the code already
says. This is just extra clutter that makes the code harder to read,
I would argue.
There are many, many more comments like this. In this patch I
intentionally focus on the most trivial 1-line comments.
Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
|
|
|
|
|
|
|
|
|
| |
isset() should only be used to suppress errors, not for null check.
When the property is always defined, there is no need to use isset.
Found by a new phan plugin (2efea9f989)
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset
Change-Id: I186e799256fbaf5ee77558bd146f9418dd5eaacc
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add more precise type hints to every method I could find that takes
message params as arguments, so that Phan will warn if bool or null
is passed, which is deprecated (T378876).
Errors found in this repository thanks to these checks
are fixed in I286a4a51e879bdf61f65c87dc078621c51045bee.
Bug: T378876
Change-Id: I3e0df790ff9db2fa630f82408a7254a359fe61ca
|
|/
|
|
|
|
|
|
|
|
| |
The existing `?string` typehint causes phan to complain when integers
are passed. However, these values are only used to build a query string,
and the code works just as fine with integers. On top of that, some of
these things are commonly integers anyway (things like limits and
offsets), so it makes sense to accept integers explicitly.
Change-Id: I5c6b8ad8075d295666a6a04d8c95398dfd9f4060
|
|
|
|
|
| |
Bug: T353458
Change-Id: I088cbc53fbcdb974e5b05b45a62e91709dacc024
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no way to express that Title::castFromPageIdentity(),
Title::castFromPageReference() and Title::castFromLinkTarget()
can only return null when the parameter is null. We need to add
Phan suppressions or explicit types almost everywhere that these
methods are used with parameters that are known to not be null.
Instead, introduce new methods Title::newFromPageIdentity() and
Title::newFromPageReference() (Title::newFromLinkTarget() already
exists), without the null-coalescing behavior, and use them when
the parameter is not null. This lets static analysis tools, and
humans, easily understand where nulls can't appear.
Do the same with the corresponding TitleFactory methods.
Change the obvious uses of castFrom*() to newFrom*() (if there is
a Phan suppression, a type check, or a method call on the result).
Change-Id: Ida4da75953cf3bca372a40dc88022443109ca0cb
|
|
|
|
|
|
|
|
|
|
|
| |
Deprecated in MW 1.39:
* Ic75bd597b210e14612ca3aebb531b659897e8294
* I4e2f36b543462aa5d852733da650fb70d49ebf06
Hard-deprecated in MW 1.40:
* I09e9203b19e3808af9348db8a889d5e118282230
Change-Id: I17bd8f80e87a04674e826d7966aa3ddb011fc7ba
|
|
|
|
|
|
|
|
|
|
| |
Deprecated in MW 1.39 in commits:
* Ic75bd597b210e14612ca3aebb531b659897e8294
* I4e2f36b543462aa5d852733da650fb70d49ebf06
Depends-On: I8b3adfe907ae16279ec3d480b7eedec5901884f2
Depends-On: I376361bc86a6085fe94a5439b04239ab123a515c
Change-Id: I09e9203b19e3808af9348db8a889d5e118282230
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is moderately messy.
Process was principally:
* xargs rg --files-with-matches '^use Title;' | grep 'php$' | \
xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1'
* rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \
xargs rg --files-with-matches 'Title\b' | \
xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1'
* composer fix
Then manual fix-ups for a few files that don't have any use statements.
Bug: T166010
Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
|
|
|
|
|
| |
Bug: T321882
Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
|
|
|
|
|
|
|
|
|
|
| |
To follow Message. This is approved as part of RFC T166010.
Also namespace it but doing it properly with PSR-4 would require
namespacing every class under language/ and that will take some time.
Bug: T321882
Change-Id: I195cf4c67bd51410556c2dd1e33cc9c1033d5d18
|
|
|
|
|
|
|
| |
We already depend on this behavior in IndexPager::getNavigationBuilder(),
but it wasn't allowed by the type hints and wasn't covered by tests.
Change-Id: I9343e852dc4610a50adf1c22ed429ec0a40da816
|
|
|
|
|
|
|
|
|
|
| |
Follow-up to Ic75bd597b210e14612ca3aebb531b659897e8294.
No longer needed after I161dc0159e4372e3478341ee3fbea13b723d9fc1.
This is a public method, but it has not been included in a release
yet, so we can remove it without deprecation.
Change-Id: Ie5eea4d3423136812178747e187771e7cf78e95f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extensions like CheckUser expect IndexPager::makeLink() to be used for
displaying the navigation links of the pager, and it was marked as
'@stable to override'.
If IndexPager::makeLink() is overridden, it will be called instead of
PagerNavigationBuilder::makeLink(). This behavior is considered
deprecated.
Also mark PagerNavigationBuilder::makeLink() as protected and
'@stable to override', to provide a migration path. Users can now
override IndexPager::getNavigationBuilder() to return a subclass
of PagerNavigationBuilder, and override makeLink() on that subclass.
Follow-Up: cfd6ffe7bbadf8177da34460930ca4780bd38524
Bug: T317477
Change-Id: I4e2f36b543462aa5d852733da650fb70d49ebf06
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had several implementations of almost identical paging links:
* PrevNextNavigationRenderer: The nicest one, somewhat recently added
(4ca72763ec). Unfortunately it was also the least featureful: only
supporting paging by numeric offset and not by index, and not able
to generate "first"/"last" links. Also, I didn't realize that it
exists when working on 94553a1bcb and b95d208340, so it was missing
those changes too.
* IndexPager/ReverseChronologicalPager/AlphabeticPager: These have
been here forever. The most featureful, but not configurable, so
a large part of the implementation was copy-pasted in two classes.
* SpecialWhatLinksHere: Through some accident of history, this one
special page ended up with its own implementation???
They are all replaced to use the new PagerNavigationBuilder.
It may be slightly too much, but I had fun writing it.
Notable changes compared to PrevNextNavigationRenderer:
* Adds <div class="mw-pager-navigation-bar"> wrapper around the
navigation and <span class="…"> wrappers on inactive links
* The current limit link is made inactive
(like the "prev" link when on first page, etc.)
Notable changes compared to ...Pager/...Pager/...Pager:
* Does not generate useless tooltips that contain only the
title of the page, can use custom tooltips
* The current limit link is made inactive
(like the "prev" link when on first page, etc.)
* All links have query parameters in a consistent order:
?title= &... &dir= &offset= &limit= (some of them are optional)
These changes affect many special pages and actions. I tested on:
* Special:Contributions (ReverseChronologicalPager)
* action=history (ReverseChronologicalPager)
* Special:Categories (AlphabeticPager)
* Special:WantedPages (PrevNextNavigationRenderer)
* Special:Search (PrevNextNavigationRenderer)
* Special:WhatLinksHere
Bug: T308364
Change-Id: Ic75bd597b210e14612ca3aebb531b659897e8294
|
|
|
|
|
|
|
| |
Also modified new APIs added to ApiErrorFormatter to
use PageReference instead of Title.
Change-Id: I093c89f8e1e6d383603f887358be6ece70f23a02
|
|
|
|
|
|
| |
Should be a no-op
Change-Id: I7c94dd923c4bc4478885dc02195a65c39bf0c16a
|
|
|
|
| |
Change-Id: I346073b59d283029bd6666356c62c81e687ea5e6
|
|
|
|
|
|
|
| |
Bug: T231636
Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9
Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0
Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
|
|
Refactored buildPrevNextNavigation() into standalone helper class,
PrevNextNavigationRenderer, to be used by both SpecialPages and Pagers.
Bug:T207977
Change-Id: Ic49837a451f795ec203e867961ec1c69075cc91a
|