mediawiki-extensions-Discus.../includes
C. Scott Ananian 25272e7a4a Don't refer directly to PHP dom extension classes; avoid nonstandard behavior
These changes ensure that DiscussionTools is independent of DOM
library choice, and will not break if/when Parsoid switches to an
alternate (more standards-compliant) DOM library.

We run `phan` against the Dodo standards-compliant DOM library,
so this ends up flagging uses of non-standard PHP extensions to
the DOM.  These will be suppressed for now with a "Nonstandard DOM"
comment that can be grepped for, since they will eventually
will need to be rewritten or worked around.

Most frequent issues:

* Node::nodeValue and Node::textContent and Element::getAttribute()
can return null in a spec-compliant implementation.  Add `?? ''` to
make spec-compliant results consistent w/ what PHP returns.

* DOMXPath doesn't accept anything except DOMDocument.  These uses
should be replaced with DOMCompat::querySelectorAll() or similar
(which end up using DOMXPath under the covers for DOMDocument any way,
but are implemented more efficiently in a spec-compliant
implementation).

* A couple of times we have code like:
  `while ($node->firstChild!==null) { $node = $node->firstChild; }`
and phan's analysis isn't strong enough to determine that $node is still
non-null after the while.  This same issue should appear with DOMDocument
but phan doesn't complain for some reason.

One apparently legit issue:

* Node::insertBefore() is once called in a funny way which leans on
the fact that the second option is optional in PHP.  This seems to be
a workaround for an ancient PHP bug, and can probably be safely
removed.

Bug: T287611
Bug: T217867
Change-Id: I3c4f41c3819770f85d68157c9f690d650b7266a3
2021-07-30 18:15:40 -04:00
..
Actions Notification unsubcribe button 2021-06-01 23:29:53 +02:00
Hooks build: Updating dependencies 2021-07-22 16:29:04 +00:00
Notifications Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
ApiDiscussionTools.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
ApiDiscussionToolsEdit.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
ApiDiscussionToolsSubscribe.php Config option to enable topic subscriptions backend and dtenable=1 URL parameter 2021-06-14 16:18:18 +02:00
CommentFormatter.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
CommentItem.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
CommentModifier.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
CommentParser.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
CommentUtils.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
Data.php build: Updating dependencies 2021-07-22 16:29:04 +00:00
HeadingItem.php build: Updating dependencies 2021-07-22 16:29:04 +00:00
ImmutableRange.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
NodeFilter.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
ServiceWiring.php build: Updating dependencies 2021-07-22 16:29:04 +00:00
SubscriptionItem.php build: Updating dependencies 2021-07-22 16:29:04 +00:00
SubscriptionStore.php build: Updating dependencies 2021-07-22 16:29:04 +00:00
ThreadItem.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
TreeWalker.php Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00