Commit graph

9 commits

Author SHA1 Message Date
James D. Forrester
102a4f8a35 build: Upgrade mediawiki/mediawiki-phan-config from 0.13.0 to 0.14.0 manually
* Switch out raw Exceptions, mostly for InvalidArgumentExceptions.
  * Fake exceptions triggered to give Monolog a backtrace are for
    some reason "traditionally" RuntimeExceptions, instead, so we
    continue to use that pattern in remaining locations.
* Just entirely give up on PostgresResultWrapper's resource vs. object mess.
* Drop now-unneeded false positive hits.

Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
2024-02-10 02:22:41 +00:00
James D. Forrester
21d8d9863b Drop old ResourceLoader class aliases, deprecated since 1.39
Depends-On: Iff15a2e13a3507ef1ab5cfa504ca1a1c8d2b2a60
Depends-On: Icf8331e35acf6fe51a8303ee639921b9e4f3e6bb
Depends-On: I5a5af003026db69b279ddde0b0dedbfcfe7d70fd
Change-Id: I5929a2f760c8d21c1cb2542a19220a91ac7240e4
2024-01-31 18:24:37 -05:00
Amir Sarabadani
f5abfb8d58 Bump codesniffer to 42.0.0
Most noisily, this enables MediaWiki.Arrays.OneSpaceInlineArray.

Change-Id: I8ab11399c67ce7e3ab1b6249b591452774393428
2023-09-27 15:06:32 -04:00
Tim Starling
7b3e7c017a Respond to some messages from Phan on PHP 8.1
* ForkController, OrderedStreamingForkController: indeed pcntl_fork()
  can't return false.
* RL\Image: Specify type instead of using suppression, since the issue
  name changes.
* VueComponentParser: Accept complaint about nullable nodeValue.
* Disable PHP 8.0 polyfill stubs when running on PHP 8.0+ to avoid
  duplicate interface errors.
* Add Socket stub and use it in LegacyHandler instead of multiple
  existing suppressions.
* MemcachedPeclBagOStuff: accept complaint recommending !$result over
  $result === false when the type is boolean.
* MemcachedPeclBagOStuff: fix probable bug, ignoring errors from
  Memcached::getMulti(). Phan noticed that $res=false was unreachable,
  but it should probably be reachable.
* DatabaseMysqli: accept complaint that $this->conn->errno is already
  known to be an int. It was probably a hack for some previous version
  of Phan.
* BcryptPassword, MWOldPassword, MWSaltedPassword: accept complaint that
  the !is_string() checks are unnecessary, after code review of PHP.
* Pbkdf2PasswordUsingHashExtension: note that contrary to Phan's
  suggestion, this check is necessary.
* DefaultPreferencesFactory: remove an existing hack for
  array_diff_key(), no longer necessary on 7.4 and causes an error on
  8.1. Use coalesce instead of cast for the remaining
  array_intersect_key() hack since it better shows that we are casting
  away null.
* FullSearchResultWidget: fix likely bug involving strict comparison
  between a float and an int.
* SpecialWatchlist: accept complaint that $selectedHours is
  unconditionally a float, being the return value of round(), and thus
  the cast is unnecessary.
* Add stub for AllowDynamicProperties, resolving an error in User.php.
* Xml: accept complaint that $encMonth is already known to be an int.

Six errors remain. These need suppressions or otherwise conflict with
PHP 7.4 support.

Bug: T322278
Change-Id: Ie375bbc8ccf22330b9a169e8da98f2bbe26ec8b9
2022-11-03 16:25:43 +11:00
Roan Kattouw
f8b6df7ad8 VueComponentParser: Use Zest's getElementsByTagName() rather than PHP's
Bug: T317255
Change-Id: Ibbc69d02663d3f0fb50d6ccddaf79060c4f7625d
2022-09-11 02:45:27 -07:00
Brian Wolff
4c432b6ad5 Add a null check VueComponentParser to prevent php8.1 issues
The third argument to VueComponentParser::element is null for
void elements. Trying to run preg_replace on a null string causes
a warning in php8.1. Add a check for null.

This fixes a unit failure test in php8.1:
RuntimeException: Error parsing file 'resources/skins.vector.search/App.vue'
in module 'skins.vector.search': preg_replace(): Passing null to parameter #3
($subject) of type array|string is deprecated

Bug: T313663
Change-Id: I6904b0279ecc7bada3f8203a165307c17e5ee795
2022-08-24 08:01:41 +00:00
Tim Starling
3e2653f83b ResourceLoader namespace (attempt 2)
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
2022-05-24 15:41:46 +00:00
Lucas Werkmeister (WMDE)
a241d83e0a Revert "ResourceLoader namespace"
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
2022-05-16 14:43:33 +00:00
Tim Starling
e08ea8ccb9 ResourceLoader namespace
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
2022-05-16 14:41:27 +10:00
Renamed from includes/resourceloader/VueComponentParser.php (Browse further)