From: Kunal Mehta Date: Sat, 6 Apr 2019 06:10:08 +0000 (-0700) Subject: Fix phan errors in ChangesListSpecialPage (#6) X-Git-Tag: 1.34.0-rc.0~2130 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=7592e1068bf79999c57704f63d319e0784a7ac3a;p=lhc%2Fweb%2Fwiklou.git Fix phan errors in ChangesListSpecialPage (#6) Specifically in registerFiltersFromDefinitions(), phan was unable to tell that $groupDefinition['class'] was a string. I think it assumed it was an integer because the earlier $groupDefinition['priority'] was an integer. Use phan's more advanced type documentation system to instruct it that $className will be a string. Change-Id: I09f41366b713d6159b57e798cfd1720f42ba30ef --- diff --git a/.phan/config.php b/.phan/config.php index 082a491066..44ebedc506 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -101,8 +101,6 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [ "PhanTypeComparisonFromArray", // approximate error count: 2 "PhanTypeComparisonToArray", - // approximate error count: 2 - "PhanTypeExpectedObjectOrClassName", // approximate error count: 7 "PhanTypeExpectedObjectPropAccess", // approximate error count: 63 diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 9e7e21d06d..1b43a42c59 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -1052,6 +1052,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { * * There is light processing to simplify core maintenance. * @param array $definition + * @phan-param array $definition */ protected function registerFiltersFromDefinitions( array $definition ) { $autoFillPriority = -1; @@ -1072,7 +1073,6 @@ abstract class ChangesListSpecialPage extends SpecialPage { $filterDefinition = $this->transformFilterDefinition( $filterDefinition ); } - // @phan-suppress-next-line PhanNonClassMethodCall $this->registerFilterGroup( new $className( $groupDefinition ) ); } }