From daa9bfab3b0ec6a5fd5823c07bbb85b2c423d0cb Mon Sep 17 00:00:00 2001 From: Zabe Date: Tue, 6 Sep 2022 19:58:55 +0200 Subject: [PATCH] Suppress php 7.4 phan false positive see T298571 This failure only shows up for php 7.4 since that is using dbal 3.x.x while php 7.2 is using dbal 2.x.x Phan analysis is being disabled for those files for php 7.2 since those are now failing with 'unused suppression' and php 7.2 support is going to be dropped in the near future, so that doesn't matter to much. Bug: T316518 Change-Id: I74da37dc4329a7dd2c015a9d1fc7037a866f40c9 --- .phan/config.php | 12 ++++++++++++ includes/libs/rdbms/dbal/MWMySQLPlatform.php | 4 ++++ includes/libs/rdbms/dbal/MWMySQLPlatformCompat.php | 5 +++++ includes/libs/rdbms/dbal/MWPostgreSqlPlatform.php | 4 ++++ .../libs/rdbms/dbal/MWPostgreSqlPlatformCompat.php | 4 ++++ 5 files changed, 29 insertions(+) diff --git a/.phan/config.php b/.phan/config.php index d7a3cbcd527..69161d0dd66 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -104,6 +104,18 @@ $cfg['exclude_analysis_directory_list'] = [ 'includes/PHPVersionCheck.php', ]; +if ( version_compare( PHP_VERSION, '7.4.0', '<' ) ) { + $cfg['exclude_analysis_directory_list'] = array_merge( + $cfg['exclude_analysis_directory_list'], + [ + 'includes/libs/rdbms/dbal/MWMySQLPlatform.php', + 'includes/libs/rdbms/dbal/MWMySQLPlatformCompat.php', + 'includes/libs/rdbms/dbal/MWPostgreSqlPlatform.php', + 'includes/libs/rdbms/dbal/MWPostgreSqlPlatformCompat.php', + ] + ); +} + // Do not use aliases in core. // Use the correct name, because we don't need backward compatibility $cfg['enable_class_alias_support'] = false; diff --git a/includes/libs/rdbms/dbal/MWMySQLPlatform.php b/includes/libs/rdbms/dbal/MWMySQLPlatform.php index 9387d8dc24a..5ed8b5dd59c 100644 --- a/includes/libs/rdbms/dbal/MWMySQLPlatform.php +++ b/includes/libs/rdbms/dbal/MWMySQLPlatform.php @@ -2,6 +2,10 @@ namespace Wikimedia\Rdbms; +/** + * @phan-file-suppress PhanCommentAbstractOnInheritedMethod T298571 + */ + /** * @suppress PhanRedefinedExtendedClass */ diff --git a/includes/libs/rdbms/dbal/MWMySQLPlatformCompat.php b/includes/libs/rdbms/dbal/MWMySQLPlatformCompat.php index 2e82f94c5d1..0a36de0f4eb 100644 --- a/includes/libs/rdbms/dbal/MWMySQLPlatformCompat.php +++ b/includes/libs/rdbms/dbal/MWMySQLPlatformCompat.php @@ -1,5 +1,10 @@ MySQL diff --git a/includes/libs/rdbms/dbal/MWPostgreSqlPlatform.php b/includes/libs/rdbms/dbal/MWPostgreSqlPlatform.php index c3ec2554a75..1caf598c0f6 100644 --- a/includes/libs/rdbms/dbal/MWPostgreSqlPlatform.php +++ b/includes/libs/rdbms/dbal/MWPostgreSqlPlatform.php @@ -1,5 +1,9 @@