Fix phan errors in ChangesListSpecialPage (#6)
authorKunal Mehta <legoktm@member.fsf.org>
Sat, 6 Apr 2019 06:10:08 +0000 (23:10 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Sat, 6 Apr 2019 06:20:02 +0000 (23:20 -0700)
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

.phan/config.php
includes/specialpage/ChangesListSpecialPage.php

index 082a491..44ebedc 100644 (file)
@@ -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
index 9e7e21d..1b43a42 100644 (file)
@@ -1052,6 +1052,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
         *
         * There is light processing to simplify core maintenance.
         * @param array $definition
+        * @phan-param array<int,array{class:string}> $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 ) );
                }
        }