rdbms: Type IDatabase::buildLike param as variadic to Phan
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 21 Jun 2019 20:55:53 +0000 (21:55 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 24 Jun 2019 00:45:33 +0000 (00:45 +0000)
commit6a0391d7fff82c60533594b949f9c5aad60eddaf
treedcc4b1b374afa7f92636f17b20e9b06440a31cb0
parent291a9237dcd761bc250bfad9a9bf0cd04be071a2
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
<https://github.com/phan/phan/wiki/Annotating-Your-Source-Code>.

Bug: T226223
Change-Id: I33c729506c271de0f051b77d5f6aafd7a8705745
includes/libs/rdbms/database/IDatabase.php