Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F585413
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/.phan/config.php b/.phan/config.php
index 8bf844963bf..ffd2a9a1536 100644
--- a/.phan/config.php
+++ b/.phan/config.php
@@ -20,10 +20,8 @@
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
-// Whilst MediaWiki is still supporting PHP 7.4+, this lets us run phan on higher versions of PHP
-// like 8.0 without phan trying to get us to make PHP 7.4-incompatible changes. This value should
-// match the PHP version specified in composer.json and PHPVersionCheck.php.
-$cfg['minimum_target_php_version'] = '7.4.3';
+// This value should match the PHP version specified in composer.json and PHPVersionCheck.php.
+$cfg['minimum_target_php_version'] = '8.1.0';
$cfg['file_list'] = array_merge(
$cfg['file_list'],
diff --git a/includes/ResourceLoader/ResourceLoader.php b/includes/ResourceLoader/ResourceLoader.php
index 5e5e9ec534f..5bb1a34f148 100644
--- a/includes/ResourceLoader/ResourceLoader.php
+++ b/includes/ResourceLoader/ResourceLoader.php
@@ -1280,6 +1280,7 @@ MESSAGE;
*/
public static function ensureNewline( $str ) {
$end = substr( $str, -1 );
+ // @phan-suppress-next-line PhanImpossibleTypeComparison
if ( $end === false || $end === '' || $end === "\n" ) {
return $str;
}
diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php
index 5dcf0e59955..9cc0dd78f40 100644
--- a/includes/import/WikiImporter.php
+++ b/includes/import/WikiImporter.php
@@ -1289,7 +1289,6 @@ class WikiImporter {
/**
* Open the XMLReader connected to the source adapter id
- * @suppress PhanStaticCallToNonStatic, UnusedSuppression -- for PHP 7.4 support
*/
private function openReader() {
// Enable the entity loader, as it is needed for loading external URLs via
diff --git a/includes/language/ConverterRule.php b/includes/language/ConverterRule.php
index 3fcbee6a8a7..75969861359 100644
--- a/includes/language/ConverterRule.php
+++ b/includes/language/ConverterRule.php
@@ -110,6 +110,7 @@ class ConverterRule {
$flags[$validFlags[$ff]] = true;
}
}
+ // @phan-suppress-next-line PhanRedundantCondition
$text = strval( substr( $text, $sepPos + 1 ) );
}
diff --git a/includes/language/MessageCache.php b/includes/language/MessageCache.php
index 5ffdb0e39e9..0855d9c4c4b 100644
--- a/includes/language/MessageCache.php
+++ b/includes/language/MessageCache.php
@@ -1289,6 +1289,7 @@ class MessageCache implements LoggerAwareInterface {
// Message page exists as an override of a software messages
if ( substr( $entry, 0, 1 ) === ' ' ) {
// The message exists and is not '!TOO BIG' or '!ERROR'
+ // @phan-suppress-next-line PhanRedundantCondition
return (string)substr( $entry, 1 );
} elseif ( $entry === '!NONEXISTENT' ) {
// The text might be '-' or missing due to some data loss
@@ -1338,6 +1339,7 @@ class MessageCache implements LoggerAwareInterface {
$this->cache->setField( $code, $title, $entry );
}
// The message exists, so make sure a string is returned
+ // @phan-suppress-next-line PhanRedundantCondition
return (string)substr( $entry, 1 );
}
diff --git a/includes/libs/filebackend/MemoryFileBackend.php b/includes/libs/filebackend/MemoryFileBackend.php
index bf30e7faa59..87f75a0ac5f 100644
--- a/includes/libs/filebackend/MemoryFileBackend.php
+++ b/includes/libs/filebackend/MemoryFileBackend.php
@@ -239,6 +239,7 @@ class MemoryFileBackend extends FileBackendStore {
foreach ( $this->files as $path => $data ) {
if ( strpos( $path, $prefix ) === 0 ) {
$relPath = substr( $path, $prefixLen );
+ // @phan-suppress-next-line PhanImpossibleTypeComparisonInLoop
if ( $relPath === false ) {
continue;
} elseif ( strpos( $relPath, '/' ) === false ) {
@@ -268,6 +269,7 @@ class MemoryFileBackend extends FileBackendStore {
foreach ( $this->files as $path => $data ) {
if ( strpos( $path, $prefix ) === 0 ) {
$relPath = substr( $path, $prefixLen );
+ // @phan-suppress-next-line PhanImpossibleTypeComparisonInLoop
if ( $relPath === false ) {
continue;
} elseif ( !empty( $params['topOnly'] ) && strpos( $relPath, '/' ) !== false ) {
diff --git a/includes/libs/rdbms/database/resultwrapper/PostgresResultWrapper.php b/includes/libs/rdbms/database/resultwrapper/PostgresResultWrapper.php
index 5ed8bf3c6a9..a297981de9a 100644
--- a/includes/libs/rdbms/database/resultwrapper/PostgresResultWrapper.php
+++ b/includes/libs/rdbms/database/resultwrapper/PostgresResultWrapper.php
@@ -2,9 +2,11 @@
namespace Wikimedia\Rdbms;
-// Phan insists these are resources until we drop PHP 7.4
-/* @phan-file-suppress PhanTypeMismatchArgumentInternal */
-
+/**
+ * Result wrapper for PostgreSQL database results.
+ *
+ * @since 1.37
+ */
class PostgresResultWrapper extends ResultWrapper {
/** @var DatabasePostgres */
private $db;
@@ -26,18 +28,23 @@ class PostgresResultWrapper extends ResultWrapper {
}
protected function doNumRows() {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
return pg_num_rows( $this->result );
}
protected function doFetchObject() {
// pg_fetch_object may raise a warning after a seek to an invalid offset
+ // @phan-suppress-next-next-line PhanTypeMismatchArgumentInternal
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
$row = @pg_fetch_object( $this->result );
// Map boolean values (T352229)
if ( is_object( $row ) ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
$numFields = pg_num_fields( $this->result );
for ( $i = 0; $i < $numFields; $i++ ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
if ( pg_field_type( $this->result, $i ) === 'bool' ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
$name = pg_field_name( $this->result, $i );
$row->$name = $this->convertBoolean( $row->$name );
}
@@ -47,13 +54,17 @@ class PostgresResultWrapper extends ResultWrapper {
}
protected function doFetchRow() {
+ // @phan-suppress-next-next-line PhanTypeMismatchArgumentInternal
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
$row = @pg_fetch_array( $this->result );
// Map boolean values (T352229)
if ( is_array( $row ) ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
$numFields = pg_num_fields( $this->result );
for ( $i = 0; $i < $numFields; $i++ ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
if ( pg_field_type( $this->result, $i ) === 'bool' ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
$name = pg_field_name( $this->result, $i );
$row[$i] = $this->convertBoolean( $row[$i] );
$row[$name] = $this->convertBoolean( $row[$name] );
@@ -82,17 +93,21 @@ class PostgresResultWrapper extends ResultWrapper {
}
protected function doSeek( $pos ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
pg_result_seek( $this->result, $pos );
}
protected function doFree() {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
return pg_free_result( $this->result );
}
protected function doGetFieldNames() {
$names = [];
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
$n = pg_num_fields( $this->result );
for ( $i = 0; $i < $n; $i++ ) {
+ // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
$names[] = pg_field_name( $this->result, $i );
}
return $names;
diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php
index aa0de92531e..dd60155f3c1 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -1133,7 +1133,7 @@ class CoreParserFunctions {
*/
public static function anchorencode( $parser, $text ) {
$text = $parser->killMarkers( $text );
- $section = (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
+ $section = substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
return Sanitizer::safeEncodeAttribute( $section );
}
diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php
index a40b96a684b..32aafa05e0a 100644
--- a/maintenance/convertExtensionToRegistration.php
+++ b/maintenance/convertExtensionToRegistration.php
@@ -104,7 +104,7 @@ class ConvertExtensionToRegistration extends Maintenance {
foreach ( $vars as $name => $value ) {
$realName = substr( $name, 2 ); // Strip 'wg'
- if ( $realName === false ) {
+ if ( $realName === '' ) {
continue;
}
diff --git a/tests/phpunit/DynamicPropertyTestHelper.php b/tests/phpunit/DynamicPropertyTestHelper.php
index f91377d6faf..6597f9ca6b6 100644
--- a/tests/phpunit/DynamicPropertyTestHelper.php
+++ b/tests/phpunit/DynamicPropertyTestHelper.php
@@ -11,11 +11,11 @@ use Wikimedia\Assert\Assert;
*
* PHP 8.2 has deprecated dynamic property creation for objects not explicitly annotated with #[AllowDynamicProperties].
* The recommended migration path for associating arbitrary data with objects is WeakMap, which is only available starting from PHP 8.0.
- * As long as MediaWiki still supports PHP 7.4, this requires a compatibility layer for dynamic property creation on classes
+ * Whilst MediaWiki still supported PHP 7.4, this required a compatibility layer for dynamic property creation on classes
* that do not support it, by utilizing WeakMap when available and falling back to regular dynamic property creation
* on PHP 7.4.
*
- * This class can be removed and its usages converted into direct WeakMap usage once MediaWiki only supports PHP 8.0 and above.
+ * This class can be removed and its usages converted into direct WeakMap usage now that MediaWiki only supports PHP 8.0 and above.
*
* @since 1.42 (also backported to 1.39.8, 1.40.4 and 1.41.2)
* @internal Only for use by core PHPUnit setup functionality.
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:33 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227817
Default Alt Text
(9 KB)
Attached To
Mode
rMW mediawiki
Attached
Detach File
Event Timeline
Log In to Comment