Based on .eslintignore; docs/html/, in particular, can contain a handful
of PHP files that shouldn’t be linted. (All four directories are
generated, see .gitignore and docs/html/.gitignore.)
Change-Id: I0fb06d4a6c716680850de93096395650afe3802b
Also change the letter case in the file names to be consistent to other
files in includes/specials.
The PHPCS exclude-pattern for these files on
MediaWiki.Files.ClassMatchesFilename.NotMatch can now removed.
The old class names are still available as aliases and are deprecated
now.
Change-Id: Id71f5a5ce456caf522c95c477487e14f366c1b40
This allows methods to be defined instead of global functions, which in
this case, were missing the "wf" prefix.
Change-Id: I2413675f46a29d914cb756071cd6abbcf38b500e
* maintenance/benchmarks: 4 files were deleted in d814a74b6f.
1 file was deleted in 4c5de97a9b.
* includes/Stub*.php: 3 files were moved in 0fff5089ba to a
new subdirectory. phpcs:ignore comments were added in the move.
Change-Id: I8b2c71e0e054f969741691f29dca62adeab757bd
Since 096ea23208, these no longer exist as global functions:
* moveToExternal
* resolveStub
* resolveStubs
Change-Id: I1c36ece4d84895647a27aaf7160ac3b66c402f01
This comment was added in 355a6cd4c3 and quickly became outdated.
While it should still mostly be correct, it is no longer "policy" to use
the at-ease library. The "@" operator is now explicitly permitted where
necessary and is now recommended even outside tests (T253461). As such,
it no longer makes sense to keep this comment around.
Change-Id: I07aa84d46be8c7e5a1c8a3249d382cbbfef80267
Also:
* In .phpcs.xml, remove "showUsage" from the list; transstat.php was
removed in e19f4e16a6.
* In styleTest.css.php, check the type of the $_GET value as part of the
"basic sanitization".
Change-Id: Icb82d8a42dd6cd062f41a04696f092b43b04f54f
Since 863a1d5bdd the converter classes are in own files.
therefor the exclude for the rule
Generic.Files.OneObjectStructurePerFile.MultipleFound is not needed
anymore.
Change-Id: Id10ba77fc4caf9065a8f0e3480f42aad492275e4
The Language converter classes are not in this folder anymore and don't
use the pattern of two classes in one file anymore.
Change-Id: Ie25bc2fe4ad860c218145615caefbfee2200d1c6
With PHPUnit 9, tests without @covers tags are considered risky and emit
warnings. Not having @covers is bad practice anyway, so use
@coversNothing instead to make the intention clear, and re-enable the
phpcs rule.
Also rewrite an assertion in ResourcesTest that was bothering me.
Bug: T243600
Change-Id: I6dd683f93b6b2faed5f107be2ca7860602277fbc
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader itself.
Move the tests by analogy.
I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".
I did not address DependencyStore which continues to have a non-standard
location and namespace.
Revert of a241d83e0a.
Bug: T308718
Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
This reverts commit e08ea8ccb9.
Reason for revert: Breaks Phan in extensions, and as far as I’m aware,
this change isn’t urgently needed for anything, so the simplest fix is
to revert it again for now. After PHP 7.4 it should be safer to try this
again (we hopefully won’t need the two “hack” classes by then).
Bug: T308443
Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader and
ResourceLoaderContext.
Move the tests by analogy.
I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".
I did not address DependencyStore which continues to have a non-standard
location and namespace.
Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
This further removes files that are not maintenance scripts from this
directory. It isn't used outside of tests, either.
While at it, rename this to a PSR-4 namespace consistent with some of
the other test-only classes.
Change-Id: Ibc49617631f17a5e9489789a90a7b8537340ead3
There is a common and reasonable need for longer lines in tests.
The nudge for shorter lines doesn't seem valuable here. The natural
breaks will likely still fall in 80-100 given the enforced practice
for non-test code, e.g. whether through habit, or 80-100 column markers
in text editors, or the finite width of diff and code review
interfaces.
Change-Id: I879479e13551789a67624ce66f0946d2f185e6ee
* Enforce the ban on is_resource in phpcs
* In OrderedStreamingForkController, the comment was incorrect. I
confirmed using a small test script that if the child closes one end
of a socket pair, the other end will still be open, and is_resource()
will still return true, and fclose() will not fail. The issue was
introduced in c82d30d19c, it was not present in the
CirrusSearch copy of the class.
* Allow is_resource() for debug logging.
* Allow is_resource() for parameter validation where a stream may be
passed to a function, since there is no alternative.
Bug: T260735
Change-Id: I59a752f7bb4b043ddfb2434b52a02f9221bf54db
$wgShellLocale was a flawed solution to the problem of locale
dependence. MediaWiki has its own concept of locale (the Language
hierarchy) and any kind of dependence on the server's libc locale is
incorrect and harmful, leading to bugs. Developers have an expectation
that functions like strtolower() will work in a certain way, and
respecting the locale set in the environment at install time violates
this expectation.
The problems with using C as a locale, which led to $wgShellLocale, are:
* escapeshellarg() will strip non-ASCII characters. This can be worked
around by not using it. The security vulnerability it was trying to
fix can be prevented in another way.
* Shell commands like rsvg will fail to correctly interpret UTF-8
arguments. This is the reason for the putenv(). On Linux, this can
be fixed by using C.UTF-8, which we didn't know at the time. On
Windows, the problem is not relevant (there are unrelated issues
with UTF-8 arguments).
Bug: T291234
Change-Id: Ib5ac0e7bc720dcc094303a358ee1c7bbdcfc6447
This is done without a deprecation process since the function is
@internal and completely unused outside of core.
Bug: T291341
Change-Id: I4b074f83f9be67b5b5bc2d33b2a6a55bb109a2b3
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is
$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;
Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.
Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
This change is for consistency to the file name and to other classes.
The old class name RandomPage is kept as alias for compatibility and is
now deprecated.
Also change the letter case in the class names and file names:
* SpecialRandompage -> SpecialRandomPage
* SpecialRandomredirect -> SpecialRandomRedirect
* SpecialRandomrootpage -> SpecialRandomRootPage
The change of the letter case of file names may cause problems on
Windows operating systems.
Change-Id: If4dd23126e0d032f42a86aff7d09414edcb1ade2
Use /* at the end of exclude-pattern when excluding the whole folder,
see Id95236edbd3d87f57719d235c7c9cee366180099 for explaination
Remove the file extension when excluding the whole folder,
because it process php files only by the extensions argument set to php
Change-Id: Icaad23ab4b1708a5ce17930f77067ac9224169b5
The quibble test infrastructure generates LocalSettings-installer.php
during continuous integration testing, and (depending on the exact
set of extensions installed) it could end up violating various sniffs
relating to excess white space. Easiest just to ignore it.
Change-Id: I34c5783a1bc8c5646fbabafaf442e20c91de41ed
Some irritating breaking changes, including dropping PHP 7.2 support
and renaming the classes we care about. For now, hack in via || and
some back-compatibility class aliases.
Bug: T270732
Change-Id: I685f099584d2f0e5fa17f1f4275eab5289c7bfee
As per comments on phabricator, the Suppressor was used when phan still
didn't have per-line suppression, which is no longer the case. The phan
script was also outdated and broken, so just remove everything.
Bug: T267859
Change-Id: Ic4a68dd30a4481656a5c44b2446cf851ea638c1c