As a Wikibase developer working on maintaining the PHP Codebase it would be good to know in which component code resides depending on the namespace therefore we can follow this common convention of PSR-4. We would also be able to remove our non-standard Autoload file (and autoload file generation scripts).
Being "PSR-4 compatible" means that the full qualified name of a class is equal to its directory and file name. For example, the file …/Wikibase/client/includes/Api/ApiClientInfo.php contains the class \Wikibase\Client\Api\ApiClientInfo. The mapping for this can be found in Wikibase.git's extension-*-wip.json files in the "AutoloadNamespaces" section: "Wikibase\\Client\\Api\\": "client/includes/Api/" and so on.
Even if most classes in the Wikibase.git code base are already PSR-4 compatible, some are not, which is the reason why there are still such long autoload.php files.
The goal of this ticket is to get rid of the autoload.php files and the build/generateAutoload.php script generating them.
- This ticket is not about the components in the vendor directory (DataValues, Wikibase-DataModel and so on). Changing these is more troublesome because it usually means a breaking release of the component must be made. This is barely worth the trouble.
- It might not be possible to make the maintenance directories PSR-4 compatible, because the file names must follow the naming scheme of maintenance scripts, and can not be made equal to the class name in these file.
- I suggest to create a chain of small patches, each one only touching a single directory, or even a single class if it happens to be used a lot. This makes reviewing much easier.
- You must make sure other code repositories that use Wikibase.git classes are updated when you change the namespace of a class. Use MediaWiki code search for this.
- All PHP classes inside Wikibase git repositories are PSR-4-compliant
- client | Wikibase\Client
- data-access | Wikibase\DataAccess
- lib | Wikibase\Lib
- repo | Wikibase\Repo
- view | Wikibase\View
- autoload.php files are no longer used and removed
- build/generateAutoload.php script is removed
Note: There is no exhaustive list here to remove. If the code all still works with autoload.php removed we know we met our goal.