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
* MagicWord::getId was added in r24808 (164bb322f2) but never used.
At the time, access modifiers like 'private' were not yet in use.
Deprecate the method with warnings, for removal in a future release.
* Fix zero coverage for MagicWord, due to constructor being
internal, this is only intended to be created via array and
factory classes. Let their tests cover this class.
* Remove redundant file-level description and ensure the class desc
and ingroup tag are on the class block instead.
Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+message:ingroup
* Mark constructor `@internal` (was already implied by
stable interface policy), and explain where to get the object
instead.
* Mark load() `@internal`. Method was introduced in 1.1 when the
class (and PHP) did not yet use visibility modifiers for private
methods. The only way to get an instance of MagicWord
(MagicWordFactory::get) already calls load(), the method is not
a no-op if called a second time, and (fortunately) there exist no
callers to this outside this class that I could find.
* MagicWordArray::getBaseRegex was marked as internal
in change I17f1b7207db8d2203c904508f3ab8a64b68736a8.
Change-Id: I4084f858bb356029c142fbdb699f91cf0d6ec56f
… instead of the generic MWException and even more generic Exception.
Most, if not all of these should be unreachable anyway. I.e. these
are what we call "unchecked" exceptions, see T240672.
We also have a polyfill for preg_last_error_msg. No need to wrap it
in a function_exists (any more).
Change-Id: Ie26bef3b4371d011ec3f1874986072605692f486
This patch is intentionally "incomplete". It's limited to places
where we can be 100% sure about the type just from looking at the
code. More to be done in later patches.
Change-Id: Ideea49ea9603127038ef08c6a9805f40a0b86b6d
Some of these comments are more than 20 years old. Almost all of them
are copy pasted from somewhere else, most certainly without knowing
what they mean. I can only guess that they have been part of some
ancient code folding feature that's not supported any more. Even if,
almost all of them are misplaced by now because the surrounding code
changed without updating the comments.
Change-Id: I53c37f050574a530ec772b7a07b67d84b31bb7a0
4 strings are currently cached. But 3 are trivial derivatives from
the base one. This makes the code look more complicated than it is.
And we are wasting memory without knowing if the other strings are
ever needed.
These methods are not "hot", i.e. they are not called in a loop or
so.
Note the "initRegex" method removed in this patch was marked as
@internal. This means we really don't need to mention it in the
release notes. It makes zero sense to call it from the outside anyway.
Change-Id: I8606daaebc0dd5a8c7da5333841599c80763d75d
The only reason for the callback was to check if a replacement
happened. We can do the same with the native $count feature.
Also inline a trivial sort() callback. It was effectively @internal
as it was obviously never meant to be used from outside of the class.
Both methods have been marked as public in I3588d9d. I think this
was just a mistake.
Change-Id: Ie33d4347f710fe227f9cbd8833c192c11d6e7c89
The line is there since commit bf63ffaa from 2006, see
https://phabricator.wikimedia.org/rMWbf63ffaa
The idea is to have at least one synonym, even if it's meaningless.
Without this later code that expects at least one synonym would fail
or produce unexpected results.
… except exactly that happens with a non-sensical synonym like this.
The line is obsolete at least since I229e87a from 2012. Since then we
stop execution with an exception.
This patch is split from the larger refactoring I943842c to make that
easier to review.
Change-Id: Ic715b9f7b0cb7919f74d33a260edddd3158cffe9
Not used anywhere:
https://codesearch.wmcloud.org/search/?q=addToArray%5Cb
The motivation is to remove one of the two remaining uses of the
internal $this->contLang service to possibly remove it entirely in
a later patch.
Change-Id: I62982e6e329cc4a38a80b85eb4cb8eda97984dc3
Some details:
* Just use a real MagicWord object. It doesn't do anything that
needs mocking.
* Add missing methods to mocks.
* Remove not needed details from mocks.
* Remove duplicate test that does the same.
* Remove pointless assertions that are impossible to ever fail.
Change-Id: I177242429a528d2c7109ca757840b538b772711c