From: Daimona Eaytoy Date: Tue, 23 Jun 2020 10:19:13 +0000 (+0200) Subject: build: Bump mediawiki-phan-config to 0.8.0 X-Git-Tag: 1.34.2~3 X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=7049236d2804c52639abae01d266d3ecaaff480f build: Bump mediawiki-phan-config to 0.8.0 So that our CI docker image will work. Disabling new issues (and removing now-unused suppressions) seems better than attempting to fix all 300 of them. Bug: T256088 Change-Id: Ide4a93043244fe254befe55e11a19dafd37a5fe8 --- diff --git a/.phan/config.php b/.phan/config.php index 0fdefe054d..62ceb27991 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -101,6 +101,9 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [ //after dropping HHVM // approximate error count: 110 "PhanParamTooMany", // False positives with variargs. Unsuppress after dropping HHVM + // New errors in phan 0.8.0, see T256088 + 'PhanTypeArraySuspiciousNullable', + 'PhanEmptyForeach', ] ); // This helps a lot in discovering bad code, but unfortunately it will always fail for diff --git a/composer.json b/composer.json index 22a82775de..0cc1dc96dc 100644 --- a/composer.json +++ b/composer.json @@ -77,7 +77,7 @@ "wikimedia/avro": "1.9.0", "wikimedia/testing-access-wrapper": "~1.0", "wmde/hamcrest-html-matchers": "^0.1.0", - "mediawiki/mediawiki-phan-config": "0.7.1", + "mediawiki/mediawiki-phan-config": "0.8.0", "symfony/yaml": "3.4.28", "johnkary/phpunit-speedtrap": "^1.0 | ^2.0" }, diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 6396290f0e..a6cfa0f653 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1127,7 +1127,6 @@ function wfLogProfilingData() { if ( isset( $ctx['forwarded_for'] ) || isset( $ctx['client_ip'] ) || isset( $ctx['from'] ) ) { - // @phan-suppress-next-line PhanTypeArraySuspiciousNullable $ctx['proxy'] = $_SERVER['REMOTE_ADDR']; } diff --git a/includes/Setup.php b/includes/Setup.php index 77d2a49f54..6670f45216 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -391,7 +391,6 @@ $wgSkipSkins[] = 'apioutput'; if ( $wgLocalInterwiki ) { // Hard deprecated in 1.34. wfDeprecated( '$wgLocalInterwiki – use $wgLocalInterwikis instead', '1.23' ); - // @phan-suppress-next-line PhanUndeclaredVariableDim array_unshift( $wgLocalInterwikis, $wgLocalInterwiki ); } diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 7fcb818418..6d66f5a21f 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -251,7 +251,6 @@ class ApiOpenSearch extends ApiBase { if ( is_string( $r['extract'] ) && $r['extract'] !== '' ) { $item['Description'] = $r['extract']; } - // @phan-suppress-next-line PhanTypeArraySuspiciousNullable if ( is_array( $r['image'] ) && isset( $r['image']['source'] ) ) { $item['Image'] = array_intersect_key( $r['image'], $imageKeys ); } diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 0171a37733..6d4f463098 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -329,7 +329,6 @@ class ApiQueryUsers extends ApiQueryBase { } } - // @phan-suppress-next-line PhanTypeArraySuspiciousNullable $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $data[$u] ); if ( !$fit ) { if ( $useNames ) { diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index 99ead166ed..ab8ef2f8de 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -75,7 +75,6 @@ class ForeignAPIFile extends File { ? count( $data['query']['redirects'] ) - 1 : -1; if ( $lastRedirect >= 0 ) { - // @phan-suppress-next-line PhanTypeArraySuspiciousNullable $newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to'] ); $img = new self( $newtitle, $repo, $info, true ); $img->redirectedFrom( $title->getDBkey() ); diff --git a/includes/libs/http/MultiHttpClient.php b/includes/libs/http/MultiHttpClient.php index 85959d6883..2a080aa898 100644 --- a/includes/libs/http/MultiHttpClient.php +++ b/includes/libs/http/MultiHttpClient.php @@ -414,7 +414,6 @@ class MultiHttpClient implements LoggerAwareInterface { if ( $hasOutputStream ) { return fwrite( $req['stream'], $data ); } else { - // @phan-suppress-next-line PhanTypeArraySuspiciousNullable $req['response']['body'] .= $data; return strlen( $data ); diff --git a/includes/libs/objectcache/wancache/WANObjectCache.php b/includes/libs/objectcache/wancache/WANObjectCache.php index 2f44a55c6e..dc8f5cd02e 100644 --- a/includes/libs/objectcache/wancache/WANObjectCache.php +++ b/includes/libs/objectcache/wancache/WANObjectCache.php @@ -1311,7 +1311,6 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt * - Cached or regenerated value version number or null if not versioned * - Timestamp of the current cached value at the key or null if there is no value * @note Callable type hints are not used to avoid class-autoloading - * @suppress PhanTypeArraySuspicious */ private function fetchOrRegenerate( $key, $ttl, $callback, array $opts ) { $checkKeys = $opts['checkKeys'] ?? []; diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index d4fe59c279..1e3326a37d 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -2179,6 +2179,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $opts = $this->makeUpdateOptions( $options ); $sql = "UPDATE $opts $table SET " . $this->makeList( $values, self::LIST_SET ); + // @phan-suppress-next-line PhanTypeComparisonFromArray if ( $conds !== [] && $conds !== '*' ) { $sql .= " WHERE " . $this->makeList( $conds, self::LIST_AND ); } diff --git a/includes/libs/rdbms/loadmonitor/LoadMonitorMySQL.php b/includes/libs/rdbms/loadmonitor/LoadMonitorMySQL.php index 5ae5bbdd9d..738347249c 100644 --- a/includes/libs/rdbms/loadmonitor/LoadMonitorMySQL.php +++ b/includes/libs/rdbms/loadmonitor/LoadMonitorMySQL.php @@ -44,6 +44,7 @@ class LoadMonitorMySQL extends LoadMonitor { protected function getWeightScale( $index, IDatabase $conn = null ) { if ( !$conn ) { + // @phan-suppress-next-line PhanTypeMismatchArgumentReal return parent::getWeightScale( $index, $conn ); } diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 6bce89ad2c..21b3d48ada 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -98,7 +98,6 @@ class FormatMetadata extends ContextSource { * Exif::getFilteredData() or BitmapMetadataHandler ) * @return array * @since 1.23 - * @suppress PhanTypeArraySuspiciousNullable */ public function makeFormattedData( $tags ) { $resolutionunit = !isset( $tags['ResolutionUnit'] ) || $tags['ResolutionUnit'] == 2 ? 2 : 3; diff --git a/includes/media/IPTC.php b/includes/media/IPTC.php index c32db28a79..683ded107a 100644 --- a/includes/media/IPTC.php +++ b/includes/media/IPTC.php @@ -36,7 +36,6 @@ class IPTC { * * @param string $rawData The app13 block from jpeg containing iptc/iim data * @return array IPTC metadata array - * @suppress PhanTypeArraySuspicious */ static function parse( $rawData ) { $parsed = iptcparse( $rawData ); diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index 60aeddaf84..da4de213ad 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -182,6 +182,7 @@ class SpecialLinkSearch extends QueryPage { } $orderBy = []; + // @phan-suppress-next-line PhanTypeMismatchDimFetch if ( !isset( $this->mungedQuery['el_index_60'] ) ) { $orderBy[] = 'el_index_60'; } diff --git a/includes/widget/search/SearchFormWidget.php b/includes/widget/search/SearchFormWidget.php index fedac4b52b..62ee9cb6f1 100644 --- a/includes/widget/search/SearchFormWidget.php +++ b/includes/widget/search/SearchFormWidget.php @@ -148,7 +148,6 @@ class SearchFormWidget { * @param string $profile The currently selected profile * @param string $term The user provided search terms * @return string HTML - * @suppress PhanTypeArraySuspiciousNullable */ protected function profileTabsHtml( $profile, $term ) { $bareterm = $this->startsWithImage( $term ) diff --git a/maintenance/copyFileBackend.php b/maintenance/copyFileBackend.php index 9e36742726..a70e90c846 100644 --- a/maintenance/copyFileBackend.php +++ b/maintenance/copyFileBackend.php @@ -358,7 +358,6 @@ class CopyFileBackend extends Maintenance { // backends in FileBackendMultiWrite (since they get writes second, they have // higher timestamps). However, when copying the other way, this hits loads of // false positives (possibly 100%) and wastes a bunch of time on GETs/PUTs. - // @phan-suppress-next-line PhanTypeArraySuspiciousNullable $same = ( $srcStat['mtime'] <= $dstStat['mtime'] ); } else { // This is the slowest method which does many per-file HEADs (unless an object