The IPInfo extension uses InfoRetrievers to collect various data (e.g. GeoIP info) about a principal. These InfoRetrievers each have their own *Info DTOs that currently have no shared base class or interface.
As a result, the DefaultPresenter class, which is responsible for converting the information returned by the different InfoRetrievers, needs to be aware of every concrete *Info class there is and therefore needs to be updated every time a new *Info class or InfoRetriever is added. This is busywork and has caused a regression in T371966.
We should instead introduce a base interface for Info classes in IPInfo, e.g.
<?php use MediaWiki\Permissions\Authority; interface InfoInterface() { public function toArray( Authority $authority ): array; }
Doing so would allow decoupling DefaultPresenter from concrete Info classes and allow offloading the relevant conditionals to the corresponding Info class as well.
AC
- IPInfo Info DTOs share a common interface
- DefaultPresenter is not aware of concrete Info DTOs