From 6a0391d7fff82c60533594b949f9c5aad60eddaf Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 21 Jun 2019 21:55:53 +0100 Subject: [PATCH] rdbms: Type IDatabase::buildLike param as variadic to Phan Follows-up 725a59f0c7. * The real method in implementing classes is variadic. * PHPUnit 6 on HHVM cannot create a mock for a class with a function that has a variadic parameter in its actual signature. See https://phabricator.wikimedia.org/T191668#5263929 for why. This is why the interface (which we use for mock creation) currently cannot use the variadic syntax in its signature. * Documenting the interface as variadic while leaving the actual signature without it breaks stuff as well (PHPCS, Phan, ..). * Documenting it as not variadic works for everyone, but makes Phan warn "PhanParamTooMany" at call sites when it is used as variadic (to be expected). We can either try to disable this everywhere in repos that use this method, but we have another option that might be cleaner. We can document it as variadic in a way only Phan will consider and consider only for its call-site analysis. Hackadihack, Wickedidou, -- introducing `@phan-param`, per . Bug: T226223 Change-Id: I33c729506c271de0f051b77d5f6aafd7a8705745 --- includes/libs/rdbms/database/IDatabase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index faed1bf3c4..037ae999f8 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -1222,6 +1222,8 @@ interface IDatabase { * @since 1.16 * @param array[]|string|LikeMatch $param * @return string Fully built LIKE statement + * @phan-suppress-next-line PhanMismatchVariadicComment + * @phan-param array|string|LikeMatch ...$param T226223 */ public function buildLike( $param ); -- 2.20.1