Commit graph

13 commits

Author SHA1 Message Date
Bartosz Dziewoński
da1c476b8f Add "implements/extends Stringable" to more classes and interfaces
Follow-up to ccd423225f,
which missed some classes and all interfaces.

Change-Id: Ida0477d548c767f116eb8f465090a19f7986f7ca
2024-06-13 16:06:14 +02:00
C. Scott Ananian
3bded6596a LinkTarget: extend LinkTarget interface from Parsoid and use LinkTargetTrait
This ensures that Parsoid and core can communicate using a common
interface.  By reusing Parsoid's trait it also eliminates code duplication
between LinkTarget, Title, and TitleValue.

Even though Parsoid's LinkTarget interface is identical to core's, I've
elected not to leave an empty LinkTarget interface in core but instead to
(re)define the interface methods in order to make core slightly more
self-contained and avoid the need for core hackers to consult the
Parsoid codebase for the definitions of LinkTarget methods.

A small number of types in core were broadened to accept a Parsoid
LinkTarget instead of just a core LinkTarget, but these changes should
be minimal: only core which directly communicates with Parsoid should
need to know about Parsoid's superinterface here.

Bug: T296023
Depends-On: Id6ad5ac3b8d1c21c129fa94c10879a1632ed4b47
Depends-On: I59794e98c9881aff3ea6a258bf7d1660a203eb84
Depends-On: Ifc14c0ffc43c7939a6e6b55e00fe2f453fa143a1
Change-Id: I9adc349b230834827b002f412dcc697b44773abe
2023-11-22 14:46:54 -05:00
daniel
95ab541612 Doc: link mw:Manual:Modeling_pages
The various classes and interfaces for representing titles, links, and
pages can be a bit confusing. Link to a wiki page that provides an
overview:

https://www.mediawiki.org/wiki/Manual:Modeling_pages

Change-Id: I04fcf53bd15ca50a2bbb8693482a99ab651a4b30
2023-07-10 11:31:00 +00:00
Timo Tijhof
1f34ac4526 title: Remove dated comment about inNamespace(), overall doc cleanup
* The Title::inNamespace() method discouraged use of getNamespace()
  for comparison.

  This was added 10 years ago in r103893 (commit 3414e91bae),
  however no such "change" has been made, and the new LinkTarget
  stable interface and TitleValue class contains the same getNamespace()
  method, and no warning against its use.

  My main reason for removing this comment is so that avoid fear
  against using `in_array()` with TitleValue->getNamespace() which
  this comment seems to discourage. While Title has plural
  inNamespaces(), TitleValue does not. This seems fine, as one can
  simply use in_array for more complex use cases where a range or
  list is compared against.

* Fix Doxygen warnings about invalid or unsupported XML tags
  such as `<a>`, `<siteinfo>` etc. Rephase or use backtics,.

* Fix useless IDE tooltips and Doxygen output by removing empty stubs
  from method overrides that add no new information, yet obscured
  the otherwise inherited parent destination which does have useful
  information.

* Clarify that `renderForComment` must not be mixed with other ones.
  This seems to be how it is intended. Upon realizing that, I think
  this is unreasonable and should perhaps be removed. For now, I've
  documented the hack that it seems to exist for.

* Consistently use imperative mood when phrasing method docs, and
  consistently use a brief first line description, and
  consistently separate it from other paragraphs and annotations
  with one line break.

Change-Id: I7e1819a5d7124c635de84bc64d2371a122195928
2022-01-18 22:25:09 +00:00
Petr Pchelko
cee52db33d Type-hint LinkTarget
These type-hints are definitely correct, but it's still
a relatively risky patch cause of how messy Title is.
I did some manual review of Title, all tests are passing,
but even still if this is approved, I'll add it to phab
as a risky deployment.

Change-Id: I1ed98ddae30066956e7adbde6780d6bab54dec04
2021-10-21 00:12:51 +00:00
daniel
10ccdb2281 Define equality for PageIdentity and LinkTarget
Bug: T272420
Change-Id: I2e0eb21989e2d733088ab77d7461bf003c2905eb
2021-01-19 23:07:37 +00:00
daniel
61a5531e4a Strict return types for PageIdentity
Bug: T208776
Change-Id: I7e71ffc209465b7cca385603d844cd40178485a9
2021-01-18 17:33:14 +01:00
Timo Tijhof
bee9f4db96 Remove various redundant '@license' tags in file headers
Redundant given this is the project-wide license already,
especially in file headers that already include the GPL license
header.

This and other minor fixups based on feedback from Ie0cea0ef5027c7e5.

* Add @file where missing.
* Move @ingroup and @deprecated from file to class doc where needed.

Change-Id: I7067abb7abee1f0c238cb2536e16192e946d8daa
2018-01-12 18:15:11 +00:00
addshore
b559728049 Add __toString method to LinkTarget interface
Change-Id: I4f12e3175a308f88e240db01cd4e91e78b283057
2017-11-18 20:23:21 +00:00
addshore
995c89b0fa Add @since tags to each LinkTarget method.
All current methods were introduced in 1.27

Change-Id: I777a251bae75e5b040f0ef9f608e91022d3e70d7
2016-05-22 12:29:01 +00:00
Kunal Mehta
ab623befc5 Add LinkTarget::inNamespace() helper function
And implementation for TitleValue, plus tests

Change-Id: I42c301e28938dcd55580e20b7c1ddefcbf5a2bef
2016-05-12 08:28:26 +00:00
Kunal Mehta
9b1f8b4ca3 Add interwiki support to LinkTarget and TitleValue
This adds support to the LinkTarget interface and TitleValue
implementation for having an interwiki component, matching the function
names used in Title.

MediaWikiTitleCodec was updated accordingly.

The motivation behind this change is to be able to fully use LinkTarget
in the Linker rewrite instead of depending upon Title.

Change-Id: I6666b64f0e336aadc7261e7ca87ac2e498c61856
2016-04-26 22:25:28 -07:00
Kunal Mehta
c9d885f3b4 Namespace LinkTarget under MediaWiki\Linker
And add a GPL file header while we're at it.

Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
2016-04-21 17:19:10 -07:00
Renamed from includes/LinkTarget.php (Browse further)